diff options
Diffstat (limited to 'Xamarin.Forms.Platform.MacOS/Extensions/NSScrollViewExtensions.cs')
-rw-r--r-- | Xamarin.Forms.Platform.MacOS/Extensions/NSScrollViewExtensions.cs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/Xamarin.Forms.Platform.MacOS/Extensions/NSScrollViewExtensions.cs b/Xamarin.Forms.Platform.MacOS/Extensions/NSScrollViewExtensions.cs deleted file mode 100644 index f9104d4a..00000000 --- a/Xamarin.Forms.Platform.MacOS/Extensions/NSScrollViewExtensions.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Threading.Tasks; -using AppKit; -using PointF = CoreGraphics.CGPoint; - -namespace Xamarin.Forms.Platform.MacOS -{ - internal static class NSScrollViewExtensions - { - public static Task ScrollToPositionAsync(this NSScrollView scrollView, PointF point, bool animate, - double duration = 0.5) - { - if (!animate) - { - var nsView = scrollView.DocumentView as NSView; - nsView?.ScrollPoint(point); - return Task.FromResult(true); - } - - TaskCompletionSource<bool> source = new TaskCompletionSource<bool>(); - - NSAnimationContext.BeginGrouping(); - - NSAnimationContext.CurrentContext.CompletionHandler += () => { source.TrySetResult(true); }; - - NSAnimationContext.CurrentContext.Duration = duration; - - var animator = scrollView.ContentView.Animator as NSView; - - animator?.SetBoundsOrigin(point); - - NSAnimationContext.EndGrouping(); - - return source.Task; - } - } -}
\ No newline at end of file |