From 20e3b4db1673f14fa5795e094ab0a1b2da2432c8 Mon Sep 17 00:00:00 2001 From: daisy <904492381@qq.com> Date: Wed, 22 May 2024 17:48:15 +0800 Subject: [PATCH] fix: Math.floor touch offset (#273) --- src/hooks/useMobileTouchMove.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useMobileTouchMove.ts b/src/hooks/useMobileTouchMove.ts index 7d61761..d563eb2 100644 --- a/src/hooks/useMobileTouchMove.ts +++ b/src/hooks/useMobileTouchMove.ts @@ -45,7 +45,7 @@ export default function useMobileTouchMove( } else { offsetY *= SMOOTH_PTG; } - const offset = isHorizontal ? offsetX : offsetY; + const offset = Math.floor(isHorizontal ? offsetX : offsetY); if (!callback(isHorizontal, offset, true) || Math.abs(offset) <= 0.1) { clearInterval(intervalRef.current); }