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

Flatten UI Style properties that use Size + remove Size #8548

Merged
merged 5 commits into from May 16, 2023

Conversation

nicoburns
Copy link
Contributor

Objective

  • Simplify API and make authoring styles easier

See: #8540 (comment)

Solution

  • The size, min_size, max_size, and gap properties have been replaced by width, height, min_width, min_height, max_width, max_height, row_gap, and column_gap properties

Changelog

  • Flattened Style properties that have a Size value directly into Style

Migration Guide

  • The size, min_size, max_size, and gap properties have been replaced by the width, height, min_width, min_height, max_width, max_height, row_gap, and column_gap properties. Use the new properties instead.

@nicoburns nicoburns added A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A simple quality-of-life change that makes Bevy easier to use C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide labels May 5, 2023
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, I think this is an improvement.

@ickshonpe
Copy link
Contributor

ickshonpe commented May 5, 2023

Love it, hated how Size joins the axes together since forever, but never even dreamed of removing it completely. I have an implementation I made last year but never upstreamed that is a bit of a compromise which has width and height fields with type:

pub struct LengthConstraint {
    pub min: Val,
    pub max: Val,
    pub suggested: Val,
} 

but I much prefer this, just get rid of all the structure completely.

Copy link
Contributor

@ickshonpe ickshonpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only minor things you can ignore if you like, the two broken links excepted.

examples/window/window_resizing.rs Outdated Show resolved Hide resolved
examples/ui/text_wrap_debug.rs Outdated Show resolved Hide resolved
examples/ui/transparency_ui.rs Outdated Show resolved Hide resolved
examples/ui/ui.rs Show resolved Hide resolved
examples/window/scale_factor_override.rs Outdated Show resolved Hide resolved
examples/ecs/apply_system_buffers.rs Outdated Show resolved Hide resolved
crates/bevy_ui/src/ui_node.rs Show resolved Hide resolved
crates/bevy_ui/src/ui_node.rs Show resolved Hide resolved
crates/bevy_ui/src/ui_node.rs Outdated Show resolved Hide resolved
crates/bevy_ui/src/ui_node.rs Outdated Show resolved Hide resolved
@ickshonpe
Copy link
Contributor

@nicoburns are you doing a new generic Size implementation as well? I've been working on some image widget improvements and the lack of one has been driving me nuts, can wait if you've got something in progress or I can bash something together myself etc

@nicoburns
Copy link
Contributor Author

@nicoburns are you doing a new generic Size implementation as well? I've been working on some image widget improvements and the lack of one has been driving me nuts, can wait if you've got something in progress or I can bash something together myself etc

I am not. This PR doesn't need a `Size. Feel free to work on that if you want to :) Taffy's may be good to copy if you want inspiration.

@alice-i-cecile
Copy link
Member

@konsti219 want to review this PR?

@ickshonpe
Copy link
Contributor

ickshonpe commented May 5, 2023

@nicoburns are you doing a new generic Size implementation as well? I've been working on some image widget improvements and the lack of one has been driving me nuts, can wait if you've got something in progress or I can bash something together myself etc

I am not. This PR doesn't need a `Size. Feel free to work on that if you want to :) Taffy's may be good to copy if you want inspiration.

Yep copy from Taffy is exactly what I meant by "bash something together" 😄

@konsti219
Copy link
Contributor

@konsti219 want to review this PR?

Earliest I could get to this is tomorrow. But feel free to ping me in future PRs.

@konsti219
Copy link
Contributor

I support ickshonpe's idea of changing row_gap to gap_height and same for column_gap. As a non-native English speaker I always need to think an extra second when seeing "column" while width is very intuitive.
Everything else looks good.

Co-authored-by: ickshonpe <david.curthoys@googlemail.com>
Co-authored-by: ickshonpe <david.curthoys@googlemail.com>
@nicoburns nicoburns 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 May 15, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue May 16, 2023
Merged via the queue into bevyengine:main with commit 08bf1a6 May 16, 2023
21 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-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide C-Usability A simple quality-of-life change that makes Bevy easier to use 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.

None yet

4 participants