diff --git a/Scripts/Layout/HorizontalScrollSnap.cs b/Scripts/Layout/HorizontalScrollSnap.cs index 4af6331..d1dae3c 100644 --- a/Scripts/Layout/HorizontalScrollSnap.cs +++ b/Scripts/Layout/HorizontalScrollSnap.cs @@ -238,7 +238,7 @@ namespace UnityEngine.UI.Extensions if (_scroll_rect.horizontal) { var distance = Vector3.Distance(_startPosition, _screensContainer.localPosition); - if (UseFastSwipe && distance < panelDimensions.width + FastSwipeThreshold && distance >=1f) + if (UseFastSwipe && distance < panelDimensions.width && distance >= FastSwipeThreshold) { _scroll_rect.velocity = Vector3.zero; if (_startPosition.x - _screensContainer.localPosition.x > 0) @@ -252,6 +252,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..44867e3 100644 --- a/Scripts/Layout/ScrollSnapBase.cs +++ b/Scripts/Layout/ScrollSnapBase.cs @@ -64,7 +64,7 @@ namespace UnityEngine.UI.Extensions [Tooltip("Fast Swipe makes swiping page next / previous (optional)")] public Boolean UseFastSwipe = false; - [Tooltip("Offset for how far a swipe has to travel to initiate a page change (optional)\nDefault is the panel dimensions")] + [Tooltip("Offset for how far a swipe has to travel to initiate a page change (optional)")] public int FastSwipeThreshold = 100; [Tooltip("Speed at which the ScrollRect will keep scrolling before slowing down and stopping (optional)")] @@ -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); } ///