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:
parent
e5d0716c0f
commit
d3d28a310d
1 changed files with 4 additions and 0 deletions
|
|
@ -622,6 +622,10 @@ impl<D: Display> Graphics<D> {
|
||||||
|
|
||||||
pub fn change_layout(&mut self, layout: &Layout, mod_state: &[ModState])
|
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.rasterize_labels(layout);
|
||||||
self.draw(layout, mod_state);
|
self.draw(layout, mod_state);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue