-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
C#: Replace Xform
and XformInv
with *
operator
#64729
Conversation
@@ -552,11 +527,11 @@ public Transform2D(real_t rotation, Vector2 origin) | |||
Vector2 to2 = new Vector2(rect.Position.x + rect.Size.x, rect.Position.y + rect.Size.y) * transform; | |||
Vector2 to3 = new Vector2(rect.Position.x + rect.Size.x, rect.Position.y) * transform; | |||
|
|||
return new Rect2(pos, rect.Size).Expand(to1).Expand(to2).Expand(to3); | |||
return new Rect2(pos, new Vector2()).Expand(to1).Expand(to2).Expand(to3); |
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 is a separate bug fix. It looks good, but it's questionable to sneak this in with Xform refactor.
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.
You are right, I thought since I was modifying all the Xform methods and I noticed this difference with the C++ implementation it might make sense to include it rather than create a separate PR but probably should extract 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.
I'm fine with it being in this PR, or another, but it should at least be mentioned in the PR description.
- In cases where both `Xform`/`XformInv` and the `*` operator were implemented the `Xform`/`XformInv` methods were removed in favor of the `*` operator. - In cases where the `Xform`/`XformInv` existed but not the `*` operator, the `Xform`/`XformInv` methods were replaced with the `*` operator. - In cases where no method existed, a new `*` operator has been implemented to support the same operations that are supported in GDScript. - Fixes the `Transform.Xform` and `Transform.XformInv` with `Rect2` implementation to use a zero `Rect2` size to start expanding from (which is how it's implemented in C++).
90f8e21
to
0b8b733
Compare
Is it the same as GDScript? Was xform replaced with operators there? |
Yes. |
Thanks! |
Xform
/XformInv
and the*
operator were implemented theXform
/XformInv
methods were removed in favor of the*
operator.Xform
/XformInv
existed but not the*
operator, theXform
/XformInv
methods were replaced with the*
operator.*
operator has been implemented to support the same operations that are supported in GDScript.Transform.Xform
andTransform.XformInv
withRect2
implementation to use a zeroRect2
size to start expanding from (which is how it's implemented in C++).