-
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
Introduce UiStack
#4588
Introduce UiStack
#4588
Conversation
benchmark for
|
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.
Looks good!
crates/egui/src/ui_stack.rs
Outdated
type Item = Arc<UiStack>; | ||
|
||
fn next(&mut self) -> Option<Self::Item> { | ||
let current = self.next.clone(); |
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.
If you use references (and lifetimes) we can avoid this .clone()
. I think this is likely to be on the hot path of quite a few layout thing in the future.
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
# Conflicts: # crates/egui/src/containers/window.rs
### What - Fixes #6246 - Very tiny bit of #4569 This PR uses emilk/egui#4588 to replace the `full_span` mechanism, which requires less boilerplate and makes it available in many more places (including tooltips). The `get_full_span()` function now lives in a `Ui` extension trait, where the rest of `re_ui` should eventually migrate (#4569). This PR also updates egui/egui_tiles/egui_commonmark to the latest commits. ### 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 examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/6491?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/6491?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 * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! - [PR Build Summary](https://build.rerun.io/pr/6491) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`.
* Closes emilk#4534 This PR: - Introduces `Ui::stack()`, which returns the `UiStack` structure providing information on the current `Ui` hierarchy. - **BREAKING**: `Ui::new()` now takes a `UiStackInfo` argument, which is used to populate some of this `Ui`'s `UiStack`'s fields. - **BREAKING**: `Ui::child_ui()` and `Ui::child_ui_with_id_source()` now take an `Option<UiStackInfo>` argument, which is used to populate some of the children `Ui`'s `UiStack`'s fields. - New `Area::kind()` builder function, to set the `UiStackKind` value of the `Area`'s `Ui`. - Adds a (minimalistic) demo to egui demo (in the "Misc Demos" window). - Adds a more thorough `test_ui_stack` test/playground demo. TODO: - [x] benchmarks - [x] add example to demo Future work: - Add `UiStackKind` and related support for more container (e.g. `CollapsingHeader`, etc.) - Add a tag/property system that would allow adding arbitrary data to a stack node. This data could then be queried by nested `Ui`s. Probably needed for emilk#3284. - Add support to track columnar layouts. --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This PR:
Ui::stack()
, which returns theUiStack
structure providing information on the currentUi
hierarchy.Ui::new()
now takes aUiStackInfo
argument, which is used to populate some of thisUi
'sUiStack
's fields.Ui::child_ui()
andUi::child_ui_with_id_source()
now take anOption<UiStackInfo>
argument, which is used to populate some of the childrenUi
'sUiStack
's fields.Area::kind()
builder function, to set theUiStackKind
value of theArea
'sUi
.test_ui_stack
test/playground demo.TODO:
Future work:
UiStackKind
and related support for more container (e.g.CollapsingHeader
, etc.)Ui
s. Probably needed for CSS-like styling #3284.