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.
This commit is contained in:
Richard Acayan 2024-09-30 22:13:29 -04:00
parent e5d0716c0f
commit d3d28a310d

View file

@ -622,6 +622,10 @@ impl<D: Display> Graphics<D> {
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);
}