bevy
bevy copied to clipboard
UI Display and Visibility Example
Objective
An example demonstrating how Display and Visibility work in Bevy UI.
fixes #5380 related #5368

Changelog
- Added the example
flex_display.rs.
You added a new example but didn't add metadata for it. Please update the root Cargo.toml file.
With all of the nodes arranged in a hierarchy as they are, aren't Display::None and Visibility::Hidden behaving pretty identically here?
Would it be more interesting to show the clickable nodes in a single parent flex container?
With all of the nodes arranged in a hierarchy as they are, aren't
Display::NoneandVisibility::Hiddenbehaving pretty identically here?Would it be more interesting to show the clickable nodes in a single parent flex container?
I'm not quite sure what you mean, the behaviour is quite different isn't it? Display::None hides the node and all its descendants, while Visibility::Hidden hides itself and only its children that are Visibility::Inherited.
I'm not quite sure what you mean, the behaviour is quite different isn't it? Display::None hides the node and all its descendants, while Visibility::Hidden hides itself and only its children that are Visibility::Inherited.
That's fair.
When I think of the difference between Display::None and Visibility::Hidden though, the first thing that comes to mind is that Visibility::Hidden doesn't affect layout, but Display::None does.
Although I'm not sure how to demonstrate both properties simultaneously.
"2" is Visibility::Hidden
+-----------+
|+-+ +-+|
||1| |3||
|+-+ +-+|
+-----------+
"2" is Display::None
+-----------+
|+-+ +-+ |
||1| |3| |
|+-+ +-+ |
+-----------+
Oh I get it, you are right. It needs to demonstrate how Display::None collapses the layout too, yes.
Should be able to do something like that with the inner nodes too somehow.
Oh I know I can stuff each node with a second invisible panel.
That's much better.
It seems like a bit of a problem that the buttons move out from under the cursor while you're cycling through Display options. Maybe move the controls to the left, or otherwise add a fixed size container node on the left side?
But I wonder if three panels
- controls
- nested hierarchy display
- flat hierarchy display (vertical)
Would more clearly show what's going on (and would also solve that problem)
Yes fixed it just now so the panels no longer move.
@ickshonpe can you fix the conflicts and make a call on the nits? I think they're an improvement, but I won't block on them.
@ickshonpe can you fix the conflicts and make a call on the nits? I think they're an improvement, but I won't block on them.
Yep I'll take a look
You added a new example but didn't update the readme. Please run cargo run -p build-templated-pages -- update examples to update it, and commit the file change.
You added a new example but didn't update the readme. Please run cargo run -p build-templated-pages -- update examples to update it, and commit the file change.
You added a new example but didn't update the readme. Please run cargo run -p build-templated-pages -- update examples to update it, and commit the file change.
You added a new example but didn't update the readme. Please run cargo run -p build-templated-pages -- update examples to update it, and commit the file change.
You added a new example but didn't update the readme. Please run cargo run -p build-templated-pages -- update examples to update it, and commit the file change.
Everything resolved, should be ready as long as its passes CI checks.