Post by Mito on Nov 3, 2022 19:35:16 GMT
Hello echo17, fantastic asset!
Congratz.
[1º Problem]
While trying to perform a snapping scroll loop, I noticed that for the elements at index 0 and at index (maxLength - 1), the snapping was not considering the spacing.
So, I did this minor update to consider when the loop system is on.
Line 869 - Switched this:
To this:
[2º Problem]
So, I needed to perform a snap animation cancellation but the tween system on EnhancedScroller.TweenPosition() didn't allow that.
In to order to perform an animation cancellation I've added the code below.
Line 1030 - Switched this:
To this:
Line 2237 - Switched this:
To this:
Congratz.
[1º Problem]
While trying to perform a snapping scroll loop, I noticed that for the elements at index 0 and at index (maxLength - 1), the snapping was not considering the spacing.
So, I did this minor update to consider when the loop system is on.
Line 869 - Switched this:
if (dataIndex > 0 && dataIndex < (NumberOfCells - 1)) cellSize += spacing;
To this:
if ((dataIndex > 0 && dataIndex < NumberOfCells - 1) || loop) cellSize += spacing;
[2º Problem]
So, I needed to perform a snap animation cancellation but the tween system on EnhancedScroller.TweenPosition() didn't allow that.
In to order to perform an animation cancellation I've added the code below.
/// <summary>
/// The routine that controls the tween animation when scrolling elements
/// </summary>
public Coroutine tweenPositionCoroutine;
private void EndTween()
{
if (!IsTweening)
{
return;
}
// fire the delegate for the tween ending
IsTweening = false;
if (scrollerTweeningChanged != null) scrollerTweeningChanged(this, false);
}
public void CancelTweenPosition()
{
if (tweenPositionCoroutine != null)
{
StopCoroutine(tweenPositionCoroutine);
tweenPositionCoroutine = null;
}
EndTween();
}
Line 1030 - Switched this:
// start tweeting
StartCoroutine(TweenPosition(tweenType, tweenTime, ScrollPosition, newScrollPosition, jumpComplete, forceCalculateRange));
To this:
// start tweeting
tweenPositionCoroutine = StartCoroutine(TweenPosition(tweenType, tweenTime, ScrollPosition, newScrollPosition, jumpComplete, forceCalculateRange));
Line 2237 - Switched this:
// fire the delegate for the tween ending
IsTweening = false;
if (scrollerTweeningChanged != null) scrollerTweeningChanged(this, false);
To this:
EndTween();