Skip to content

Commit

Permalink
Fix eframe centering on multiple monitor systems (#4919)
Browse files Browse the repository at this point in the history
On multiple-monitor systems, eframe was incorrectly selecting first ones
dimensions for centering

Would also appretiate releasing 0.28.2 with fix included on crates.io
  • Loading branch information
VinTarZ authored Aug 26, 2024
1 parent 0513c05 commit 9f2f5f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/eframe/src/native/epi_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ pub fn viewport_builder(
#[cfg(not(target_os = "ios"))]
if native_options.centered {
crate::profile_scope!("center");
if let Some(monitor) = event_loop.available_monitors().next() {
if let Some(monitor) = event_loop
.primary_monitor()
.or_else(|| event_loop.available_monitors().next())
{
let monitor_size = monitor
.size()
.to_logical::<f32>(egui_zoom_factor as f64 * monitor.scale_factor());
Expand Down

0 comments on commit 9f2f5f7

Please sign in to comment.