Updated ScrollConflictManager with fix from Jared Turner #85

pull/413/head
Simon (Darkside) Jackson 2019-03-07 17:04:10 +00:00
parent e813cd70a9
commit 22b2ec2ec2
1 changed files with 92 additions and 87 deletions

View File

@ -14,6 +14,7 @@ namespace UnityEngine.UI.Extensions
public class ScrollConflictManager : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler
{
public ScrollRect ParentScrollRect;
public ScrollSnap ParentScrollSnap;
private ScrollRect _myScrollRect;
//This tracks if the other one should be scrolling instead of the current one.
private bool scrollOther;
@ -54,6 +55,7 @@ namespace UnityEngine.UI.Extensions
//disable the current scroll rect so it doesnt move.
_myScrollRect.enabled = false;
ParentScrollRect.OnBeginDrag(eventData);
ParentScrollSnap.OnBeginDrag(eventData);
}
}
else if (vertical > horizontal)
@ -62,6 +64,7 @@ namespace UnityEngine.UI.Extensions
//disable the current scroll rect so it doesnt move.
_myScrollRect.enabled = false;
ParentScrollRect.OnBeginDrag(eventData);
ParentScrollSnap.OnBeginDrag(eventData);
}
}
@ -73,6 +76,7 @@ namespace UnityEngine.UI.Extensions
scrollOther = false;
_myScrollRect.enabled = true;
ParentScrollRect.OnEndDrag(eventData);
ParentScrollSnap.OnEndDrag(eventData);
}
}
@ -82,6 +86,7 @@ namespace UnityEngine.UI.Extensions
if (scrollOther)
{
ParentScrollRect.OnDrag(eventData);
ParentScrollSnap.OnDrag(eventData);
}
}
}