From c968854c6a5e54ed195af44585f9e102bf8b2c8e Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Sat, 8 Dec 2018 18:57:04 +0800 Subject: [PATCH] Add Point animator handling --- src/Avalonia.Visuals/Point.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Visuals/Point.cs b/src/Avalonia.Visuals/Point.cs index e74094fe50..0d3e354615 100644 --- a/src/Avalonia.Visuals/Point.cs +++ b/src/Avalonia.Visuals/Point.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Globalization; +using Avalonia.Animation.Animators; using Avalonia.Utilities; namespace Avalonia @@ -11,6 +12,11 @@ namespace Avalonia /// public readonly struct Point { + static Point() + { + Animation.Animation.RegisterAnimator(prop => typeof(Point).IsAssignableFrom(prop.PropertyType)); + } + /// /// The X position. /// @@ -133,7 +139,7 @@ namespace Avalonia /// Point to multiply /// Factor /// Points having its coordinates multiplied - public static Point operator *(Point p, double k) => new Point(p.X*k, p.Y*k); + public static Point operator *(Point p, double k) => new Point(p.X * k, p.Y * k); /// /// Multiplies a point by a factor coordinate-wise @@ -141,7 +147,7 @@ namespace Avalonia /// Point to multiply /// Factor /// Points having its coordinates multiplied - public static Point operator *(double k, Point p) => new Point(p.X*k, p.Y*k); + public static Point operator *(double k, Point p) => new Point(p.X * k, p.Y * k); /// /// Divides a point by a factor coordinate-wise @@ -149,8 +155,8 @@ namespace Avalonia /// Point to divide by /// Factor /// Points having its coordinates divided - public static Point operator /(Point p, double k) => new Point(p.X/k, p.Y/k); - + public static Point operator /(Point p, double k) => new Point(p.X / k, p.Y / k); + /// /// Applies a matrix to a point. ///