fix: corrected horizontal slip judgment (#8388)

This commit is contained in:
Dante
2021-03-24 07:55:48 +08:00
committed by GitHub
parent 6d428345d7
commit 507adef9b2
2 changed files with 17 additions and 4 deletions
+2 -1
View File
@@ -42,7 +42,8 @@ export function useTouch() {
const move = ((event: TouchEvent) => {
const touch = event.touches[0];
deltaX.value = touch.clientX - startX.value;
// Fix: Safari back will set clientX to negative number
deltaX.value = touch.clientX < 0 ? 0 : touch.clientX - startX.value;
deltaY.value = touch.clientY - startY.value;
offsetX.value = Math.abs(deltaX.value);
offsetY.value = Math.abs(deltaY.value);