@mixd-id/web-scaffold 0.1.230406187 → 0.1.230406188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/Carousel.vue +11 -18
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="$style.comp" @mousedown
|
|
2
|
+
<div :class="$style.comp" @mousedown="mouseDown" @touchstart.passive="mouseDown">
|
|
3
3
|
|
|
4
4
|
<div ref="inner" :class="computedContainerClass">
|
|
5
5
|
<div v-for="item in items" :class="computedItemClass">
|
|
@@ -97,7 +97,6 @@ export default{
|
|
|
97
97
|
data(){
|
|
98
98
|
return {
|
|
99
99
|
index: 0,
|
|
100
|
-
scrolling: 0,
|
|
101
100
|
timeoutId: null
|
|
102
101
|
}
|
|
103
102
|
},
|
|
@@ -195,30 +194,18 @@ export default{
|
|
|
195
194
|
},
|
|
196
195
|
|
|
197
196
|
mouseMove(e){
|
|
198
|
-
|
|
199
|
-
this.scrolling = true
|
|
200
|
-
|
|
201
197
|
const sx = typeof e.touches !== 'undefined' ? e.touches[0].clientX : e.clientX
|
|
202
198
|
const dx = sx - this._props['sx']
|
|
203
199
|
const ix = parseInt(this._props['ix'] + dx)
|
|
204
200
|
|
|
205
|
-
//console.warn('mousemove', dx, ix)
|
|
206
|
-
|
|
207
201
|
this.$el.firstElementChild.style.transform = `translate3d(${ix}px, 0, 0)`
|
|
208
202
|
},
|
|
209
203
|
|
|
210
204
|
mouseUp(e){
|
|
211
|
-
|
|
212
|
-
window.setTimeout(() => {
|
|
213
|
-
this.scrolling = false
|
|
214
|
-
}, 50)
|
|
215
|
-
|
|
216
205
|
const tn = e.timeStamp - this._props['t0']
|
|
217
206
|
const sx = typeof e.changedTouches !== 'undefined' ? e.changedTouches[0].clientX : e.clientX
|
|
218
207
|
const dx = sx - this._props['sx']
|
|
219
208
|
|
|
220
|
-
//console.warn('mouseup', tn, dx, dx)
|
|
221
|
-
|
|
222
209
|
if (Math.abs(dx) > 10) {
|
|
223
210
|
if (tn < 1200){
|
|
224
211
|
dx < 0 ? this.next(true) : this.prev(true)
|
|
@@ -242,7 +229,6 @@ export default{
|
|
|
242
229
|
},
|
|
243
230
|
|
|
244
231
|
mouseDown(e){
|
|
245
|
-
|
|
246
232
|
if(!this.items || this.items.length <= 1)
|
|
247
233
|
return
|
|
248
234
|
|
|
@@ -294,10 +280,17 @@ export default{
|
|
|
294
280
|
white-space: nowrap;
|
|
295
281
|
overflow: hidden;
|
|
296
282
|
position: relative;
|
|
297
|
-
touch-action: none;
|
|
298
283
|
background-image: v-bind(bgImages[0]);
|
|
299
284
|
}
|
|
300
285
|
|
|
286
|
+
.comp.noTouchAction{
|
|
287
|
+
touch-action: none;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.comp img{
|
|
291
|
+
pointer-events: none;
|
|
292
|
+
}
|
|
293
|
+
|
|
301
294
|
.carouselNext{
|
|
302
295
|
@apply absolute top-0 bottom-0 right-0 w-[20px];
|
|
303
296
|
}
|
|
@@ -309,14 +302,14 @@ export default{
|
|
|
309
302
|
.inner{
|
|
310
303
|
white-space: nowrap;
|
|
311
304
|
will-change: transform;
|
|
312
|
-
touch-action: none;
|
|
305
|
+
//touch-action: none;
|
|
313
306
|
@apply flex flex-row items-stretch;
|
|
314
307
|
}
|
|
315
308
|
.inner>*{
|
|
316
309
|
display: inline-block;
|
|
317
310
|
width: 100%;
|
|
318
311
|
min-width: 100%;
|
|
319
|
-
touch-action: none;
|
|
312
|
+
//touch-action: none;
|
|
320
313
|
vertical-align: top;
|
|
321
314
|
}
|
|
322
315
|
|