diff --git a/Scripts/Layout/ScrollSnapBase.cs b/Scripts/Layout/ScrollSnapBase.cs index 59cdd07..466beb6 100644 --- a/Scripts/Layout/ScrollSnapBase.cs +++ b/Scripts/Layout/ScrollSnapBase.cs @@ -4,7 +4,7 @@ using UnityEngine.EventSystems; namespace UnityEngine.UI.Extensions { - public class ScrollSnapBase : MonoBehaviour, IBeginDragHandler, IDragHandler + public class ScrollSnapBase : MonoBehaviour, IBeginDragHandler, IDragHandler, IPointerDownHandler, IPointerUpHandler { internal RectTransform _screensContainer; internal bool isVertical; @@ -18,6 +18,7 @@ namespace UnityEngine.UI.Extensions internal ScrollRect _scroll_rect; internal Vector3 _lerp_target; internal bool _lerp; + internal bool _pointerDown = false; internal Vector3 _startPosition = new Vector3(); [Tooltip("The currently active page")] internal int _currentPage; @@ -316,7 +317,7 @@ namespace UnityEngine.UI.Extensions } /// - /// Event fires when the user starts to change the page, either via swipe or button + /// Event fires when the user starts to change the page, either via swipe or button. /// internal void StartScreenChange() { @@ -358,6 +359,16 @@ namespace UnityEngine.UI.Extensions { _lerp = false; } + + public void OnPointerDown(PointerEventData eventData) + { + _pointerDown = true; + } + + public void OnPointerUp(PointerEventData eventData) + { + _pointerDown = false; + } #endregion } } \ No newline at end of file