diff --git a/src/app/hooks/useInertialHorizontalScroll.ts b/src/app/hooks/useInertialHorizontalScroll.ts index bc96f50..b1a18ee 100644 --- a/src/app/hooks/useInertialHorizontalScroll.ts +++ b/src/app/hooks/useInertialHorizontalScroll.ts @@ -236,11 +236,18 @@ export function useInertialHorizontalScroll( const deltaPrimary = currentPrimary - state.startPrimary; const now = evt.timeStamp; const deltaTime = Math.max(now - state.lastTime, 1); + const hasExceededThreshold = Math.abs(deltaPrimary) >= resolvedOptions.dragThreshold; - if (Math.abs(deltaPrimary) >= resolvedOptions.dragThreshold) { + if (hasExceededThreshold) { state.moved = true; } + if (!state.moved) { + state.lastPrimary = currentPrimary; + state.lastTime = now; + return; + } + evt.preventDefault?.(); if (isHorizontal) { @@ -272,8 +279,6 @@ export function useInertialHorizontalScroll( const isHorizontal = resolvedOptions.axis === 'x'; stopInertia(); - evt.preventDefault(); - evt.stopPropagation(); state.activePointerId = evt.pointerId; state.startPrimary = isHorizontal ? evt.clientX : evt.clientY;