mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Make non interactable layers not interact (#1240)
* Make non interactable layers not interact * Make menus interactable * Fix area interactable not being updated each frame
This commit is contained in:
@@ -204,7 +204,7 @@ impl Area {
|
||||
let state = ctx.memory().areas.get(id).cloned();
|
||||
let is_new = state.is_none();
|
||||
if is_new {
|
||||
ctx.request_repaint(); // if we don't know the previous size we are likely drawing the area in the wrong place}
|
||||
ctx.request_repaint(); // if we don't know the previous size we are likely drawing the area in the wrong place
|
||||
}
|
||||
let mut state = state.unwrap_or_else(|| State {
|
||||
pos: default_pos.unwrap_or_else(|| automatic_area_position(ctx)),
|
||||
@@ -212,6 +212,7 @@ impl Area {
|
||||
interactable,
|
||||
});
|
||||
state.pos = new_pos.unwrap_or(state.pos);
|
||||
state.interactable = interactable;
|
||||
|
||||
if let Some((anchor, offset)) = anchor {
|
||||
if is_new {
|
||||
|
||||
@@ -516,9 +516,9 @@ impl Areas {
|
||||
if state.interactable {
|
||||
// Allow us to resize by dragging just outside the window:
|
||||
rect = rect.expand(resize_interact_radius_side);
|
||||
}
|
||||
if rect.contains(pos) {
|
||||
return Some(*layer);
|
||||
if rect.contains(pos) {
|
||||
return Some(*layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ pub(crate) fn menu_ui<'c, R>(
|
||||
let area = Area::new(menu_id)
|
||||
.order(Order::Foreground)
|
||||
.fixed_pos(pos)
|
||||
.interactable(false)
|
||||
.interactable(true)
|
||||
.drag_bounds(Rect::EVERYTHING);
|
||||
let inner_response = area.show(ctx, |ui| {
|
||||
ui.scope(|ui| {
|
||||
|
||||
Reference in New Issue
Block a user