-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for modal windows to re_ui
and use it for the Space View entity picker
#4577
Conversation
Include a `ModelHandler` helper object.
Rebase fix to using modal in entity picker
5000f73
to
3e8a3ad
Compare
Looks whatever prevented pinning the dialog to the middle got fixed \o/ - plz have a look at d9bef9d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful!
This is still not working for me, ie. it centres the top-left corner instead of the center of the window as specified by the Edit: I've been it by emilk/egui#3721 |
What
Since egui doesn't have support for modal windows yet (emilk/egui#686), we rolled our own for the Space View entity picker ("Add/remove entities"). This PR abstracts the modal creation code into a dedicated feature in
re_ui
, and use that abstraction for the space view entity picker.The new
re_ui::modal
has support for two aspects of modal window management:re_ui::modal::Modal
), which handles dimming the background, a close button, and exiting with ESC and/or clicking outside of the window.re_ui::modal::ModalHandler
). TheModal
struct should be kept only while the modal is actually shown, so it's typically held in andOption<Modal>
.ModalHandler
implements the house keeping of populating theOption
when the modal must be displayed, and dropping it when the modal is closed.Note: with this PR, the modals are now properly centred, although erroneous centring behaviour might happen that require deleting your
app.ron
. This will eventually be fixed with a new egui release that includes emilk/egui#3721Usage:
Checklist
main
build: app.rerun.ionightly
build: app.rerun.io