Skip to content

Commit d2a72d5

Browse files
committed
fix(image-preview): over height image should be scrolling always
#313
1 parent ff803a8 commit d2a72d5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/components/image-preview/image-preview.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@
7676
speed: {
7777
type: Number,
7878
default: 400
79+
},
80+
preventDefault: {
81+
type: Boolean,
82+
default: true
7983
}
8084
},
8185
data() {
@@ -88,7 +92,8 @@
8892
right: true
8993
},
9094
useTransition: !isAndroid,
91-
probeType: 3
95+
probeType: 3,
96+
preventDefault: this.preventDefault
9297
},
9398
scrollOptions: {
9499
observeDOM: false,
@@ -101,7 +106,8 @@
101106
bounce: false,
102107
click: false,
103108
dblclick: true,
104-
bounceTime: 300
109+
bounceTime: 300,
110+
preventDefault: this.preventDefault
105111
}
106112
}
107113
},
@@ -222,7 +228,7 @@
222228
})
223229
},
224230
checkBoundary(scroll, pos) {
225-
if (scroll.distX) {
231+
if (scroll.distX && Math.abs(scroll.distX) > Math.abs(scroll.distY)) {
226232
this._scrolling = true
227233
const reached = scroll.distX > 0 ? pos.x >= scroll.minScrollX : pos.x <= scroll.maxScrollX
228234
if (reached) {

0 commit comments

Comments
 (0)