Scale breaks when moving egui to a monitor with different dpi
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:
- go to https://egui.rs
- move the browser window to a monitor with a different scale
Desktop (please complete the following information):
- OS: macOS
- Browser chrome
This only happens in the browser, when running natively this doesn't happen.
Maybe related to https://github.com/emilk/egui/issues/4960?
Note : Seems to work fine on Windows10 + Chrome + (Monitor 1.25 & 2.0) ( Could it be depends on the OS? )
The resize observer doesn't trigger on chromium when the Device Pixel Ratio (DPR) changes. Maybe we need to subscribe to some other event for that (e.g. "resize")