fix: zoom crash — check_resize after zoom to reallocate instance buffer

adjust_zoom now calls check_resize() which recalculates grid_w/grid_h
and reallocates the GPU instance buffer to match the new grid size.
Previously zoom changed grid_w/h but the buffer stayed at the old size,
causing index-out-of-bounds panic.
This commit is contained in:
Emil
2026-06-22 19:37:59 +03:00
parent 43085772cd
commit 69e3a6578e
2 changed files with 2 additions and 12 deletions
+1 -6
View File
@@ -1122,12 +1122,7 @@ impl GraphicsRenderer {
return;
}
self.char_size = new_size;
let new_grid_w = (self.swapchain_extent.width / self.char_size) as usize;
let new_grid_h = (self.swapchain_extent.height / self.char_size) as usize;
if new_grid_w > 0 && new_grid_h > 0 {
self.grid_w = new_grid_w;
self.grid_h = new_grid_h;
}
self.check_resize();
}
pub fn cell_pixel_size(&self) -> u32 {
+1 -6
View File
@@ -719,12 +719,7 @@ impl VulkanRenderer {
return;
}
self.char_size = new_size;
let new_grid_w = (self.swapchain_extent.width / self.char_size) as usize;
let new_grid_h = (self.swapchain_extent.height / self.char_size) as usize;
if new_grid_w > 0 && new_grid_h > 0 {
self.grid_w = new_grid_w;
self.grid_h = new_grid_h;
}
self.check_resize();
}
pub fn cell_pixel_size(&self) -> u32 {