From 6d818d324924ab1d3ad30e838969ac13e856e405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wies=C5=82aw=20=C5=A0olt=C3=A9s?= Date: Thu, 25 Nov 2021 08:35:36 +0100 Subject: [PATCH] Remove workaround for TransformOperationsTransition --- samples/AvaloniaDemo/MainWindow.axaml | 24 +++++------ .../TransformOperationsTransition.cs | 40 ------------------- 2 files changed, 12 insertions(+), 52 deletions(-) delete mode 100644 src/Avalonia.Controls.PanAndZoom/TransformOperationsTransition.cs diff --git a/samples/AvaloniaDemo/MainWindow.axaml b/samples/AvaloniaDemo/MainWindow.axaml index 2d7d588..186ac1d 100644 --- a/samples/AvaloniaDemo/MainWindow.axaml +++ b/samples/AvaloniaDemo/MainWindow.axaml @@ -108,16 +108,16 @@ HorizontalScrollBarVisibility="Auto"> - - - - - + + + + + @@ -149,16 +149,16 @@ HorizontalScrollBarVisibility="Auto"> - - - - - + + + + + diff --git a/src/Avalonia.Controls.PanAndZoom/TransformOperationsTransition.cs b/src/Avalonia.Controls.PanAndZoom/TransformOperationsTransition.cs deleted file mode 100644 index 76dfe76..0000000 --- a/src/Avalonia.Controls.PanAndZoom/TransformOperationsTransition.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Reactive.Linq; -using Avalonia.Animation; -using Avalonia.Media; -using Avalonia.Media.Transformation; - -namespace Avalonia.Controls.PanAndZoom -{ - /// - /// Defines how a TransformOperations property should be animated. - /// - /// - /// Workaround for https://github.com/AvaloniaUI/Avalonia/issues/6494 - /// - public class TransformOperationsTransition : Transition - { - /// - public override IObservable DoTransition(IObservable progress, ITransform oldValue, ITransform newValue) - { - return progress.Select(p => - { - var f = Easing.Ease(p); - var builder = new TransformOperations.Builder(1); - var matrix1 = (oldValue as TransformOperations)?.Value ?? Matrix.Identity; - var matrix2 = (newValue as TransformOperations)?.Value ?? Matrix.Identity; - var result = new Matrix( - matrix1.M11 + (matrix2.M11 - matrix1.M11) * f, - matrix1.M12 + (matrix2.M12 - matrix1.M12) * f, - matrix1.M21 + (matrix2.M21 - matrix1.M21) * f, - matrix1.M22 + (matrix2.M22 - matrix1.M22) * f, - matrix1.M31 + (matrix2.M31 - matrix1.M31) * f, - matrix1.M32 + (matrix2.M32 - matrix1.M32) * f); - - builder.AppendMatrix(result); - - return builder.Build(); - }); - } - } -}