Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ImagePreview): reuse isTap ref #12536

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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