From 56913a9ae9e97dc2e9de7a7e6098b7620642cb17 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 28 Aug 2021 10:28:05 +0200 Subject: [PATCH] Fix sometimes not being able to click inside a combo box or popup menu --- CHANGELOG.md | 1 + egui/src/containers/area.rs | 13 ++++++++----- egui/src/containers/window.rs | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30d0151b..03cc3c9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ NOTE: [`eframe`](eframe/CHANGELOG.md), [`egui_web`](egui_web/CHANGELOG.md) and [ * Make minimum grid column width propagate properly. * Make sure `TextEdit` contents expand to fill width if applicable. * `ProgressBar`: add a minimum width and fix for having it in an infinite layout. +* Fix sometimes not being able to click inside a combo box or popup menu. ## 0.14.0 - 2021-08-24 - Ui panels and bug fixes diff --git a/egui/src/containers/area.rs b/egui/src/containers/area.rs index e6e3dcba..acd42873 100644 --- a/egui/src/containers/area.rs +++ b/egui/src/containers/area.rs @@ -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, } @@ -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()) diff --git a/egui/src/containers/window.rs b/egui/src/containers/window.rs index 32cef350..f1fedfeb 100644 --- a/egui/src/containers/window.rs +++ b/egui/src/containers/window.rs @@ -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 {