Browse Source

Fix eframe centering on multiple monitor systems (#4919)

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
pull/4835/merge
VinTarZ 2 months ago
committed by GitHub
parent
commit
9f2f5f7292
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      crates/eframe/src/native/epi_integration.rs

5
crates/eframe/src/native/epi_integration.rs

@ -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());

Loading…
Cancel
Save