diff options
author | Adrian Knight <adrianknight89@outlook.com> | 2016-09-23 05:05:08 -0500 |
---|---|---|
committer | Adrian Knight <adrianknight89@outlook.com> | 2016-09-23 05:05:08 -0500 |
commit | e9606cd6e2bbe60b20d189682c2527751555820a (patch) | |
tree | 23974f85a9c1c4761935ccc9cc278c4e97d968a3 /Xamarin.Forms.Platform.iOS | |
parent | a708ad9593c810b3100627d9d0bbc2eb2dd70246 (diff) | |
download | xamarin-forms-e9606cd6e2bbe60b20d189682c2527751555820a.tar.gz xamarin-forms-e9606cd6e2bbe60b20d189682c2527751555820a.tar.bz2 xamarin-forms-e9606cd6e2bbe60b20d189682c2527751555820a.zip |
using internal Clamp method
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs | 19 |
1 files changed, 2 insertions, 17 deletions
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) { |