We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a0c233a commit baf1c70Copy full SHA for baf1c70
Runtime/Extensions.cs
@@ -505,6 +505,10 @@ public static Vector2 Lerp( this Rect r, Vector2 tPos ) =>
505
/// <summary>The y axis range of this rectangle</summary>
506
/// <param name="rect">The rectangle to get the y range of</param>
507
public static FloatRange RangeY( this Rect rect ) => ( rect.yMin, rect.yMax );
508
+
509
+ /// <summary>Places the center of this rectangle at its position,
510
+ /// useful together with the constructor to define it by center instead of by corner</summary>
511
+ public static Rect ByCenter( this Rect r ) => new Rect( r ) { center = r.position };
512
513
#endregion
514
0 commit comments