Updated ScrollConflictManager with fix from Jared Turner #85
parent
e813cd70a9
commit
22b2ec2ec2
|
@ -14,6 +14,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 ScrollSnap ParentScrollSnap;
|
||||||
private ScrollRect _myScrollRect;
|
private ScrollRect _myScrollRect;
|
||||||
//This tracks if the other one should be scrolling instead of the current one.
|
//This tracks if the other one should be scrolling instead of the current one.
|
||||||
private bool scrollOther;
|
private bool scrollOther;
|
||||||
|
@ -54,6 +55,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
//disable the current scroll rect so it doesnt move.
|
//disable the current scroll rect so it doesnt move.
|
||||||
_myScrollRect.enabled = false;
|
_myScrollRect.enabled = false;
|
||||||
ParentScrollRect.OnBeginDrag(eventData);
|
ParentScrollRect.OnBeginDrag(eventData);
|
||||||
|
ParentScrollSnap.OnBeginDrag(eventData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vertical > horizontal)
|
else if (vertical > horizontal)
|
||||||
|
@ -62,6 +64,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
//disable the current scroll rect so it doesnt move.
|
//disable the current scroll rect so it doesnt move.
|
||||||
_myScrollRect.enabled = false;
|
_myScrollRect.enabled = false;
|
||||||
ParentScrollRect.OnBeginDrag(eventData);
|
ParentScrollRect.OnBeginDrag(eventData);
|
||||||
|
ParentScrollSnap.OnBeginDrag(eventData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +76,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
scrollOther = false;
|
scrollOther = false;
|
||||||
_myScrollRect.enabled = true;
|
_myScrollRect.enabled = true;
|
||||||
ParentScrollRect.OnEndDrag(eventData);
|
ParentScrollRect.OnEndDrag(eventData);
|
||||||
|
ParentScrollSnap.OnEndDrag(eventData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +86,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
if (scrollOther)
|
if (scrollOther)
|
||||||
{
|
{
|
||||||
ParentScrollRect.OnDrag(eventData);
|
ParentScrollRect.OnDrag(eventData);
|
||||||
|
ParentScrollSnap.OnDrag(eventData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue