bevy/crates/bevy_ui/src
ickshonpe eaac730617 Fix the Size helper functions using the wrong default value and improve the UI examples (#7626)
# Objective
`Size::width` sets the `height` field to `Val::DEFAULT` which is `Val::Undefined`, but the default for `Size` `height` is `Val::Auto`. 
`Size::height` has the same problem, but with the `width` field. 

The UI examples specify numeric values in many places where they could either be elided or replaced by composition of the Flex enum properties.

related: https://github.com/bevyengine/bevy/pull/7468
fixes: https://github.com/bevyengine/bevy/issues/6498

## Solution
Change `Size::width` so it sets `height` to `Val::AUTO` and change `Size::height` so it sets `width` to `Val::AUTO`.
Added some tests so this doesn't happen again.

## Changelog
Changed `Size::width` so it sets the `height` to `Val::AUTO`.
Changed `Size::height` so it sets the `width` to `Val::AUTO`.
Added tests to `geometry.rs` for `Size` and `UiRect` to ensure correct behaviour.
Simplified the UI examples. Replaced numeric values with the Flex property enums or elided them where possible, and removed the remaining use of auto margins.

## Migration Guide
The `Size::width` constructor function now sets the `height` to `Val::Auto` instead of `Val::Undefined`.
The `Size::height` constructor function now sets the `width` to `Val::Auto` instead of `Val::Undefined`.
2023-02-11 23:07:16 +00:00
..
flex Remove broken DoubleEndedIterator impls on event iterators (#7469) 2023-02-05 15:18:19 +00:00
render Refactor Globals and View structs into separate shaders (#7512) 2023-02-11 17:55:18 +00:00
widget Don't ignore UI scale for text (#7510) 2023-02-05 18:15:22 +00:00
camera_config.rs Extract component derive (#7399) 2023-01-30 18:12:16 +00:00
focus.rs expose cursor position with scale (#7297) 2023-01-20 14:25:24 +00:00
geometry.rs Fix the Size helper functions using the wrong default value and improve the UI examples (#7626) 2023-02-11 23:07:16 +00:00
lib.rs Fix Window feedback loop between the OS and Bevy (#7517) 2023-02-07 14:18:13 +00:00
node_bundles.rs Change default FocusPolicy to Pass (#7161) 2023-01-12 17:15:20 +00:00
stack.rs Rename schedule v3 to schedule (#7519) 2023-02-06 18:44:40 +00:00
ui_node.rs Document how Style's size constraints interact (#7613) 2023-02-10 23:50:28 +00:00
update.rs Add z-index support with a predictable UI stack (#5877) 2022-11-02 22:06:04 +00:00