Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the Size helper functions using the wrong default value and improve the UI examples #7625

Closed
wants to merge 1 commit into from

Conversation

ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Feb 11, 2023

Objective

Size::width sets the height field to Val::DEFAULT which is Val::Undefined, but the default for Size 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: #6498, #7468

Solution

Change Size::width so it sets height to Val::AUTO and change Size::height so it sets width to Val::AUTO.

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 explicit values with the flex property enums where possible, elided values where possible, and removed the remaining use of auto margins.

* fixed `Size::width` and `Size::height` using `Val::DEFAULT` instead of `Val::AUTO`
* added tests to ensure correct defaults.
* Simplified the UI examples. Replaced explicit values with the flex property enums where possible, removed values that can be ellided, and removed the remaining use of auto margins.
@ickshonpe ickshonpe closed this Feb 11, 2023
@ickshonpe ickshonpe deleted the impove-ui-examples branch February 11, 2023 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant