-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Rename BorderRect to Insets and move to bevy_math #15461
base: main
Are you sure you want to change the base?
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
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.
Seems fine, the name is clear enough in context.
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.
Looks good, don't have any problems with it.
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.
Looks good overall, good idea :)
This now loses documentation that the units in question are pixels for UI. It makes sense to remove that doc from Insets
, as that is a pure math type now and does not know about UI. Could we instead document it on the various border
fields?
Also: would it be alright to rename Insets
to Inset
?
Yeah prefer |
So personally, I don't really like moving things like this into Ignoring " What I would do instead is:
This would decouple |
I don't think this makes sense in |
To be clear, I do think it may be good to replace our use of |
@Jondolf I'm not a UI person, but your arguments sound very convincing to me. I retract my statement about this looking alright. |
@Jondolf agree it's not really a rectangle in itself, which is the main value I see in re: padding vs borders, I also think it's a better name for padding, but I think it would make enough sense in context for borders too. Maybe we could add a separate class for borders and make it less confusing that way. @janhohenheim re: renaming to |
@Jondolf friendly ping on feedback for this |
So, thinking about this, kind of see this type as an asymmetric version of I do think that this representation would be valuable in I am fine with |
Yeah, that's definitely a fair point. I agree
As I mentioned, it's not really used in |
@Jondolf IMO I don't think replacing We could try |
Objective
Fixes #15440.
BorderRect
is used by more thanbevy_sprite
at this point and adds value not present in the standard Rect as it does not useVec2
. It should therefore be moved tobevy_math
so other similar use cases can use the struct.The name of
BorderRect
may also be subject to debate as it's not necessarily used only for borders (or anything UI-related for that matter).Solution
BorderRect
frombevy_sprite
tobevy_math
BorderRect
toInsets
(please suggest any names you think may be better)Testing
Ran
cargo run -p ci
on macOS, it looks good. Let me know if I should add unit tests.Migration Guide
Any uses of
bevy_sprite::BorderRect
need to instead be pointed tobevy_math::Insets
.