From d3d28a310d4ddefd748e020e2ebd58fb2e2a3e93 Mon Sep 17 00:00:00 2001 From: Richard Acayan Date: Mon, 30 Sep 2024 22:13:29 -0400 Subject: [PATCH] core: graphics: update scale when layout changes With the new layout switching, the size of the layout can change. The scale depends on the size of the layout. Update the graphics scale when the layout changes. --- src/core/graphics.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/graphics.rs b/src/core/graphics.rs index a580d76..71d20af 100644 --- a/src/core/graphics.rs +++ b/src/core/graphics.rs @@ -622,6 +622,10 @@ impl Graphics { pub fn change_layout(&mut self, layout: &Layout, mod_state: &[ModState]) { + let (width, height) = self.disp.size(); + self.x_scale = width as f64 / layout.width(); + self.y_scale = height as f64 / layout.height(); + self.rasterize_labels(layout); self.draw(layout, mod_state); }