Merged in daliCollu/unity-ui-extensions (pull request #36)
Issue #239 fixed. https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/issues/239/swipe-threshold-value-seems-to-be-onpull/413/head
commit
37aec29aa0
|
@ -239,7 +239,29 @@ namespace UnityEngine.UI.Extensions
|
||||||
if (_scroll_rect.horizontal)
|
if (_scroll_rect.horizontal)
|
||||||
{
|
{
|
||||||
var distance = Vector3.Distance(_startPosition, _screensContainer.localPosition);
|
var distance = Vector3.Distance(_startPosition, _screensContainer.localPosition);
|
||||||
if ((UseFastSwipe && distance < panelDimensions.width && distance >= FastSwipeThreshold) || UseHardSwipe)
|
|
||||||
|
if(UseHardSwipe){
|
||||||
|
_scroll_rect.velocity = Vector3.zero;
|
||||||
|
|
||||||
|
if (distance > FastSwipeThreshold)
|
||||||
|
{
|
||||||
|
if (_startPosition.x - _screensContainer.localPosition.x > 0)
|
||||||
|
{
|
||||||
|
NextScreen();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PreviousScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ScrollToClosestElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (UseFastSwipe && distance < panelDimensions.width && distance >= FastSwipeThreshold )
|
||||||
{
|
{
|
||||||
_scroll_rect.velocity = Vector3.zero;
|
_scroll_rect.velocity = Vector3.zero;
|
||||||
if (_startPosition.x - _screensContainer.localPosition.x > 0)
|
if (_startPosition.x - _screensContainer.localPosition.x > 0)
|
||||||
|
@ -267,6 +289,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -239,7 +239,28 @@ namespace UnityEngine.UI.Extensions
|
||||||
if (_scroll_rect.vertical)
|
if (_scroll_rect.vertical)
|
||||||
{
|
{
|
||||||
var distance = Vector3.Distance(_startPosition, _screensContainer.localPosition);
|
var distance = Vector3.Distance(_startPosition, _screensContainer.localPosition);
|
||||||
if ((UseFastSwipe && distance < panelDimensions.height + FastSwipeThreshold && distance >=1f) || UseHardSwipe)
|
if(UseHardSwipe){
|
||||||
|
_scroll_rect.velocity = Vector3.zero;
|
||||||
|
|
||||||
|
if (distance > FastSwipeThreshold)
|
||||||
|
{
|
||||||
|
if (_startPosition.y - _screensContainer.localPosition.y > 0)
|
||||||
|
{
|
||||||
|
NextScreen();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PreviousScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ScrollToClosestElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (UseFastSwipe && distance < panelDimensions.height + FastSwipeThreshold && distance >=1f)
|
||||||
{
|
{
|
||||||
_scroll_rect.velocity = Vector3.zero;
|
_scroll_rect.velocity = Vector3.zero;
|
||||||
if (_startPosition.y - _screensContainer.localPosition.y > 0)
|
if (_startPosition.y - _screensContainer.localPosition.y > 0)
|
||||||
|
@ -267,6 +288,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue