From 2f9f961bd85c495edb6c6449d8ed5307c2c6de1a Mon Sep 17 00:00:00 2001 From: inottn Date: Wed, 27 Dec 2023 20:43:02 +0800 Subject: [PATCH] chore(ImagePreview): reuse isTap ref (#12536) --- packages/vant/src/image-preview/ImagePreviewItem.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/vant/src/image-preview/ImagePreviewItem.tsx b/packages/vant/src/image-preview/ImagePreviewItem.tsx index 3bd7fde72..7ee0e852d 100644 --- a/packages/vant/src/image-preview/ImagePreviewItem.tsx +++ b/packages/vant/src/image-preview/ImagePreviewItem.tsx @@ -16,7 +16,6 @@ import { createNamespace, makeRequiredProp, LONG_PRESS_START_TIME, - TAP_OFFSET, type ComponentInstance, } from '../utils'; @@ -264,13 +263,12 @@ export default defineComponent({ return; } - const { offsetX, offsetY } = touch; const deltaTime = Date.now() - touchStartTime; // Same as the default value of iOS double tap timeout const TAP_TIME = 250; - if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) { + if (touch.isTap.value) { if (deltaTime < TAP_TIME) { // allow double to scale if (props.doubleScale) {