-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Merged by Bors] - Add additional constructors for UiRect
to specify values for specific fields
#5988
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Piturnah
changed the title
Feat/uirect
Add additional constructors for Sep 14, 2022
UiRect
to specify values for specific fields
tguichaoua
approved these changes
Sep 14, 2022
mockersf
added
A-UI
Graphical user interfaces, styles, layouts, and widgets
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
labels
Sep 14, 2022
BorisBoutillier
approved these changes
Sep 23, 2022
rparrett
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
Sep 23, 2022
bors r+ |
bors bot
pushed a commit
that referenced
this pull request
Sep 27, 2022
…ic fields (#5988) # Objective Often one wants to create a `UiRect` with a value only specifying a single field. These ways are already available, but not the most ergonomic: ```rust UiRect::new(Val::Undefined, Val::Undefined, Val::Percent(25.0), Val::Undefined) ``` ```rust UiRect { top: Val::Percent(25.0), ..default() } ``` ## Solution Introduce 6 new constructors: - `horizontal` - `vertical` - `left` - `right` - `top` - `bottom` So the above code can be written instead as: ```rust UiRect::top(Val::Percent(25.0)) ``` This solution is similar to the style fields `margin-left`, `padding-top`, etc. that you would see in CSS, from which bevy's UI has other inspiration. Therefore, it should still feel intuitive to users coming from CSS. --- ## Changelog ### Added - Additional constructors for `UiRect` to specify values for specific fields
Pull request successfully merged into main. Build succeeded: |
bors
bot
changed the title
Add additional constructors for
[Merged by Bors] - Add additional constructors for Sep 27, 2022
UiRect
to specify values for specific fieldsUiRect
to specify values for specific fields
james7132
pushed a commit
to james7132/bevy
that referenced
this pull request
Oct 19, 2022
…ic fields (bevyengine#5988) # Objective Often one wants to create a `UiRect` with a value only specifying a single field. These ways are already available, but not the most ergonomic: ```rust UiRect::new(Val::Undefined, Val::Undefined, Val::Percent(25.0), Val::Undefined) ``` ```rust UiRect { top: Val::Percent(25.0), ..default() } ``` ## Solution Introduce 6 new constructors: - `horizontal` - `vertical` - `left` - `right` - `top` - `bottom` So the above code can be written instead as: ```rust UiRect::top(Val::Percent(25.0)) ``` This solution is similar to the style fields `margin-left`, `padding-top`, etc. that you would see in CSS, from which bevy's UI has other inspiration. Therefore, it should still feel intuitive to users coming from CSS. --- ## Changelog ### Added - Additional constructors for `UiRect` to specify values for specific fields
james7132
pushed a commit
to james7132/bevy
that referenced
this pull request
Oct 28, 2022
…ic fields (bevyengine#5988) # Objective Often one wants to create a `UiRect` with a value only specifying a single field. These ways are already available, but not the most ergonomic: ```rust UiRect::new(Val::Undefined, Val::Undefined, Val::Percent(25.0), Val::Undefined) ``` ```rust UiRect { top: Val::Percent(25.0), ..default() } ``` ## Solution Introduce 6 new constructors: - `horizontal` - `vertical` - `left` - `right` - `top` - `bottom` So the above code can be written instead as: ```rust UiRect::top(Val::Percent(25.0)) ``` This solution is similar to the style fields `margin-left`, `padding-top`, etc. that you would see in CSS, from which bevy's UI has other inspiration. Therefore, it should still feel intuitive to users coming from CSS. --- ## Changelog ### Added - Additional constructors for `UiRect` to specify values for specific fields
Piturnah
added a commit
to fishfolk/bomby
that referenced
this pull request
Nov 22, 2022
Introduced in Bevy 0.9 (bevyengine/bevy#5988)
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this pull request
Feb 1, 2023
…ic fields (bevyengine#5988) # Objective Often one wants to create a `UiRect` with a value only specifying a single field. These ways are already available, but not the most ergonomic: ```rust UiRect::new(Val::Undefined, Val::Undefined, Val::Percent(25.0), Val::Undefined) ``` ```rust UiRect { top: Val::Percent(25.0), ..default() } ``` ## Solution Introduce 6 new constructors: - `horizontal` - `vertical` - `left` - `right` - `top` - `bottom` So the above code can be written instead as: ```rust UiRect::top(Val::Percent(25.0)) ``` This solution is similar to the style fields `margin-left`, `padding-top`, etc. that you would see in CSS, from which bevy's UI has other inspiration. Therefore, it should still feel intuitive to users coming from CSS. --- ## Changelog ### Added - Additional constructors for `UiRect` to specify values for specific fields
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-Usability
A targeted 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Often one wants to create a
UiRect
with a value only specifying a single field. These ways are already available, but not the most ergonomic:Solution
Introduce 6 new constructors:
horizontal
vertical
left
right
top
bottom
So the above code can be written instead as:
This solution is similar to the style fields
margin-left
,padding-top
, etc. that you would see in CSS, from which bevy's UI has other inspiration. Therefore, it should still feel intuitive to users coming from CSS.Changelog
Added
UiRect
to specify values for specific fields