mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-25 08:30:24 +00:00
Another attempt to fix high-DPI viewport jank
This commit is contained in:
@@ -71,7 +71,12 @@ pub mod wasm {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_event::<ViewportResizeEvent>().add_systems(
|
||||
PreUpdate,
|
||||
(dispatch_resize_events, sync_window_to_viewport).chain(),
|
||||
(
|
||||
dispatch_resize_events,
|
||||
apply_deferred,
|
||||
sync_window_to_viewport,
|
||||
)
|
||||
.chain(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -88,9 +93,7 @@ pub mod wasm {
|
||||
let ViewportSize { width, height } = event.0;
|
||||
let mut window = window.single_mut();
|
||||
let scale_factor = window.scale_factor();
|
||||
window
|
||||
.resolution
|
||||
.set(width * scale_factor, height * scale_factor);
|
||||
window.resolution.set(width, height);
|
||||
q_camera.single_mut().viewport = Some(Viewport {
|
||||
physical_size: UVec2::new(
|
||||
(width * scale_factor) as u32,
|
||||
@@ -98,7 +101,7 @@ pub mod wasm {
|
||||
),
|
||||
..Default::default()
|
||||
});
|
||||
info!("Viewport size: ({:.2}, {:.2})", width, height);
|
||||
info!("Viewport size: ({width:.2}, {height:.2}) [{scale_factor}]");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user