Переглянути джерело

Add Point animator handling

Jumar Macato 7 роки тому
батько
коміт
c968854c6a
1 змінених файлів з 10 додано та 4 видалено
  1. 10 4
      src/Avalonia.Visuals/Point.cs

+ 10 - 4
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.
 // Licensed under the MIT license. See licence.md file in the project root for full license information.
 
 
 using System.Globalization;
 using System.Globalization;
+using Avalonia.Animation.Animators;
 using Avalonia.Utilities;
 using Avalonia.Utilities;
 
 
 namespace Avalonia
 namespace Avalonia
@@ -11,6 +12,11 @@ namespace Avalonia
     /// </summary>
     /// </summary>
     public readonly struct Point
     public readonly struct Point
     {
     {
+        static Point()
+        {
+            Animation.Animation.RegisterAnimator<PointAnimator>(prop => typeof(Point).IsAssignableFrom(prop.PropertyType));
+        }
+
         /// <summary>
         /// <summary>
         /// The X position.
         /// The X position.
         /// </summary>
         /// </summary>
@@ -133,7 +139,7 @@ namespace Avalonia
         /// <param name="p">Point to multiply</param>
         /// <param name="p">Point to multiply</param>
         /// <param name="k">Factor</param>
         /// <param name="k">Factor</param>
         /// <returns>Points having its coordinates multiplied</returns>
         /// <returns>Points having its coordinates multiplied</returns>
-        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);
 
 
         /// <summary>
         /// <summary>
         /// Multiplies a point by a factor coordinate-wise
         /// Multiplies a point by a factor coordinate-wise
@@ -141,7 +147,7 @@ namespace Avalonia
         /// <param name="p">Point to multiply</param>
         /// <param name="p">Point to multiply</param>
         /// <param name="k">Factor</param>
         /// <param name="k">Factor</param>
         /// <returns>Points having its coordinates multiplied</returns>
         /// <returns>Points having its coordinates multiplied</returns>
-        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);
 
 
         /// <summary>
         /// <summary>
         /// Divides a point by a factor coordinate-wise
         /// Divides a point by a factor coordinate-wise
@@ -149,8 +155,8 @@ namespace Avalonia
         /// <param name="p">Point to divide by</param>
         /// <param name="p">Point to divide by</param>
         /// <param name="k">Factor</param>
         /// <param name="k">Factor</param>
         /// <returns>Points having its coordinates divided</returns>
         /// <returns>Points having its coordinates divided</returns>
-        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);
+
         /// <summary>
         /// <summary>
         /// Applies a matrix to a point.
         /// Applies a matrix to a point.
         /// </summary>
         /// </summary>