Skip to content

Commit

Permalink
Fix incorrect Rect2 size when Transform2D * operator.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-noisyduck committed Dec 23, 2023
1 parent 4c4cb12 commit 05624dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public Transform2D(real_t rotation, Vector2 origin)
}

/// <summary>
/// Returns a Rect2 transformed (multiplied) by transformation matrix.
/// Returns a Rect2 transformed (multiplied) by the transformation matrix.
/// </summary>
/// <param name="transform">The transformation to apply.</param>
/// <param name="rect">A Rect2 to transform.</param>
Expand All @@ -498,7 +498,7 @@ public Transform2D(real_t rotation, Vector2 origin)
Vector2 toX = transform.x * rect.Size.x;
Vector2 toY = transform.y * rect.Size.y;

return new Rect2(pos, rect.Size).Expand(pos + toX).Expand(pos + toY).Expand(pos + toX + toY);
return new Rect2(pos, new Vector2()).Expand(pos + toX).Expand(pos + toY).Expand(pos + toX + toY);
}

/// <summary>
Expand All @@ -514,7 +514,7 @@ 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);
}

/// <summary>
Expand Down

0 comments on commit 05624dd

Please sign in to comment.