-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
ComputedNode box model helper functions
#21903
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
Open
ickshonpe
wants to merge
10
commits into
bevyengine:main
Choose a base branch
from
ickshonpe:computed-boxes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+90
−0
Open
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0954dbb
Added `border_box`, `padding_box`, and `content_box` helper functions…
ickshonpe 84671e3
unconst functions and inline instead
ickshonpe c7ee7df
Merge branch 'main' into computed-boxes
ickshonpe 8858e2e
Added imports for tests
ickshonpe 879e974
updated release note
ickshonpe 7765993
Use max.x not min.x for right edges
ickshonpe 8657812
assign fields inside initializer in tests
ickshonpe cdcac09
Merge branch 'main' into computed-boxes
ickshonpe eb38832
padding-box -> content-box
ickshonpe ae84451
Merge branch 'computed-boxes' of https://github.com/ickshonpe/bevy in…
ickshonpe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
7 changes: 7 additions & 0 deletions
7
release-content/release-notes/computed_node_helper_functions.md
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| title: "`ComputedNode` helper functions" | ||
| authors: ["@ickshonpe"] | ||
| pull_requests: [21903] | ||
| --- | ||
|
|
||
| Helper functions `border_box`, `padding_box`, and `content_box` that return a node’s object-centered border, padding, and content boxes have been added to `ComputedNode`. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a stupid comment because I am new, but is this supposed to be
out.min.y += self.border.bottom(and the next line should beout.max.y -= self.border.top)? Same comment about this belongs incontent_boxtooFrom reading Rect, I had the impression visually that
Rect.minis the lower left point defined as(min.x, min.y)andRect.maxis the upper right point e.g(max.x, max.y), and that theBorderRectleft/right/top/bottom values are units “towards its center.” If that’s the case, shouldmin.yshould be affected byborder.bottominstead?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's confusing but, opposite to
bevy_sprite, inbevy_uithe y-axis increases downwards. SoRect::mincorresponds to the position of the top-left corner of the UI node andRect::maxcorresponds to its bottom-right corner.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦 Thanks for clarifying for me, I must commit this to memory!