1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

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
This commit is contained in:
VinTarZ
2024-08-26 16:36:30 +03:00
committed by GitHub
parent 0513c05768
commit 9f2f5f7292

View File

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