Skip to content
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

Modal dialogs #686

Open
sourcebox opened this issue Aug 31, 2021 · 6 comments · May be fixed by #839
Open

Modal dialogs #686

sourcebox opened this issue Aug 31, 2021 · 6 comments · May be fixed by #839
Labels
design Some architectual design work needed feature New feature or request rerun Desired for Rerun.io

Comments

@sourcebox
Copy link

I had a look into the various areas of the demo and could not find anything. Is it already possible to use modal dialogs, e.g. for errors, user confirmation or an "about box" with credits?

@Muqito
Copy link

Muqito commented Sep 4, 2021

There's nothing really special about modals.

Just boxes drawn on top of other elements that has focus.

See the demo app:

https://emilk.github.io/egui/index.html

So you can draw the modal if a certain condition is met.

Then you can add buttons to it that closes the modal or triggers a HTTP request and then closes the modal or requests additional information from the user for example.

modals

@sourcebox
Copy link
Author

Hmm... The settings window in the demo is not modal, it loses focus when you click another window.

@emilk
Copy link
Owner

emilk commented Sep 9, 2021

There is no modal windows in egui at the moment, but I suspect adding support for it would be pretty easy (just ignore interactions with the non-modal Area).

I wonder if one should also darken the background when showing a modal window?

@sourcebox
Copy link
Author

I wonder if one should also darken the background when showing a modal window?

Something like that would be nice, so the user can easily recognize that his attention is required.

@emilk emilk added the feature New feature or request label Sep 28, 2021
@Dinopaterno22
Copy link

Definitely something that I'd be interested in having, as my current "project" would need to implement a sort of dialog boxes for data introduction! Thanks for hearing @sourcebox out, @emilk :)

@plasticartsshow
Copy link

I would like to open a PR that might solve this. Can I?

@plasticartsshow plasticartsshow linked a pull request Oct 25, 2021 that will close this issue
5 tasks
@emilk emilk added the design Some architectual design work needed label Jan 3, 2022
@emilk emilk added the rerun Desired for Rerun.io label Nov 14, 2023
abey79 added a commit to rerun-io/rerun that referenced this issue Dec 19, 2023
…w entity picker (#4577)

### 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:
- The modal window itself (`re_ui::modal::Modal`), which handles dimming
the background, a close button, and exiting with ESC and/or clicking
outside of the window.
- The handling of the modal window (`re_ui::modal::ModalHandler`). The
`Modal` struct should be kept only while the modal is actually shown, so
it's typically held in and `Option<Modal>`. `ModalHandler` implements
the house keeping of populating the `Option` 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#3721

Usage:

<img width="583" alt="image"
src="https://github.com/rerun-io/rerun/assets/49431240/a079def4-f11a-4eeb-a3ec-6c777d078bdd">


<img width="443" alt="image"
src="https://github.com/rerun-io/rerun/assets/49431240/13114dd4-3051-486c-9e4a-df4c783a0780">



### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/4577/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/4577/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/4577/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4577)
- [Docs
preview](https://rerun.io/preview/fb5add0047f108769c413393d65d52e362cbcc8e/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/fb5add0047f108769c413393d65d52e362cbcc8e/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
@emilk emilk mentioned this issue Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Some architectual design work needed feature New feature or request rerun Desired for Rerun.io
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants