Move more logic into fj-viewer

This commit is contained in:
Hanno Braun 2024-11-15 19:27:24 +01:00
parent bbdf3958c3
commit 394f5417b3
2 changed files with 5 additions and 4 deletions

View File

@ -84,7 +84,10 @@ impl Viewer {
/// Handle the screen being resized
pub fn on_screen_resize(&mut self, new_size: ScreenSize) {
self.current_screen_size = new_size;
self.renderer.handle_resize(new_size);
if new_size.is_valid() {
// We should only supply valid screen sizes to the renderer.
self.renderer.handle_resize(new_size);
}
}
/// Compute and store a focus point, unless one is already stored

View File

@ -147,9 +147,7 @@ impl ApplicationHandler for DisplayState {
// Only do a screen resize once per frame. This protects against
// spurious resize events that cause issues with the renderer.
if let Some(size) = self.new_size.take() {
if !self.stop_drawing {
viewer.on_screen_resize(size);
}
viewer.on_screen_resize(size);
}
viewer.draw();