diff --git a/src/plugins/scrollManager.js b/src/plugins/scrollManager.js index 73feb77..fa43cdf 100644 --- a/src/plugins/scrollManager.js +++ b/src/plugins/scrollManager.js @@ -96,13 +96,14 @@ function createMomentumDrag({ } catch {} } usingPointerLock = false + velocity = 0 if (samples.length) { const first = samples[0] const now = performance.now() const last = samples[samples.length - 1] const dy = last.position - first.position - velocity = (-dy * speed) / (now - first.timestamp) - } else velocity = 0 + if (Math.abs(dy) > 5) velocity = (-dy * speed) / (now - first.timestamp) + } console.log(velocity, samples) samples = [] startMomentum()