fix(ImagePreview): scale event param

This commit is contained in:
chenjiahan
2020-06-30 14:56:56 +08:00
committed by neverland
parent 2d89a6ed9a
commit e93bec677e
6 changed files with 32 additions and 20 deletions

View File

@@ -25,6 +25,7 @@ export default {
props: {
src: String,
active: Number,
minZoom: [Number, String],
maxZoom: [Number, String],
},
@@ -60,8 +61,7 @@ export default {
},
methods: {
startMove(event) {
this.touchStart(event);
startMove() {
this.setMaxMove();
this.moving = true;
this.startMoveX = this.moveX;
@@ -80,6 +80,9 @@ export default {
if (this.displayWidth && this.displayHeight) {
this.maxMoveX = Math.max(0, (displayWidth * scale - windowWidth) / 2);
this.maxMoveY = Math.max(0, (displayHeight * scale - windowHeight) / 2);
} else {
this.maxMoveX = 0;
this.maxMoveY = 0;
}
},
@@ -109,10 +112,11 @@ export default {
const { touches } = event;
const { offsetX = 0 } = this;
this.touchStart(event);
this.touchStartTime = new Date();
if (touches.length === 1 && this.scale !== 1) {
this.startMove(event);
this.startMove();
} else if (touches.length === 2 && !offsetX) {
this.startZoom(event);
}