egui icon indicating copy to clipboard operation
egui copied to clipboard

Scale breaks when moving egui to a monitor with different dpi

Open lucasmerlin opened this issue 1 year ago • 1 comments

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?

lucasmerlin avatar Oct 11 '24 11:10 lucasmerlin

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

rustbasic avatar Oct 11 '24 14:10 rustbasic

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")

emilk avatar Jan 22 '25 15:01 emilk