mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Fix sometimes not being able to click inside a combo box or popup menu
This commit is contained in:
@@ -168,7 +168,7 @@ impl Area {
|
||||
pub(crate) struct Prepared {
|
||||
layer_id: LayerId,
|
||||
state: State,
|
||||
movable: bool,
|
||||
pub(crate) movable: bool,
|
||||
enabled: bool,
|
||||
drag_bounds: Option<Rect>,
|
||||
}
|
||||
@@ -337,10 +337,13 @@ impl Prepared {
|
||||
state.pos += ctx.input().pointer.delta();
|
||||
}
|
||||
|
||||
if let Some(bounds) = drag_bounds {
|
||||
state.pos = ctx.constrain_window_rect_to_area(state.rect(), bounds).min;
|
||||
} else {
|
||||
state.pos = ctx.constrain_window_rect(state.rect()).min;
|
||||
// Important check - don't try to move e.g. a combobox popup!
|
||||
if movable {
|
||||
if let Some(bounds) = drag_bounds {
|
||||
state.pos = ctx.constrain_window_rect_to_area(state.rect(), bounds).min;
|
||||
} else {
|
||||
state.pos = ctx.constrain_window_rect(state.rect()).min;
|
||||
}
|
||||
}
|
||||
|
||||
if (move_response.dragged() || move_response.clicked())
|
||||
|
||||
@@ -404,6 +404,8 @@ impl<'open> Window<'open> {
|
||||
}
|
||||
content_inner
|
||||
};
|
||||
|
||||
area.movable = possible.movable; // Tell it the truth
|
||||
let full_response = area.end(ctx, area_content_ui);
|
||||
|
||||
let inner_response = InnerResponse {
|
||||
|
||||
Reference in New Issue
Block a user