@mixd-id/web-scaffold 0.1.230406188 → 0.1.230406189

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406188",
4
+ "version": "0.1.230406189",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -115,7 +115,7 @@ export default{
115
115
 
116
116
  items(){
117
117
  this.index = 0
118
- }
118
+ },
119
119
 
120
120
  },
121
121
 
@@ -195,28 +195,44 @@ export default{
195
195
 
196
196
  mouseMove(e){
197
197
  const sx = typeof e.touches !== 'undefined' ? e.touches[0].clientX : e.clientX
198
+ const sy = typeof e.touches !== 'undefined' ? e.touches[0].clientY : e.clientY
198
199
  const dx = sx - this._props['sx']
200
+ const dy = sy - this._props['sy']
199
201
  const ix = parseInt(this._props['ix'] + dx)
200
202
 
201
- this.$el.firstElementChild.style.transform = `translate3d(${ix}px, 0, 0)`
203
+ if(!this._props['direction']){
204
+ if(Math.abs(dy) > 10){
205
+ this._props['direction'] = 'vertical'
206
+ }
207
+ else if(Math.abs(dx) > 15){
208
+ this._props['direction'] = 'horizontal'
209
+ document.body.classList.add(this.$style.noScroll)
210
+ }
211
+ }
212
+ else if(this._props['direction'] === 'horizontal'){
213
+ this.$el.firstElementChild.style.transform = `translate3d(${ix}px, 0, 0)`
214
+ }
215
+
202
216
  },
203
217
 
204
218
  mouseUp(e){
205
- const tn = e.timeStamp - this._props['t0']
206
- const sx = typeof e.changedTouches !== 'undefined' ? e.changedTouches[0].clientX : e.clientX
207
- const dx = sx - this._props['sx']
208
-
209
- if (Math.abs(dx) > 10) {
210
- if (tn < 1200){
211
- dx < 0 ? this.next(true) : this.prev(true)
219
+ if(this._props['direction'] === 'horizontal'){
220
+ const tn = e.timeStamp - this._props['t0']
221
+ const sx = typeof e.changedTouches !== 'undefined' ? e.changedTouches[0].clientX : e.clientX
222
+ const dx = sx - this._props['sx']
223
+
224
+ if (Math.abs(dx) > 10) {
225
+ if (tn < 1200){
226
+ dx < 0 ? this.next(true) : this.prev(true)
227
+ }
228
+ else{
229
+ this.setPosition()
230
+ }
212
231
  }
213
232
  else{
214
233
  this.setPosition()
215
234
  }
216
235
  }
217
- else{
218
- this.setPosition()
219
- }
220
236
 
221
237
  window.removeEventListener('mousemove', this.mouseMove)
222
238
  window.removeEventListener('mouseup', this.mouseUp)
@@ -224,6 +240,8 @@ export default{
224
240
  window.removeEventListener('touchmove', this.mouseMove)
225
241
  window.removeEventListener('touchend', this.mouseUp)
226
242
 
243
+ document.body.classList.remove(this.$style.noScroll)
244
+
227
245
  if(this.autoPlay > 0)
228
246
  this.play()
229
247
  },
@@ -239,8 +257,10 @@ export default{
239
257
 
240
258
  this._props = {
241
259
  sx:typeof e.touches !== 'undefined' ? e.touches[0].clientX : e.clientX,
260
+ sy:typeof e.touches !== 'undefined' ? e.touches[0].clientY : e.clientY,
242
261
  ix:ix,
243
- t0:e.timeStamp
262
+ t0:e.timeStamp,
263
+ direction: null
244
264
  }
245
265
 
246
266
  window.addEventListener('mousemove', this.mouseMove)
@@ -281,10 +301,11 @@ export default{
281
301
  overflow: hidden;
282
302
  position: relative;
283
303
  background-image: v-bind(bgImages[0]);
304
+ /*touch-action: none;*/
284
305
  }
285
306
 
286
307
  .comp.noTouchAction{
287
- touch-action: none;
308
+ /*touch-action: none;*/
288
309
  }
289
310
 
290
311
  .comp img{
@@ -302,14 +323,12 @@ export default{
302
323
  .inner{
303
324
  white-space: nowrap;
304
325
  will-change: transform;
305
- //touch-action: none;
306
326
  @apply flex flex-row items-stretch;
307
327
  }
308
328
  .inner>*{
309
329
  display: inline-block;
310
330
  width: 100%;
311
331
  min-width: 100%;
312
- //touch-action: none;
313
332
  vertical-align: top;
314
333
  }
315
334
 
@@ -329,6 +348,10 @@ export default{
329
348
  @apply bg-primary-500;
330
349
  }
331
350
 
351
+ .noScroll{
352
+ overflow: hidden
353
+ }
354
+
332
355
  @media screen(md){
333
356
  .comp{
334
357
  background-image: v-bind(bgImages[1]);