Skip to content

Commit fa7f3ed

Browse files
VinTarZ486c
authored andcommitted
Fix eframe centering on multiple monitor systems (emilk#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
1 parent 7b17663 commit fa7f3ed

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/eframe/src/native/epi_integration.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ pub fn viewport_builder(
6868
#[cfg(not(target_os = "ios"))]
6969
if native_options.centered {
7070
crate::profile_scope!("center");
71-
if let Some(monitor) = event_loop.available_monitors().next() {
71+
if let Some(monitor) = event_loop
72+
.primary_monitor()
73+
.or_else(|| event_loop.available_monitors().next())
74+
{
7275
let monitor_size = monitor
7376
.size()
7477
.to_logical::<f32>(egui_zoom_factor as f64 * monitor.scale_factor());

0 commit comments

Comments
 (0)