From e9606cd6e2bbe60b20d189682c2527751555820a Mon Sep 17 00:00:00 2001 From: Adrian Knight Date: Fri, 23 Sep 2016 05:05:08 -0500 Subject: using internal Clamp method --- .../Renderers/ScrollViewRenderer.cs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'Xamarin.Forms.Platform.iOS') diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs index bfb24337..af5fc1a6 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs @@ -209,23 +209,8 @@ namespace Xamarin.Forms.Platform.iOS { var positionOnScroll = Controller.GetScrollPositionForElement(e.Element as VisualElement, e.Position); - if (positionOnScroll.X < 0) - { - positionOnScroll.X = 0; - } - else if (positionOnScroll.X > ContentSize.Width - Bounds.Size.Width) - { - positionOnScroll.X = ContentSize.Width - Bounds.Size.Width; - } - - if (positionOnScroll.Y < 0) - { - positionOnScroll.Y = 0; - } - else if (positionOnScroll.Y > ContentSize.Height - Bounds.Size.Height) - { - positionOnScroll.Y = ContentSize.Height - Bounds.Size.Height; - } + positionOnScroll.X = positionOnScroll.X.Clamp(0, ContentSize.Width - Bounds.Size.Width); + positionOnScroll.Y = positionOnScroll.Y.Clamp(0, ContentSize.Height - Bounds.Size.Height); switch (ScrollView.Orientation) { -- cgit v1.2.3