-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting a layer as a sublayer of another #4690
Conversation
When the layers are reordered at the end of the frame, the sublayers are placed directly above their respective parents. This allows having Areas inside Windows, e.g., for the pan-zoom container.
This prevents the inner areas from being layered on top of other Windows that are above the Pan Zoom demo window.
I don't know if this is the best API, but it is relatively simple and seems to solve the problem of the pan zoom demo being layered above everything. Screencast.from.2024-06-23.09-41-36.mp4It does not solve the other problem mentioned in #4128 (comment). |
/// | ||
/// This currently only supports one level of nesting. If `parent` is a sublayer of another | ||
/// layer, the behavior is unspecified. | ||
pub fn set_sublayer(&self, parent: LayerId, child: LayerId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could be called something like set_parent_window
to be clearer? Technically the parent doesn't have to be a Window, but that is the intended use case, and a more complicated hierarchy would not work well with the current reordering algorithm. I'm not really sure what to call it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the current name, but we should document that this is a sticky setting, and therefor there should also be some way to clear it. Or we make it an immediate-mode function instead and clear it at the end of each frame
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually meant for it to be immediate, like the wants_to_be_on_top set. I'm going to fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this direction!
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Thanks! |
When the layers are reordered at the end of the frame, the sublayers are placed directly above their respective parents. This allows having Areas inside Windows, e.g., for the pan-zoom container. * Closes <emilk#4128> --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
When the layers are reordered at the end of the frame, the sublayers are
placed directly above their respective parents. This allows having Areas
inside Windows, e.g., for the pan-zoom container.