Fixed a conflict when using the ScrollConflictManager in child content of a HSS or VSS
parent
4a3b85a3db
commit
0e636bf937
|
@ -12,6 +12,8 @@ namespace UnityEngine.UI.Extensions
|
||||||
[AddComponentMenu("Layout/Extensions/Horizontal Scroll Snap")]
|
[AddComponentMenu("Layout/Extensions/Horizontal Scroll Snap")]
|
||||||
public class HorizontalScrollSnap : ScrollSnapBase
|
public class HorizontalScrollSnap : ScrollSnapBase
|
||||||
{
|
{
|
||||||
|
private bool updated = true;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
_isVertical = false;
|
_isVertical = false;
|
||||||
|
@ -23,6 +25,8 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
updated = false;
|
||||||
|
|
||||||
if (!_lerp && _scroll_rect.velocity == Vector2.zero)
|
if (!_lerp && _scroll_rect.velocity == Vector2.zero)
|
||||||
{
|
{
|
||||||
if (!_settled && !_pointerDown)
|
if (!_settled && !_pointerDown)
|
||||||
|
@ -243,6 +247,14 @@ namespace UnityEngine.UI.Extensions
|
||||||
/// <param name="eventData"></param>
|
/// <param name="eventData"></param>
|
||||||
public override void OnEndDrag(PointerEventData eventData)
|
public override void OnEndDrag(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
|
if (updated)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// to prevent double dragging, only act on EndDrag once per frame
|
||||||
|
updated = true;
|
||||||
|
|
||||||
_pointerDown = false;
|
_pointerDown = false;
|
||||||
|
|
||||||
if (_scroll_rect.horizontal)
|
if (_scroll_rect.horizontal)
|
||||||
|
|
|
@ -12,6 +12,8 @@ namespace UnityEngine.UI.Extensions
|
||||||
[AddComponentMenu("Layout/Extensions/Vertical Scroll Snap")]
|
[AddComponentMenu("Layout/Extensions/Vertical Scroll Snap")]
|
||||||
public class VerticalScrollSnap : ScrollSnapBase
|
public class VerticalScrollSnap : ScrollSnapBase
|
||||||
{
|
{
|
||||||
|
private bool updated = true;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
_isVertical = true;
|
_isVertical = true;
|
||||||
|
@ -23,6 +25,8 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
updated = false;
|
||||||
|
|
||||||
if (!_lerp && _scroll_rect.velocity == Vector2.zero)
|
if (!_lerp && _scroll_rect.velocity == Vector2.zero)
|
||||||
{
|
{
|
||||||
if (!_settled && !_pointerDown)
|
if (!_settled && !_pointerDown)
|
||||||
|
@ -236,6 +240,14 @@ namespace UnityEngine.UI.Extensions
|
||||||
/// <param name="eventData"></param>
|
/// <param name="eventData"></param>
|
||||||
public override void OnEndDrag(PointerEventData eventData)
|
public override void OnEndDrag(PointerEventData eventData)
|
||||||
{
|
{
|
||||||
|
if (updated)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// to prevent double dragging, only act on EndDrag once per frame
|
||||||
|
updated = true;
|
||||||
|
|
||||||
_pointerDown = false;
|
_pointerDown = false;
|
||||||
|
|
||||||
if (_scroll_rect.vertical)
|
if (_scroll_rect.vertical)
|
||||||
|
|
Loading…
Reference in New Issue