Merge pull request #3001 from csmoe/window-event-scale-change

feat: add window::Event::ScaleFactorChanged
This commit is contained in:
Héctor 2025-11-29 06:55:02 +01:00 committed by GitHub
commit 625fc76f19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -28,6 +28,9 @@ pub enum Event {
/// A window was resized.
Resized(Size),
/// A window changed its scale factor.
Rescaled(f32),
/// A window redraw was requested.
///
/// The [`Instant`] contains the current time.

View file

@ -331,6 +331,9 @@ pub fn window_event(
Some(Event::Window(window::Event::Moved(Point::new(x, y))))
}
WindowEvent::ScaleFactorChanged { scale_factor, .. } => {
Some(Event::Window(window::Event::Rescaled(scale_factor as f32)))
}
_ => None,
}
}