Don't close colopicker and other popups when clicking inside of them
This commit is contained in:
parent
6fbb59de1f
commit
def09c2455
2 changed files with 15 additions and 6 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -21,13 +21,14 @@ NOTE: `eframe`, `egui_web` and `egui_glium` has their own changelogs!
|
|||
* Add `Slider::new` and `DragValue::new` to replace old type-specific constructors.
|
||||
|
||||
### Changed 🔧
|
||||
* `kb_focus` is now just called `focus`
|
||||
* `kb_focus` is now just called `focus`.
|
||||
|
||||
### Fixed 🐛
|
||||
* Fix some bugs related to centered layouts
|
||||
* Fixed secondary-click to open a menu
|
||||
* [Fix panic for zero-range sliders and zero-speed drag values](https://github.com/emilk/egui/pull/216)
|
||||
* Fix false id clash error for wrapping text
|
||||
* Fix some bugs related to centered layouts.
|
||||
* Fixed secondary-click to open a menu.
|
||||
* [Fix panic for zero-range sliders and zero-speed drag values](https://github.com/emilk/egui/pull/216).
|
||||
* Fix false id clash error for wrapping text.
|
||||
* Fix bug that would close a popup (e.g. the color picker) when clicking inside of it.
|
||||
|
||||
### Deprecated ☢️
|
||||
* Deprectated `combo_box_with_label` in favor of new `ComboBox`.
|
||||
|
|
|
@ -135,7 +135,15 @@ impl Response {
|
|||
|
||||
/// `true` if there was a click *outside* this widget this frame.
|
||||
pub fn clicked_elsewhere(&self) -> bool {
|
||||
!self.clicked() && self.ctx.input().pointer.any_click()
|
||||
// We do not use self.clicked(), because we want to catch all click within our frame,
|
||||
// even if we aren't clickable. This is important for windows and such that should close
|
||||
// then the user clicks elsewhere.
|
||||
let pointer = &self.ctx.input().pointer;
|
||||
if let Some(pos) = pointer.latest_pos() {
|
||||
pointer.any_click() && !self.rect.contains(pos)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Was the widget enabled?
|
||||
|
|
Loading…
Reference in a new issue