Skip to content

Commit

Permalink
feat: Add VectorExtensions API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpinedam committed Jan 26, 2021
1 parent d2b455f commit 17af317
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Uno.UI/Extensions/VectorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,32 @@ namespace Uno.UI.Extensions
{
public static class VectorExtensions
{
/// <summary>
/// Converts a <see cref="Vector2"/> to <see cref="Point"/>
/// </summary>
/// <param name="vector">The <see cref="Vector2"/> to convert</param>
/// <returns>A <see cref="Point"/></returns>
public static Point ToPoint(this Vector2 vector) => new Point(vector.X, vector.Y);

/// <summary>
/// Converts a <see cref="Vector2"/> to <see cref="Size"/>
/// </summary>
/// <param name="vector">The <see cref="Vector2"/> to convert</param>
/// <returns>A <see cref="Size"/></returns>
public static Size ToSize(this Vector2 vector) => new Size(vector.X, vector.Y);

/// <summary>
/// Converts a <see cref="Point"/> to <see cref="Vector2"/>
/// </summary>
/// <param name="point">The <see cref="Point"/> to Convert</param>
/// <returns>A <see cref="Vector2"/></returns>
public static Vector2 ToVector2(this Point point) => new Vector2((float)point.X, (float)point.Y);

/// <summary>
/// Converts a <see cref="Size"/> to <see cref="Vector2"/>
/// </summary>
/// <param name="point">The <see cref="Size"/> to Convert</param>
/// <returns>A <see cref="Vector2"/></returns>
public static Vector2 ToVector2(this Size size) => new Vector2((float)size.Width, (float)size.Height);
}
}

0 comments on commit 17af317

Please sign in to comment.