From 234499570085d4ca69d13c10efc540e21c455617 Mon Sep 17 00:00:00 2001 From: MartyIX <203266+MartyIX@users.noreply.github.com> Date: Fri, 17 May 2024 11:28:45 +0200 Subject: [PATCH] TransformationExtensions: Optimize --- .../src/Platform/Windows/TransformationExtensions.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Core/src/Platform/Windows/TransformationExtensions.cs b/src/Core/src/Platform/Windows/TransformationExtensions.cs index c9c5f9cd3cd2..d865a90f060f 100644 --- a/src/Core/src/Platform/Windows/TransformationExtensions.cs +++ b/src/Core/src/Platform/Windows/TransformationExtensions.cs @@ -8,8 +8,6 @@ public static class TransformationExtensions { public static void UpdateTransformation(this FrameworkElement frameworkElement, IView view) { - double anchorX = view.AnchorX; - double anchorY = view.AnchorY; double rotationX = view.RotationX; double rotationY = view.RotationY; double rotation = view.Rotation; @@ -18,9 +16,6 @@ public static void UpdateTransformation(this FrameworkElement frameworkElement, double scaleX = view.Scale * view.ScaleX; double scaleY = view.Scale * view.ScaleY; - frameworkElement.RenderTransformOrigin = new global::Windows.Foundation.Point(anchorX, anchorY); - frameworkElement.RenderTransform = new ScaleTransform { ScaleX = scaleX, ScaleY = scaleY }; - if (rotationX % 360 == 0 && rotationY % 360 == 0 && rotation % 360 == 0 && translationX == 0 && translationY == 0 && scaleX == 1 && scaleY == 1) { @@ -29,6 +24,12 @@ public static void UpdateTransformation(this FrameworkElement frameworkElement, } else { + double anchorX = view.AnchorX; + double anchorY = view.AnchorY; + + frameworkElement.RenderTransformOrigin = new global::Windows.Foundation.Point(anchorX, anchorY); + frameworkElement.RenderTransform = new ScaleTransform { ScaleX = scaleX, ScaleY = scaleY }; + // PlaneProjection removes touch and scrollwheel functionality on scrollable views such // as ScrollView, ListView, and TableView. If neither RotationX or RotationY are set // (i.e. their absolute value is 0), a CompositeTransform is instead used to allow for