diff --git a/Scripts/Layout/HorizontalScrollSnap.cs b/Scripts/Layout/HorizontalScrollSnap.cs index 64c5db5..c91b27b 100644 --- a/Scripts/Layout/HorizontalScrollSnap.cs +++ b/Scripts/Layout/HorizontalScrollSnap.cs @@ -10,7 +10,7 @@ namespace UnityEngine.UI.Extensions [RequireComponent(typeof(ScrollRect))] [AddComponentMenu("Layout/Extensions/Horizontal Scroll Snap")] - public class HorizontalScrollSnap : ScrollSnapBase, IEndDragHandler + public class HorizontalScrollSnap : ScrollSnapBase { void Start() { @@ -235,13 +235,11 @@ namespace UnityEngine.UI.Extensions GoToScreen(StartingScreen); } - #region Interfaces - /// /// Release screen to swipe /// /// - public void OnEndDrag(PointerEventData eventData) + public override void OnEndDrag(PointerEventData eventData) { _pointerDown = false; @@ -307,7 +305,5 @@ namespace UnityEngine.UI.Extensions } } } - - #endregion } } diff --git a/Scripts/Layout/ScrollSnapBase.cs b/Scripts/Layout/ScrollSnapBase.cs index bb945cc..c3ed31b 100644 --- a/Scripts/Layout/ScrollSnapBase.cs +++ b/Scripts/Layout/ScrollSnapBase.cs @@ -8,7 +8,7 @@ using UnityEngine.EventSystems; namespace UnityEngine.UI.Extensions { - public class ScrollSnapBase : MonoBehaviour, IBeginDragHandler, IDragHandler, IScrollSnap + public class ScrollSnapBase : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IScrollSnap { internal Rect panelDimensions; internal RectTransform _screensContainer; @@ -582,6 +582,8 @@ namespace UnityEngine.UI.Extensions _lerp = false; } + public virtual void OnEndDrag(PointerEventData eventData) { } + #endregion #region IScrollSnap Interface @@ -609,6 +611,7 @@ namespace UnityEngine.UI.Extensions { GoToScreen(page); } + #endregion } } diff --git a/Scripts/Layout/VerticalScrollSnap.cs b/Scripts/Layout/VerticalScrollSnap.cs index 03285a9..4e28a67 100644 --- a/Scripts/Layout/VerticalScrollSnap.cs +++ b/Scripts/Layout/VerticalScrollSnap.cs @@ -10,7 +10,7 @@ namespace UnityEngine.UI.Extensions { [RequireComponent(typeof(ScrollRect))] [AddComponentMenu("Layout/Extensions/Vertical Scroll Snap")] - public class VerticalScrollSnap : ScrollSnapBase, IEndDragHandler + public class VerticalScrollSnap : ScrollSnapBase { void Start() { @@ -228,12 +228,11 @@ namespace UnityEngine.UI.Extensions if(RestartOnEnable) GoToScreen(StartingScreen); } - #region Interfaces /// /// Release screen to swipe /// /// - public void OnEndDrag(PointerEventData eventData) + public override void OnEndDrag(PointerEventData eventData) { _pointerDown = false; @@ -298,6 +297,5 @@ namespace UnityEngine.UI.Extensions } } } - #endregion } }