You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm drawing multiple windows which expand their contents on hover (screenshot). The problem is in setting which window is rendered on top.
I tried changing the order in which window.show(...) is called but it seems as long as they have the same IDs their z-order remains the same.
I also tried using ui.with_layer_id but this doesn't work for the windows themselves, as in
What I noticed happens is clicking on a window puts it in front of all other windows. I tried using ui.request_focus() but this also doesn't work.
The only solution I found digging into egui's source code is
let window = Window::new(...);
ctx.memory().areas.move_to_top(window.area.layer());
window.show(ctx, |ui| { ...});
but the problem is memory().areas and window.area are both private fields. I did this by just making them public with a crate override, but there probably is a reason for them being not directly accessible.
Describe the solution you'd like
Expose an API for Window that enables moving it to the front like areas.move_to_top() does.
Describe alternatives you've considered
I've considered simulating a click on the window, but couldn't find an easy way of doing this. It seems .move_to_top() is only called based on interaction events, but since in my case the UI actually responds to a click I would need to do something more complicated.
In my case clicking removes the item & window, so the only way to move it to the front is click & hold, move the mouse away, and release, which moves the window to the front without triggering click.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I'm drawing multiple windows which expand their contents on hover (screenshot). The problem is in setting which window is rendered on top.
I tried changing the order in which
window.show(...)
is called but it seems as long as they have the same IDs their z-order remains the same.I also tried using
ui.with_layer_id
but this doesn't work for the windows themselves, as inWhat I noticed happens is clicking on a window puts it in front of all other windows. I tried using
ui.request_focus()
but this also doesn't work.The only solution I found digging into egui's source code is
but the problem is
memory().areas
andwindow.area
are both private fields. I did this by just making them public with a crate override, but there probably is a reason for them being not directly accessible.Describe the solution you'd like
Expose an API for
Window
that enables moving it to the front likeareas.move_to_top()
does.Describe alternatives you've considered
I've considered simulating a click on the window, but couldn't find an easy way of doing this. It seems
.move_to_top()
is only called based on interaction events, but since in my case the UI actually responds to a click I would need to do something more complicated.In my case clicking removes the item & window, so the only way to move it to the front is click & hold, move the mouse away, and release, which moves the window to the front without triggering click.
The text was updated successfully, but these errors were encountered: