fix zooming causing sub-pixel offset, leading to rendering artifacts

This commit is contained in:
Crispy 2024-10-08 22:27:52 +02:00
parent 4c4563c326
commit 3e4eb21e5e

View file

@ -230,6 +230,8 @@ impl Editor {
self.zoom += delta; self.zoom += delta;
let tile_size = (16 << self.zoom) as f32; let tile_size = (16 << self.zoom) as f32;
self.view_offset = mouse_pos - tile_pos_of_mouse * tile_size; self.view_offset = mouse_pos - tile_pos_of_mouse * tile_size;
self.view_offset.x = self.view_offset.x.floor();
self.view_offset.y = self.view_offset.y.floor();
} }
fn zoom_in(&mut self, d: &RaylibHandle) { fn zoom_in(&mut self, d: &RaylibHandle) {