Skip to content

Commit fb4b9be

Browse files
committed
A basic remedy to issues reported as zhanziyang#167 and zhanziyang#191
1 parent 46632d9 commit fb4b9be

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/cropper.vue

+10
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,16 @@ export default {
377377
x = 1 - speed
378378
}
379379
380+
// when a new image is loaded with the same aspect ratio
381+
// as the previously remove()d one, the imgData.width and .height
382+
// effectivelly don't change (they change through one tick
383+
// and end up being the same as before the tick, so the
384+
// watchers don't trigger), make sure scaleRatio isn't null so
385+
// that zooming works...
386+
if (this.scaleRatio === null) {
387+
this.scaleRatio = this.imgData.width / this.naturalWidth
388+
}
389+
380390
this.scaleRatio *= x
381391
},
382392

0 commit comments

Comments
 (0)