#69 : Fix case, update tests

This commit is contained in:
Vadim
2021-09-10 22:17:25 +03:00
parent f03a6d0cbe
commit 8c0a1fbd4c
4 changed files with 30 additions and 27 deletions

View File

@@ -6,12 +6,10 @@ export function getNextParticleIndexLimited({
currentParticleIndex,
particlesCount,
particlesToScroll,
particlesToShow,
}) {
if (particlesCount < 1) throw new Error('particlesCount must be at least 1')
return Math.max(
currentParticleIndex + Math.min(particlesCount - (currentParticleIndex + 1) - particlesToScroll, particlesToScroll),
0
)
return getValueInRange(0, currentParticleIndex + particlesToScroll, particlesCount - particlesToShow)
}
export function getNextParticleIndexInfinte({