Skip to content

Commit

Permalink
Fix window centering when scale_factor is not 1.0 (#5582)
Browse files Browse the repository at this point in the history
# Objective

Fixes #5581

## Solution

`Window::scale_factor` already has logic for selecting the overridden or actual scale factor, so use it.

I tested this with the displays I have access to, but more testing would be nice. This seems like a pretty straightforward bug/fix though.

## Changelog

### Fixed

Fixed window centering on high-dpi displays.
  • Loading branch information
rparrett committed Aug 30, 2022
1 parent 65252bb commit e874b91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/bevy_winit/src/winit_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl WinitWindows {
if let Some(monitor) = maybe_monitor {
let screen_size = monitor.size();

let scale_factor = scale_factor_override.unwrap_or(1.0);
let scale_factor = monitor.scale_factor();

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

0 comments on commit e874b91

Please sign in to comment.