Skip to content

Commit

Permalink
chore(ImagePreview): reuse isTap ref (#12536)
Browse files Browse the repository at this point in the history
  • Loading branch information
inottn committed Dec 27, 2023
1 parent 5580b1b commit 2f9f961
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/vant/src/image-preview/ImagePreviewItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
createNamespace,
makeRequiredProp,
LONG_PRESS_START_TIME,
TAP_OFFSET,
type ComponentInstance,
} from '../utils';

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 2f9f961

Please sign in to comment.