From 3e4eb21e5e5ff15cfbb651d807c7dacd5c5b22ed Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Tue, 8 Oct 2024 22:27:52 +0200 Subject: [PATCH] fix zooming causing sub-pixel offset, leading to rendering artifacts --- src/editor.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/editor.rs b/src/editor.rs index 27cb053..54d6412 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -230,6 +230,8 @@ impl Editor { self.zoom += delta; let tile_size = (16 << self.zoom) as f32; 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) {