Skip to content

Commit

Permalink
Fix a bug about auto scrolling.
Browse files Browse the repository at this point in the history
  • Loading branch information
Haruma-K committed Jun 29, 2022
1 parent 5fab805 commit e73ac85
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Assets/FancyCarouselView/Runtime/Scripts/CarouselView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ private IEnumerator AutoScrollRoutine()
{
while (true)
{
yield return new WaitForSeconds(_autoScrollingIntervalSec);
var beforeScrollPosition = ActiveCellPosition - 1;
var afterScrollPosition = ActiveCellPosition + 1;
if (!loop)
{
beforeScrollPosition = Mathf.Max(0, beforeScrollPosition);
afterScrollPosition = Mathf.Min(DataCount - 1, afterScrollPosition);
}
yield return new WaitForSeconds(_autoScrollingIntervalSec);
var position = _inverseAutoScrollingDirection ? beforeScrollPosition : afterScrollPosition;
yield return ScrollRoutine(position, _snapAnimationDuration, _snapAnimationType);
}
Expand Down Expand Up @@ -356,4 +356,4 @@ private void DrawCellRect()

#endif
}
}
}

0 comments on commit e73ac85

Please sign in to comment.