bevy/crates
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
..
bevy_a11y Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_animation Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_app Fix the clippy::explicit_iter_loop lint (#9834) 2023-09-19 03:35:22 +00:00
bevy_asset Fix the clippy::explicit_iter_loop lint (#9834) 2023-09-19 03:35:22 +00:00
bevy_audio Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_core Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_core_pipeline Improve doc formatting. (#9840) 2023-09-18 19:43:56 +00:00
bevy_derive bevy_derive: Fix #[deref] breaking other attributes (#9551) 2023-08-28 17:36:18 +00:00
bevy_diagnostic Improve doc formatting. (#9840) 2023-09-18 19:43:56 +00:00
bevy_dylib Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_dynamic_plugin Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_ecs Fix the clippy::explicit_iter_loop lint (#9834) 2023-09-19 03:35:22 +00:00
bevy_ecs_compile_fail_tests Fix CI for Rust 1.72 (#9562) 2023-08-25 12:34:24 +00:00
bevy_encase_derive Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_gilrs Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00
bevy_gizmos Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_gltf invert face culling for negatively scaled gltf nodes (#8859) 2023-09-18 15:55:24 +00:00
bevy_hierarchy Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
bevy_input Improve doc formatting. (#9840) 2023-09-18 19:43:56 +00:00
bevy_internal "serialize" feature no longer enables the optional "bevy_scene" feature if it's not enabled from elsewhere (#9803) 2023-09-14 21:15:00 +00:00
bevy_log Update tracy-client requirement from 0.15 to 0.16 (#9436) 2023-08-15 07:45:21 +00:00
bevy_macro_utils Add some more helpful errors to BevyManifest when it doesn't find Cargo.toml (#9207) 2023-07-19 12:05:04 +00:00
bevy_macros_compile_fail_tests bevy_derive: Fix #[deref] breaking other attributes (#9551) 2023-08-28 17:36:18 +00:00
bevy_math Fix erronenous glam version (#9653) 2023-08-31 12:55:17 +00:00
bevy_mikktspace Fix erronenous glam version (#9653) 2023-08-31 12:55:17 +00:00
bevy_pbr Fix the clippy::explicit_iter_loop lint (#9834) 2023-09-19 03:35:22 +00:00
bevy_ptr Put #[repr(transparent)] attr to bevy_ptr types (#9068) 2023-07-14 18:55:15 +00:00
bevy_reflect Fix the clippy::explicit_iter_loop lint (#9834) 2023-09-19 03:35:22 +00:00
bevy_reflect_compile_fail_tests Fix CI for Rust 1.72 (#9562) 2023-08-25 12:34:24 +00:00
bevy_render renderer init: create a detached task only on wasm, block otherwise (#9830) 2023-09-19 05:57:54 +00:00
bevy_scene Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
bevy_sprite Fix the clippy::explicit_iter_loop lint (#9834) 2023-09-19 03:35:22 +00:00
bevy_tasks Improve doc formatting. (#9840) 2023-09-18 19:43:56 +00:00
bevy_text Remove z-axis scaling in extract_text2d_sprite (#9733) 2023-09-11 19:12:23 +00:00
bevy_time Improve doc formatting. (#9840) 2023-09-18 19:43:56 +00:00
bevy_transform Rename RemovedComponents::iter/iter_with_id to read/read_with_id (#9778) 2023-09-15 12:37:20 +00:00
bevy_ui Have a separate implicit viewport node per root node + make viewport node Display::Grid (#9637) 2023-09-19 15:14:46 +00:00
bevy_utils Improve doc formatting. (#9840) 2023-09-18 19:43:56 +00:00
bevy_window Refer to "macOS", not "macOS X". (#9704) 2023-09-05 19:06:08 +00:00
bevy_winit Fix the clippy::explicit_iter_loop lint (#9834) 2023-09-19 03:35:22 +00:00