Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Fixes #9564
Add
PositionType::Fixed
to help with the creation of popups."Fixed" nodes will be positioned relative to the windows and ignore every nodes in the graph.
Solution
When converting from
bevy_ui::ui_node::PositionType::Fixed
totaffy::style::Position
theAbsolute
variant is used as their behavior is very similar (c.f.: MDN).When the
bevy_ui::layout::ui_layout_system
system is ran, it keeps a set off allfixed_nodes
to be used byupdate_uinode_geometry_recursive
, subtracting a node's parent position from it's absolute position.Changelog
bevy_ui::ui_node::PositionType::Fixed
Notes
For now,
PositionType::Fixed
is relative to the windows but calculation of properties such as size or width are still done relative to the parent. Thus, not mimicking CSS's way off handling fixed objects, this can be counteracted by usingVal::vh(...)
.Some tests may be necessary, but I would like some feedback first on what exact effects of
position: fixed
we want to mimic.