Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have WindowPosition::Centered take scale_factor_override into account #13949

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions crates/bevy_winit/src/winit_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,12 @@ pub fn winit_window_position(
if let Some(monitor) = maybe_monitor {
let screen_size = monitor.size();

// We use the monitors scale factor here since `WindowResolution.scale_factor` is
// not yet populated when windows are created during plugin setup.
let scale_factor = monitor.scale_factor();
let scale_factor = match resolution.scale_factor_override() {
Some(scale_factor_override) => scale_factor_override as f64,
// We use the monitors scale factor here since `WindowResolution.scale_factor` is
// not yet populated when windows are created during plugin setup.
None => monitor.scale_factor(),
};

// Logical to physical window size
let (width, height): (u32, u32) =
Expand Down