egui
egui copied to clipboard
Pan Zoom demo widgets are layered incorrectly
Describe the bug
Desktop (please complete the following information):
- OS: Windows 11, Fedora 39
- Browser: Firefox
maybe related. The pan zoom items can be interacted with, even outside of their window. (tested on https://egui.rs)
https://github.com/emilk/egui/assets/17766093/22a70021-cfc4-4e88-b2cc-928f77c6cdd3
closing #4448 in favor of this, thank @YgorSouza
This bug seems to be a side effect of a workaround to get the pan zoom widgets to display above the window itself.
https://github.com/emilk/egui/blob/2c00cb39912e1043e883bacfeaec5806b51b7841/crates/egui_demo_lib/src/demo/pan_zoom.rs#L113-L132
The areas that hold the widgets are given a layer order of Order::Foreground, which displays above everything that is Order::Middle, Order::Background, etc. The demo windows are Order::Middle, so they render behind the widgets. The comments in the code snippet mention this.
If the widgets were given Order::Middle instead, moving the pan zoom window to the front (such as by clicking) would bring the widgets behind the pan zoom window:
https://github.com/emilk/egui/assets/104604363/dd1c183b-995d-4e75-b06e-c0ff3f9b0ad5
I'm not sure how this would be fixed without support for, say, parent/child layers. Possible feature request maybe?
Actually, I just noticed this was already discussed in the PR that implemented the demo: https://github.com/emilk/egui/pull/3906#issuecomment-1949899356.