emilk / egui

egui: an easy-to-use immediate mode GUI in Rust that runs on both web and native
https://www.egui.rs/
Apache License 2.0
22.14k stars 1.59k forks source link

Scale breaks when moving egui to a monitor with different dpi #5246

Open lucasmerlin opened 1 week ago

lucasmerlin commented 1 week ago

Describe the bug I have a monitor with a scale of 1.0 and one with 2.0. When moving a egui window (e.g. https://egui.rs) from the 1.0 screen to the 2.0 screen egui will be shown with twice the scale it should have. If you then reload it will be shown at the correct scale. Moving egui from the 2.0 screen to the 1.0 screen will cause egui to be shown at half of the expected scale. The mouse events don't seem to be scaled and don't match the visual output.

https://github.com/user-attachments/assets/15b9ba1a-1447-4cb6-8381-ff6637727c63

To Reproduce Steps to reproduce the behavior:

Desktop (please complete the following information):

This only happens in the browser, when running natively this doesn't happen.

Maybe related to https://github.com/emilk/egui/issues/4960?

rustbasic commented 1 week ago

Note : Seems to work fine on Windows10 + Chrome + (Monitor 1.25 & 2.0) ( Could it be depends on the OS? )