@thinkpixellab-public/px-vue 3.0.44 → 3.0.46

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.
@@ -82,7 +82,26 @@ export default {
82
82
  scrollPreview: 0,
83
83
  };
84
84
  },
85
- computed: {},
85
+ computed: {
86
+ lethargyOverrides() {
87
+ const stability = parseFloat(this.$route.query?.scrollStability);
88
+ const sensitivity = parseFloat(this.$route.query?.scrollSensitivity);
89
+ const tolerance = parseFloat(this.$route.query?.scrollTolerance);
90
+
91
+ if (stability || sensitivity || tolerance) {
92
+ console.log('[Custom scroll values enabled.]');
93
+ console.log(`stability: ${stability || 8}`);
94
+ console.log(`sensitivity: ${sensitivity || 100}`);
95
+ console.log(`tolerance: ${tolerance || 1.1}`);
96
+ return {
97
+ stability: stability || 8,
98
+ sensitivity: sensitivity || 100,
99
+ tolerance: tolerance || 1.1,
100
+ };
101
+ }
102
+ return null;
103
+ },
104
+ },
86
105
  watch: {
87
106
  syncSelected(nv, ov) {
88
107
  let newIndex = this.itemKeys.indexOf(nv);
@@ -122,6 +141,20 @@ export default {
122
141
  });
123
142
 
124
143
  if (this.scrollEnabled) {
144
+ let overrides = this.lethargyOverrides;
145
+
146
+ if (overrides) {
147
+ this.lethargy = new Lethargy(
148
+ overrides.stability,
149
+ overrides.sensitivity,
150
+ overrides.tolerance
151
+ );
152
+ } else {
153
+ this.lethargy = new Lethargy();
154
+ }
155
+
156
+ this.lethargyPrevCheck = false;
157
+
125
158
  this.$el.addEventListener('wheel', this.onWheel);
126
159
  }
127
160
  },
@@ -180,11 +213,6 @@ export default {
180
213
  },
181
214
 
182
215
  onWheel(e) {
183
- if (typeof this.lethargy == 'undefined') {
184
- this.lethargy = new Lethargy();
185
- this.lethargyPrevCheck = false;
186
- }
187
-
188
216
  if (this.scrollPreviewEnabled) {
189
217
  const delta = (e.deltaY + e.deltaX) / 2;
190
218
  if (Math.abs(delta) > 5) {
@@ -202,22 +230,25 @@ export default {
202
230
  if (check !== this.lethargyPrevCheck) {
203
231
  if (check) {
204
232
  if (check > 0) {
205
- this.previous();
233
+ this.previous(false);
206
234
  } else {
207
- this.next();
235
+ this.next(false);
208
236
  }
209
237
  }
210
238
  }
211
239
 
212
240
  this.lethargyPrevCheck = check;
241
+
242
+ e.stopPropagation();
243
+ e.preventDefault();
213
244
  },
214
245
 
215
- next() {
216
- this.selectOffsetSafe(1, this.loop);
246
+ next(loopOverride = null) {
247
+ this.selectOffsetSafe(1, loopOverride === null ? this.loop : loopOverride);
217
248
  },
218
249
 
219
- previous() {
220
- this.selectOffsetSafe(-1, this.loop);
250
+ previous(loopOverride = null) {
251
+ this.selectOffsetSafe(-1, loopOverride === null ? this.loop : loopOverride);
221
252
  },
222
253
 
223
254
  // returns the index of the item relative to the selected item, if looped
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkpixellab-public/px-vue",
3
- "version": "3.0.44",
3
+ "version": "3.0.46",
4
4
  "description": "General purpose Vue components and helpers that can be used across projects.",
5
5
  "author": "Pixel Lab",
6
6
  "license": "MIT",