Skip to content

Commit

Permalink
TransformationExtensions: Optimize (#22481)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartyIX committed May 23, 2024
1 parent 6a80195 commit a7705a9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Core/src/Platform/Windows/TransformationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand All @@ -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
Expand Down

0 comments on commit a7705a9

Please sign in to comment.