bevy/examples/ui
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
..
button.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
font_atlas_debug.rs Rename Handle::as_weak() to cast_weak() (#5321) 2022-10-28 22:43:14 +00:00
relative_cursor_position.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
text.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
text_debug.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
text_layout.rs Add width, height and all constructor functions to Size (#7468) 2023-02-02 14:29:39 +00:00
transparency_ui.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
ui.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
ui_scaling.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
window_fallthrough.rs update winit to 0.28 (#7480) 2023-02-03 16:41:39 +00:00
z_index.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