egui icon indicating copy to clipboard operation
egui copied to clipboard

Pan Zoom demo widgets are layered incorrectly

Open YgorSouza opened this issue 1 year ago • 2 comments

Describe the bug

image

Desktop (please complete the following information):

  • OS: Windows 11, Fedora 39
  • Browser: Firefox

YgorSouza avatar Mar 03 '24 08:03 YgorSouza

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

ToppDev avatar Mar 16 '24 12:03 ToppDev

closing #4448 in favor of this, thank @YgorSouza

markusdd avatar May 03 '24 19:05 markusdd

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?

Creative0708 avatar Jun 21 '24 19:06 Creative0708

Actually, I just noticed this was already discussed in the PR that implemented the demo: https://github.com/emilk/egui/pull/3906#issuecomment-1949899356.

YgorSouza avatar Jun 22 '24 16:06 YgorSouza