mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Add move_to_top and top_most_layer (#1242)
This commit is contained in:
@@ -889,6 +889,17 @@ impl Context {
|
||||
self.memory().layer_id_at(pos, resize_grab_radius_side)
|
||||
}
|
||||
|
||||
/// The overall top-most layer. When an area is clicked on or interacted
|
||||
/// with, it is moved above all other areas.
|
||||
pub fn top_most_layer(&self) -> Option<LayerId> {
|
||||
self.memory().top_most_layer()
|
||||
}
|
||||
|
||||
/// Moves the given area to the top.
|
||||
pub fn move_to_top(&self, layer_id: LayerId) {
|
||||
self.memory().areas.move_to_top(layer_id);
|
||||
}
|
||||
|
||||
pub(crate) fn rect_contains_pointer(&self, layer_id: LayerId, rect: Rect) -> bool {
|
||||
let pointer_pos = self.input().pointer.interact_pos();
|
||||
if let Some(pointer_pos) = pointer_pos {
|
||||
|
||||
@@ -329,6 +329,12 @@ impl Memory {
|
||||
self.areas.layer_id_at(pos, resize_interact_radius_side)
|
||||
}
|
||||
|
||||
/// The overall top-most layer. When an area is clicked on or interacted
|
||||
/// with, it is moved above all other areas.
|
||||
pub fn top_most_layer(&self) -> Option<LayerId> {
|
||||
self.areas.order().last().copied()
|
||||
}
|
||||
|
||||
pub(crate) fn had_focus_last_frame(&self, id: Id) -> bool {
|
||||
self.interaction.focus.id_previous_frame == Some(id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user