fix(ImagePreview): incorrectly closed after zooming (#10191)

This commit is contained in:
neverland 2022-01-15 20:06:04 +08:00 committed by GitHub
parent 6ed16c0770
commit 708c3af769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,11 +139,12 @@ export default {
this.touchStart(event);
this.touchStartTime = new Date();
this.fingerNum = touches.length;
this.startMoveX = this.moveX;
this.startMoveY = this.moveY;
this.moving = touches.length === 1 && this.scale !== 1;
this.zooming = touches.length === 2 && !offsetX;
this.moving = this.fingerNum === 1 && this.scale !== 1;
this.zooming = this.fingerNum === 2 && !offsetX;
if (this.zooming) {
this.startScale = this.scale;
@ -216,10 +217,14 @@ export default {
},
checkTap() {
if (this.fingerNum > 1) {
return;
}
const { offsetX = 0, offsetY = 0 } = this;
const deltaTime = new Date() - this.touchStartTime;
const TAP_TIME = 250;
const TAP_OFFSET = 10;
const TAP_OFFSET = 5;
if (
offsetX < TAP_OFFSET &&