You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What problem does this solve or what need does it fill?
UI elements such as dialog boxes and popup menus need to be positioned in window coordinates. One way to do this is to create them as parentless elements, however there are downsides to this approach: it means, for example, that messages that are bubbled up the ancestor chain no longer reach their intended destinations.
Consider for example a menu button widget with a dropdown menu. We don't want the dropdown to be cut off if it's too tall, so we need to clip its size to the window size, and possibly "flip" it to the other side of the button if there is insufficient space. However, we also want the dropdown to behave like a child:
The dropdown is despawned when the button is.
Messages emitted by children of the dropdown can be received by the parent.
In CSS, this can be done in a variety of ways, one of which is position: fixed, which is an alternative to position: absolute or position: relative. It indicates that the element should be positioned relative to the window rect rather than to its parent element rect, and in all other respects behaviors like position: absolute.
What solution would you like?
A Position::Fixed would behave similarly to the CSS position: fixed, in that it would always compute the parent rectangle using the window bounds - in other words, it would treat the element like it had no parent. In all other respects it would behave like Absolute positioning.
What alternative(s) have you considered?
There are workarounds, including:
Implement this function in Bevy by lying to Taffy about the parent rectangle.
Use parentless elements with some other means of tracking ownership (doesn't solve the messaging issue).
What problem does this solve or what need does it fill?
UI elements such as dialog boxes and popup menus need to be positioned in window coordinates. One way to do this is to create them as parentless elements, however there are downsides to this approach: it means, for example, that messages that are bubbled up the ancestor chain no longer reach their intended destinations.
Consider for example a menu button widget with a dropdown menu. We don't want the dropdown to be cut off if it's too tall, so we need to clip its size to the window size, and possibly "flip" it to the other side of the button if there is insufficient space. However, we also want the dropdown to behave like a child:
In CSS, this can be done in a variety of ways, one of which is
position: fixed
, which is an alternative toposition: absolute
orposition: relative
. It indicates that the element should be positioned relative to the window rect rather than to its parent element rect, and in all other respects behaviors likeposition: absolute
.What solution would you like?
A
Position::Fixed
would behave similarly to the CSSposition: fixed
, in that it would always compute the parent rectangle using the window bounds - in other words, it would treat the element like it had no parent. In all other respects it would behave likeAbsolute
positioning.What alternative(s) have you considered?
There are workarounds, including:
However, none of these solutions are as clean.
Additional context
Bevy issue for this: bevyengine/bevy#9564
The text was updated successfully, but these errors were encountered: