bevy/examples/window
Nico Burns b995827013
Have a separate implicit viewport node per root node + make viewport node Display::Grid (#9637)
# Objective

Make `bevy_ui` "root" nodes more intuitive to use/style by:
- Removing the implicit flexbox styling (such as stretch alignment) that
is applied to them, and replacing it with more intuitive CSS Grid
styling (notably with stretch alignment disabled in both axes).
- Making root nodes layout independently of each other. Instead of there
being a single implicit "viewport" node that all root nodes are children
of, there is now an implicit "viewport" node *per root node*. And layout
of each tree is computed separately.

## Solution

- Remove the global implicit viewport node, and instead create an
implicit viewport node for each user-specified root node.
- Keep track of both the user-specified root nodes and the implicit
viewport nodes in a separate `Vec`.
- Use the window's size as the `available_space` parameter to
`Taffy.compute_layout` rather than setting it on the implicit viewport
node (and set the viewport to `height: 100%; width: 100%` to make this
"just work").

---

## Changelog

- Bevy UI now lays out root nodes independently of each other in
separate layout contexts.
- The implicit viewport node (which contains each user-specified root
node) is now `Display::Grid` with `align_items` and `justify_items` both
set to `Start`.

## Migration Guide

- Bevy UI now lays out root nodes independently of each other in
separate layout contexts. If you were relying on your root nodes being
able to affect each other's layouts, then you may need to wrap them in a
single root node.
- The implicit viewport node (which contains each user-specified root
node) is now `Display::Grid` with `align_items` and `justify_items` both
set to `Start`. You may need to add `height: Val::Percent(100.)` to your
root nodes if you were previously relying on being implicitly set.
2023-09-19 15:14:46 +00:00
..
clear_color.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
low_power.rs Improve bevy_winit documentation (#7609) 2023-07-31 21:41:59 +00:00
multiple_windows.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
scale_factor_override.rs Have a separate implicit viewport node per root node + make viewport node Display::Grid (#9637) 2023-09-19 15:14:46 +00:00
screenshot.rs Screenshots in wasm (#8455) 2023-04-28 19:37:11 +00:00
transparent_window.rs Fix doc link in transparent_window example (#9697) 2023-09-05 05:43:26 +00:00
window_resizing.rs Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00
window_settings.rs Wait before making window visible (#9692) 2023-09-11 19:09:55 +00:00