1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Add PopupCloseBehavior (#4636)

This PR adds `PopupCloseBehavior` to improve state of the
<https://github.com/emilk/egui/issues/4607>

`PopupCloseBehavior` determines when popup will be closed.
- `CloseOnClick` popup will be closed if the click happens anywhere even
in the popup's body
- `CloseOnClickAway` popup will be closed if the click happens somewhere
else but in the popup's body.

It also adds a test in the demo app which contains several popups
examples.

---

My ideas about <https://github.com/emilk/egui/issues/4607> is to make
every tooltip and popup a menu. So it will provide more control over
popups and tooltips (you will be able to close a popup by calling
something similar to the `ui.close_menu` if you need to). You won't need
to manually handle it's opening. And also will allow to have multiple
popups opened. That means you can have a popup inside a popup. And it
will also lead to the easier creation of the popups. (should we create a
tracking issue to track changes because to me it seems like a huge
amount of changes to be done?)

---

- Improvements on <https://github.com/emilk/egui/issues/4607>
This commit is contained in:
Umatriz
2024-06-27 10:42:57 +03:00
committed by GitHub
parent ab861574f4
commit 5051e945e4
6 changed files with 122 additions and 6 deletions

View File

@@ -2883,6 +2883,14 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2"
[[package]]
name = "popups"
version = "0.27.2"
dependencies = [
"eframe",
"env_logger",
]
[[package]]
name = "powerfmt"
version = "0.2.0"