Merged in Matthew-Prinold/scrollconflictmanagercs-edited-online-wi-1590141623351 (pull request #71)

ScrollConflictManager.cs edited online with Bitbucket now works with scrollsnap Horizontal and calls the appropriate events

Approved-by: Simon Jackson
pull/413/head
Matthew Prinold 2020-05-22 11:59:23 +00:00 committed by Simon Jackson
commit 6ea1c4e8e5
1 changed files with 5 additions and 0 deletions

View File

@ -15,6 +15,7 @@ namespace UnityEngine.UI.Extensions
public class ScrollConflictManager : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler public class ScrollConflictManager : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler
{ {
public ScrollRect ParentScrollRect; public ScrollRect ParentScrollRect;
public HorizontalScrollSnap ParentScrollSnapHorizontal;
private ScrollRect _myScrollRect; private ScrollRect _myScrollRect;
private IBeginDragHandler[] _beginDragHandlers; private IBeginDragHandler[] _beginDragHandlers;
private IEndDragHandler[] _endDragHandlers; private IEndDragHandler[] _endDragHandlers;
@ -67,6 +68,7 @@ namespace UnityEngine.UI.Extensions
for (int i = 0, length = _beginDragHandlers.Length; i < length; i++) for (int i = 0, length = _beginDragHandlers.Length; i < length; i++)
{ {
_beginDragHandlers[i].OnBeginDrag(eventData); _beginDragHandlers[i].OnBeginDrag(eventData);
ParentScrollSnapHorizontal.OnBeginDrag(eventData);
} }
} }
} }
@ -78,6 +80,7 @@ namespace UnityEngine.UI.Extensions
for (int i = 0, length = _beginDragHandlers.Length; i < length; i++) for (int i = 0, length = _beginDragHandlers.Length; i < length; i++)
{ {
_beginDragHandlers[i].OnBeginDrag(eventData); _beginDragHandlers[i].OnBeginDrag(eventData);
ParentScrollSnapHorizontal.OnBeginDrag(eventData);
} }
} }
} }
@ -92,6 +95,7 @@ namespace UnityEngine.UI.Extensions
for (int i = 0, length = _endDragHandlers.Length; i < length; i++) for (int i = 0, length = _endDragHandlers.Length; i < length; i++)
{ {
_endDragHandlers[i].OnEndDrag(eventData); _endDragHandlers[i].OnEndDrag(eventData);
ParentScrollSnapHorizontal.OnEndDrag(eventData);
} }
} }
} }
@ -104,6 +108,7 @@ namespace UnityEngine.UI.Extensions
for (int i = 0, length = _endDragHandlers.Length; i < length; i++) for (int i = 0, length = _endDragHandlers.Length; i < length; i++)
{ {
_dragHandlers[i].OnDrag(eventData); _dragHandlers[i].OnDrag(eventData);
ParentScrollSnapHorizontal.OnDrag(eventData);
} }
} }
} }