#69 : Fix unit tests

This commit is contained in:
Vadim
2021-09-10 17:41:25 +03:00
parent fc14e0cab9
commit 2920d6491b
2 changed files with 216 additions and 209 deletions

View File

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