-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix Window
positioning bug when bad pivot
is stored in app data
#3721
Conversation
… pivot set from code
The fact that persisted app state can corrupt egui/crates/egui/src/containers/area.rs Lines 7 to 23 in 83f5d5c
|
…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 <[email protected]>
The comment is correct. The area state is not stored in |
…e window (#4700) ### What This avoids the modal moving vertically when content size changes. **NOTE**: this PR would trigger the bug fixed in emilk/egui#3721, so it needs an egui release before being released. This is avoided by salting the modals' ID such as to in invalidate existing caches. https://github.com/rerun-io/rerun/assets/49431240/d2d472b5-7af2-4e95-9da1-a671fc80629f ### 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/4700/index.html) * Using examples from latest `main` build: [app.rerun.io](https://app.rerun.io/pr/4700/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/4700/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/4700) - [Docs preview](https://rerun.io/preview/e159b005a7a1d5f44e608013f00c1d479b7c341c/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/e159b005a7a1d5f44e608013f00c1d479b7c341c/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
This PR fixes an issue where a bad pivot stored in app state would override the pivot actually set from code. The root code of this issue if the
Window
'sState
containingpivot
in the first place, aspivot
is not part of a state to be tracked. It makes theState
structure more ergonomic though, so this PR leaves thepivot
field but always overrides it with the value provided by user code.Repro of the original issue
This issue can be reproduced using the
re_ui_example
app from the Rerun repo, at this commit: rerun-io/rerun@fb5add0. By using thisapp.ron
file, the bug will appear:The modal is entered based on it's top-left corner even though the code actually specifies a center-center pivot:
With this PR, the centring is correct even with the "poisoned"
app.ron
: