-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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] - can specify an anchor for a sprite #3463
Conversation
Can you add a doc alias for "pivot" or "pivot point" for this to improve discoverability? |
/// Custom anchor point. Top left is `(-0.5, 0.5)`, center is `(0.0, 0.0)`. The value will | ||
/// be scaled with the sprite size. |
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.
Just a thought, but should this be (0, 0) bottom left to (1, 1) top right? I think that might be clearer for those who want to select an anchor as an absolute position using Custom
rather than as an offset from the center point (which could also maybe play into UI stuff as well).
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.
I like that (0, 0) is the default behavior personally.
It doesn't matter much as long as it's clearly documented though.
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.
The default being centered is good in my opinion as well.
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 looks good to me, and the feature a part of pretty "basic" sprite workflow in my opinion, so I'm very happy to see it.
/// Custom anchor point. Top left is `(-0.5, 0.5)`, center is `(0.0, 0.0)`. The value will | ||
/// be scaled with the sprite size. |
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.
The default being centered is good in my opinion as well.
Anchor::CenterRight => Vec2::new(0.5, 0.0), | ||
Anchor::TopLeft => Vec2::new(-0.5, 0.5), | ||
Anchor::TopCenter => Vec2::new(0.0, 0.5), | ||
Anchor::TopRight => Vec2::new(0.5, 0.5), |
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.
I really like that you provided these anchors for convenience.
bors try |
tryMerge conflict. |
Co-Authored-By: Andrew Jakubowicz <[email protected]>
ef8f7ba
to
a651d4d
Compare
bors r+ |
# Objective - Fixes #1616, fixes #2225 - Let user specify an anchor for a sprite ## Solution - Add an enum for an anchor point for most common values, with a variant for a custom point - Defaults to Center to not change current behaviour Co-authored-by: François <[email protected]>
# Objective - Fixes bevyengine#1616, fixes bevyengine#2225 - Let user specify an anchor for a sprite ## Solution - Add an enum for an anchor point for most common values, with a variant for a custom point - Defaults to Center to not change current behaviour Co-authored-by: François <[email protected]>
# Objective - Fixes bevyengine#1616, fixes bevyengine#2225 - Let user specify an anchor for a sprite ## Solution - Add an enum for an anchor point for most common values, with a variant for a custom point - Defaults to Center to not change current behaviour Co-authored-by: François <[email protected]>
Objective
Solution