-
-
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] - Add builder methods to Transform #2778
Conversation
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 this change, it is compatible with others APIs.
@@ -105,6 +105,27 @@ impl GlobalTransform { | |||
self | |||
} | |||
|
|||
#[doc(hidden)] |
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.
Why add doc(hidden) here?
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 added it because the other creation methods (looking_at and from_*) are all doc(hidden).
I think it's a bit strange that they are hidden but users don't usually create GlobalTransforms.
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.
hmm yeah then i guess we can just leave this as-is for now and then circle back if/when we need to with docs.
bors r+ |
# Objective Make it easier to construct transforms. E.g. ```rs Transform::from_xyz(0.0, 0.0, 10.0).with_scale(Vec3::splat(2.0)) ``` I found myself writing an extension method to do this so I don't have to write: ```rs Transform { translation: Vec3::new(0.0, 0.0, 10.0), scale: Vec3::splat(2.0), ..Default::default() } ``` ## Solution Add *builder style* methods to `Transform`. Methods: - `with_translation` - `with_rotation` - `with_scale` I also added these methods to `GlobalTransform`. But they are probably less useful there.
Objective
Make it easier to construct transforms. E.g.
I found myself writing an extension method to do this so I don't have to write:
Solution
Add builder style methods to
Transform
.Methods:
with_translation
with_rotation
with_scale
I also added these methods to
GlobalTransform
. But they are probably less useful there.