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

UI examples clean up #9479

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Aug 18, 2023

Objective

Fix a few issues with some of the examples:

  • Root UI nodes have an implicit parent with FlexDirection::Row and AlignItems::Stretch set. Only a width constraint is needed to fill the viewport. Specifying height: Val::Percent(100.) is unnecessary and can cause confusing overflow behaviour.

  • The default for position and size constraint properties is Val::Auto. Setting left: Val::Auto, max_height: Val::Auto, etc does nothing.

Solution

Delete those lines. There should be no observable differences in the behaviours of any of the examples.

Also changed a padding setting in the flex_layout example to use the axes helper function.

* Root UI nodes have an implicit parent with `FlexDirection::Row` and `AlignItems::Stretch`. Setting `height: Val::Percent(100.)` isn't necessary to fill the viewport and can cause confusing overflow behaviour.

* The default for position and size constraint properties is `Val::Auto`. Setting `left: Val::Auto`, `max_height: Val::Auto`, etc does nothing.

Since the removed lines did nothing, there should be no change in the behaviour or appearance of any the examples.
@github-actions
Copy link
Contributor

Example alien_cake_addict failed to run, please try running it locally and check the result.

@ickshonpe ickshonpe changed the title A few small UI style fixes for examples UI style fixes for examples Aug 18, 2023
@ickshonpe ickshonpe changed the title UI style fixes for examples UI examples clean up Aug 18, 2023
@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples A-UI Graphical user interfaces, styles, layouts, and widgets labels Aug 19, 2023
@nicoburns
Copy link
Contributor

Root UI nodes have an implicit parent with FlexDirection::Row and AlignItems::Stretch set.

This doesn't affect this PR, but IMO we really ought to try and change this to something more intuitive at some point. Perhaps root nodes should just actually be Taffy root nodes?

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Aug 23, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Aug 23, 2023
Merged via the queue into bevyengine:main with commit 373f1ee Aug 23, 2023
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Examples An addition or correction to our examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants