commit
bf59edf11d
|
@ -10,7 +10,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
[RequireComponent(typeof(ScrollRect))]
|
[RequireComponent(typeof(ScrollRect))]
|
||||||
[AddComponentMenu("Layout/Extensions/Horizontal Scroll Snap")]
|
[AddComponentMenu("Layout/Extensions/Horizontal Scroll Snap")]
|
||||||
public class HorizontalScrollSnap : ScrollSnapBase, IEndDragHandler
|
public class HorizontalScrollSnap : ScrollSnapBase
|
||||||
{
|
{
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
@ -235,13 +235,11 @@ namespace UnityEngine.UI.Extensions
|
||||||
GoToScreen(StartingScreen);
|
GoToScreen(StartingScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Interfaces
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Release screen to swipe
|
/// Release screen to swipe
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eventData"></param>
|
/// <param name="eventData"></param>
|
||||||
public void OnEndDrag(PointerEventData eventData)
|
public override void OnEndDrag(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
_pointerDown = false;
|
_pointerDown = false;
|
||||||
|
|
||||||
|
@ -307,7 +305,5 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ using UnityEngine.EventSystems;
|
||||||
|
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
public class ScrollSnapBase : MonoBehaviour, IBeginDragHandler, IDragHandler, IScrollSnap
|
public class ScrollSnapBase : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IScrollSnap
|
||||||
{
|
{
|
||||||
internal Rect panelDimensions;
|
internal Rect panelDimensions;
|
||||||
internal RectTransform _screensContainer;
|
internal RectTransform _screensContainer;
|
||||||
|
@ -582,6 +582,8 @@ namespace UnityEngine.UI.Extensions
|
||||||
_lerp = false;
|
_lerp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void OnEndDrag(PointerEventData eventData) { }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IScrollSnap Interface
|
#region IScrollSnap Interface
|
||||||
|
@ -609,6 +611,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
GoToScreen(page);
|
GoToScreen(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
[RequireComponent(typeof(ScrollRect))]
|
[RequireComponent(typeof(ScrollRect))]
|
||||||
[AddComponentMenu("Layout/Extensions/Vertical Scroll Snap")]
|
[AddComponentMenu("Layout/Extensions/Vertical Scroll Snap")]
|
||||||
public class VerticalScrollSnap : ScrollSnapBase, IEndDragHandler
|
public class VerticalScrollSnap : ScrollSnapBase
|
||||||
{
|
{
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
@ -228,12 +228,11 @@ namespace UnityEngine.UI.Extensions
|
||||||
if(RestartOnEnable) GoToScreen(StartingScreen);
|
if(RestartOnEnable) GoToScreen(StartingScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Interfaces
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Release screen to swipe
|
/// Release screen to swipe
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eventData"></param>
|
/// <param name="eventData"></param>
|
||||||
public void OnEndDrag(PointerEventData eventData)
|
public override void OnEndDrag(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
_pointerDown = false;
|
_pointerDown = false;
|
||||||
|
|
||||||
|
@ -298,6 +297,5 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue