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
20.61k stars 1.49k forks source link

Fix: Menu popups and tooltips don't respect layer transforms #4708

Closed Creative0708 closed 3 days ago

Creative0708 commented 3 days ago

The menu buttons, combo box menus, and tooltips don't take layer transforms into account when placing their popups, resulting in popups being placed in the wrong location.

This PR makes the popups take layer transforms into account, transforming the positions before displaying them on screen. I implemented this fix for menu buttons, combo boxes, and tooltips; let me know if there's anything I missed. Scaling of the popups is purposefully ignored for now. Personally, I think popup scaling isn't necessary but if it is required I can implement it (also it would require doing more invasive things to the code and I want to keep this as simple as possible.)

Before the fix: (with a modified version of the "Pan Zoom" web demo)