Skip to content

Commit

Permalink
Add Memory::any_popup_open() (#2464)
Browse files Browse the repository at this point in the history
* Added the "any_popup_open()" function

* Updated CHANGELOG.md

* add PR link to changelog

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
  • Loading branch information
francesco-cattoglio and emilk authored Dec 19, 2022
1 parent 6554fbb commit 2c9b130
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG
### Added ⭐
* `Event::Key` now has a `repeat` field that is set to `true` if the event was the result of a key-repeat ([#2435](https://github.com/emilk/egui/pull/2435)).
* Add `Slider::drag_value_speed`, which lets you ask for finer precision when dragging the slider value rather than the actual slider.
* Add `Memory::any_popup_open`, which returns true if any popup is currently open ([#2464](https://github.com/emilk/egui/pull/2464)).

### Fixed 🐛
* Expose `TextEdit`'s multiline flag to AccessKit ([#2448](https://github.com/emilk/egui/pull/2448)).
Expand Down
4 changes: 4 additions & 0 deletions crates/egui/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,10 @@ impl Memory {
self.popup == Some(popup_id) || self.everything_is_visible()
}

pub fn any_popup_open(&self) -> bool {
self.popup.is_some() || self.everything_is_visible()
}

pub fn open_popup(&mut self, popup_id: Id) {
self.popup = Some(popup_id);
}
Expand Down

0 comments on commit 2c9b130

Please sign in to comment.