From 14f42df81c00f3d6c4aca5f254f0a6ffb1f2d160 Mon Sep 17 00:00:00 2001 From: Johannes Deml Date: Wed, 2 Aug 2017 11:59:27 +0200 Subject: [PATCH] REFACTOR make method more readable --- Scripts/Layout/HorizontalScrollSnap.cs | 2 +- Scripts/Layout/ScrollSnapBase.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Scripts/Layout/HorizontalScrollSnap.cs b/Scripts/Layout/HorizontalScrollSnap.cs index f3c01a0..fa532c2 100644 --- a/Scripts/Layout/HorizontalScrollSnap.cs +++ b/Scripts/Layout/HorizontalScrollSnap.cs @@ -250,6 +250,6 @@ namespace UnityEngine.UI.Extensions } } } - #endregion + #endregion } } \ No newline at end of file diff --git a/Scripts/Layout/ScrollSnapBase.cs b/Scripts/Layout/ScrollSnapBase.cs index b7aea59..c07771f 100644 --- a/Scripts/Layout/ScrollSnapBase.cs +++ b/Scripts/Layout/ScrollSnapBase.cs @@ -314,8 +314,8 @@ namespace UnityEngine.UI.Extensions internal int GetPageforPosition(Vector3 pos) { return _isVertical ? - -(int)Math.Round((pos.y - _scrollStartPosition) / _childSize) : - -(int)Math.Round((pos.x - _scrollStartPosition) / _childSize); + (int)Math.Round((_scrollStartPosition - pos.y) / _childSize) : + (int)Math.Round((_scrollStartPosition - pos.x) / _childSize); } ///