1 | import { V, c as computeRubberband } from './maths-0ab39ae9.esm.js';
|
---|
2 |
|
---|
3 | function _toPrimitive(input, hint) {
|
---|
4 | if (typeof input !== "object" || input === null) return input;
|
---|
5 | var prim = input[Symbol.toPrimitive];
|
---|
6 | if (prim !== undefined) {
|
---|
7 | var res = prim.call(input, hint || "default");
|
---|
8 | if (typeof res !== "object") return res;
|
---|
9 | throw new TypeError("@@toPrimitive must return a primitive value.");
|
---|
10 | }
|
---|
11 | return (hint === "string" ? String : Number)(input);
|
---|
12 | }
|
---|
13 |
|
---|
14 | function _toPropertyKey(arg) {
|
---|
15 | var key = _toPrimitive(arg, "string");
|
---|
16 | return typeof key === "symbol" ? key : String(key);
|
---|
17 | }
|
---|
18 |
|
---|
19 | function _defineProperty(obj, key, value) {
|
---|
20 | key = _toPropertyKey(key);
|
---|
21 | if (key in obj) {
|
---|
22 | Object.defineProperty(obj, key, {
|
---|
23 | value: value,
|
---|
24 | enumerable: true,
|
---|
25 | configurable: true,
|
---|
26 | writable: true
|
---|
27 | });
|
---|
28 | } else {
|
---|
29 | obj[key] = value;
|
---|
30 | }
|
---|
31 | return obj;
|
---|
32 | }
|
---|
33 |
|
---|
34 | function ownKeys(e, r) {
|
---|
35 | var t = Object.keys(e);
|
---|
36 | if (Object.getOwnPropertySymbols) {
|
---|
37 | var o = Object.getOwnPropertySymbols(e);
|
---|
38 | r && (o = o.filter(function (r) {
|
---|
39 | return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
---|
40 | })), t.push.apply(t, o);
|
---|
41 | }
|
---|
42 | return t;
|
---|
43 | }
|
---|
44 | function _objectSpread2(e) {
|
---|
45 | for (var r = 1; r < arguments.length; r++) {
|
---|
46 | var t = null != arguments[r] ? arguments[r] : {};
|
---|
47 | r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
---|
48 | _defineProperty(e, r, t[r]);
|
---|
49 | }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
---|
50 | Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
---|
51 | });
|
---|
52 | }
|
---|
53 | return e;
|
---|
54 | }
|
---|
55 |
|
---|
56 | const EVENT_TYPE_MAP = {
|
---|
57 | pointer: {
|
---|
58 | start: 'down',
|
---|
59 | change: 'move',
|
---|
60 | end: 'up'
|
---|
61 | },
|
---|
62 | mouse: {
|
---|
63 | start: 'down',
|
---|
64 | change: 'move',
|
---|
65 | end: 'up'
|
---|
66 | },
|
---|
67 | touch: {
|
---|
68 | start: 'start',
|
---|
69 | change: 'move',
|
---|
70 | end: 'end'
|
---|
71 | },
|
---|
72 | gesture: {
|
---|
73 | start: 'start',
|
---|
74 | change: 'change',
|
---|
75 | end: 'end'
|
---|
76 | }
|
---|
77 | };
|
---|
78 | function capitalize(string) {
|
---|
79 | if (!string) return '';
|
---|
80 | return string[0].toUpperCase() + string.slice(1);
|
---|
81 | }
|
---|
82 | const actionsWithoutCaptureSupported = ['enter', 'leave'];
|
---|
83 | function hasCapture(capture = false, actionKey) {
|
---|
84 | return capture && !actionsWithoutCaptureSupported.includes(actionKey);
|
---|
85 | }
|
---|
86 | function toHandlerProp(device, action = '', capture = false) {
|
---|
87 | const deviceProps = EVENT_TYPE_MAP[device];
|
---|
88 | const actionKey = deviceProps ? deviceProps[action] || action : action;
|
---|
89 | return 'on' + capitalize(device) + capitalize(actionKey) + (hasCapture(capture, actionKey) ? 'Capture' : '');
|
---|
90 | }
|
---|
91 | const pointerCaptureEvents = ['gotpointercapture', 'lostpointercapture'];
|
---|
92 | function parseProp(prop) {
|
---|
93 | let eventKey = prop.substring(2).toLowerCase();
|
---|
94 | const passive = !!~eventKey.indexOf('passive');
|
---|
95 | if (passive) eventKey = eventKey.replace('passive', '');
|
---|
96 | const captureKey = pointerCaptureEvents.includes(eventKey) ? 'capturecapture' : 'capture';
|
---|
97 | const capture = !!~eventKey.indexOf(captureKey);
|
---|
98 | if (capture) eventKey = eventKey.replace('capture', '');
|
---|
99 | return {
|
---|
100 | device: eventKey,
|
---|
101 | capture,
|
---|
102 | passive
|
---|
103 | };
|
---|
104 | }
|
---|
105 | function toDomEventType(device, action = '') {
|
---|
106 | const deviceProps = EVENT_TYPE_MAP[device];
|
---|
107 | const actionKey = deviceProps ? deviceProps[action] || action : action;
|
---|
108 | return device + actionKey;
|
---|
109 | }
|
---|
110 | function isTouch(event) {
|
---|
111 | return 'touches' in event;
|
---|
112 | }
|
---|
113 | function getPointerType(event) {
|
---|
114 | if (isTouch(event)) return 'touch';
|
---|
115 | if ('pointerType' in event) return event.pointerType;
|
---|
116 | return 'mouse';
|
---|
117 | }
|
---|
118 | function getCurrentTargetTouchList(event) {
|
---|
119 | return Array.from(event.touches).filter(e => {
|
---|
120 | var _event$currentTarget, _event$currentTarget$;
|
---|
121 | return e.target === event.currentTarget || ((_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 || (_event$currentTarget$ = _event$currentTarget.contains) === null || _event$currentTarget$ === void 0 ? void 0 : _event$currentTarget$.call(_event$currentTarget, e.target));
|
---|
122 | });
|
---|
123 | }
|
---|
124 | function getTouchList(event) {
|
---|
125 | return event.type === 'touchend' || event.type === 'touchcancel' ? event.changedTouches : event.targetTouches;
|
---|
126 | }
|
---|
127 | function getValueEvent(event) {
|
---|
128 | return isTouch(event) ? getTouchList(event)[0] : event;
|
---|
129 | }
|
---|
130 | function distanceAngle(P1, P2) {
|
---|
131 | try {
|
---|
132 | const dx = P2.clientX - P1.clientX;
|
---|
133 | const dy = P2.clientY - P1.clientY;
|
---|
134 | const cx = (P2.clientX + P1.clientX) / 2;
|
---|
135 | const cy = (P2.clientY + P1.clientY) / 2;
|
---|
136 | const distance = Math.hypot(dx, dy);
|
---|
137 | const angle = -(Math.atan2(dx, dy) * 180) / Math.PI;
|
---|
138 | const origin = [cx, cy];
|
---|
139 | return {
|
---|
140 | angle,
|
---|
141 | distance,
|
---|
142 | origin
|
---|
143 | };
|
---|
144 | } catch (_unused) {}
|
---|
145 | return null;
|
---|
146 | }
|
---|
147 | function touchIds(event) {
|
---|
148 | return getCurrentTargetTouchList(event).map(touch => touch.identifier);
|
---|
149 | }
|
---|
150 | function touchDistanceAngle(event, ids) {
|
---|
151 | const [P1, P2] = Array.from(event.touches).filter(touch => ids.includes(touch.identifier));
|
---|
152 | return distanceAngle(P1, P2);
|
---|
153 | }
|
---|
154 | function pointerId(event) {
|
---|
155 | const valueEvent = getValueEvent(event);
|
---|
156 | return isTouch(event) ? valueEvent.identifier : valueEvent.pointerId;
|
---|
157 | }
|
---|
158 | function pointerValues(event) {
|
---|
159 | const valueEvent = getValueEvent(event);
|
---|
160 | return [valueEvent.clientX, valueEvent.clientY];
|
---|
161 | }
|
---|
162 | const LINE_HEIGHT = 40;
|
---|
163 | const PAGE_HEIGHT = 800;
|
---|
164 | function wheelValues(event) {
|
---|
165 | let {
|
---|
166 | deltaX,
|
---|
167 | deltaY,
|
---|
168 | deltaMode
|
---|
169 | } = event;
|
---|
170 | if (deltaMode === 1) {
|
---|
171 | deltaX *= LINE_HEIGHT;
|
---|
172 | deltaY *= LINE_HEIGHT;
|
---|
173 | } else if (deltaMode === 2) {
|
---|
174 | deltaX *= PAGE_HEIGHT;
|
---|
175 | deltaY *= PAGE_HEIGHT;
|
---|
176 | }
|
---|
177 | return [deltaX, deltaY];
|
---|
178 | }
|
---|
179 | function scrollValues(event) {
|
---|
180 | var _ref, _ref2;
|
---|
181 | const {
|
---|
182 | scrollX,
|
---|
183 | scrollY,
|
---|
184 | scrollLeft,
|
---|
185 | scrollTop
|
---|
186 | } = event.currentTarget;
|
---|
187 | return [(_ref = scrollX !== null && scrollX !== void 0 ? scrollX : scrollLeft) !== null && _ref !== void 0 ? _ref : 0, (_ref2 = scrollY !== null && scrollY !== void 0 ? scrollY : scrollTop) !== null && _ref2 !== void 0 ? _ref2 : 0];
|
---|
188 | }
|
---|
189 | function getEventDetails(event) {
|
---|
190 | const payload = {};
|
---|
191 | if ('buttons' in event) payload.buttons = event.buttons;
|
---|
192 | if ('shiftKey' in event) {
|
---|
193 | const {
|
---|
194 | shiftKey,
|
---|
195 | altKey,
|
---|
196 | metaKey,
|
---|
197 | ctrlKey
|
---|
198 | } = event;
|
---|
199 | Object.assign(payload, {
|
---|
200 | shiftKey,
|
---|
201 | altKey,
|
---|
202 | metaKey,
|
---|
203 | ctrlKey
|
---|
204 | });
|
---|
205 | }
|
---|
206 | return payload;
|
---|
207 | }
|
---|
208 |
|
---|
209 | function call(v, ...args) {
|
---|
210 | if (typeof v === 'function') {
|
---|
211 | return v(...args);
|
---|
212 | } else {
|
---|
213 | return v;
|
---|
214 | }
|
---|
215 | }
|
---|
216 | function noop() {}
|
---|
217 | function chain(...fns) {
|
---|
218 | if (fns.length === 0) return noop;
|
---|
219 | if (fns.length === 1) return fns[0];
|
---|
220 | return function () {
|
---|
221 | let result;
|
---|
222 | for (const fn of fns) {
|
---|
223 | result = fn.apply(this, arguments) || result;
|
---|
224 | }
|
---|
225 | return result;
|
---|
226 | };
|
---|
227 | }
|
---|
228 | function assignDefault(value, fallback) {
|
---|
229 | return Object.assign({}, fallback, value || {});
|
---|
230 | }
|
---|
231 |
|
---|
232 | const BEFORE_LAST_KINEMATICS_DELAY = 32;
|
---|
233 | class Engine {
|
---|
234 | constructor(ctrl, args, key) {
|
---|
235 | this.ctrl = ctrl;
|
---|
236 | this.args = args;
|
---|
237 | this.key = key;
|
---|
238 | if (!this.state) {
|
---|
239 | this.state = {};
|
---|
240 | this.computeValues([0, 0]);
|
---|
241 | this.computeInitial();
|
---|
242 | if (this.init) this.init();
|
---|
243 | this.reset();
|
---|
244 | }
|
---|
245 | }
|
---|
246 | get state() {
|
---|
247 | return this.ctrl.state[this.key];
|
---|
248 | }
|
---|
249 | set state(state) {
|
---|
250 | this.ctrl.state[this.key] = state;
|
---|
251 | }
|
---|
252 | get shared() {
|
---|
253 | return this.ctrl.state.shared;
|
---|
254 | }
|
---|
255 | get eventStore() {
|
---|
256 | return this.ctrl.gestureEventStores[this.key];
|
---|
257 | }
|
---|
258 | get timeoutStore() {
|
---|
259 | return this.ctrl.gestureTimeoutStores[this.key];
|
---|
260 | }
|
---|
261 | get config() {
|
---|
262 | return this.ctrl.config[this.key];
|
---|
263 | }
|
---|
264 | get sharedConfig() {
|
---|
265 | return this.ctrl.config.shared;
|
---|
266 | }
|
---|
267 | get handler() {
|
---|
268 | return this.ctrl.handlers[this.key];
|
---|
269 | }
|
---|
270 | reset() {
|
---|
271 | const {
|
---|
272 | state,
|
---|
273 | shared,
|
---|
274 | ingKey,
|
---|
275 | args
|
---|
276 | } = this;
|
---|
277 | shared[ingKey] = state._active = state.active = state._blocked = state._force = false;
|
---|
278 | state._step = [false, false];
|
---|
279 | state.intentional = false;
|
---|
280 | state._movement = [0, 0];
|
---|
281 | state._distance = [0, 0];
|
---|
282 | state._direction = [0, 0];
|
---|
283 | state._delta = [0, 0];
|
---|
284 | state._bounds = [[-Infinity, Infinity], [-Infinity, Infinity]];
|
---|
285 | state.args = args;
|
---|
286 | state.axis = undefined;
|
---|
287 | state.memo = undefined;
|
---|
288 | state.elapsedTime = state.timeDelta = 0;
|
---|
289 | state.direction = [0, 0];
|
---|
290 | state.distance = [0, 0];
|
---|
291 | state.overflow = [0, 0];
|
---|
292 | state._movementBound = [false, false];
|
---|
293 | state.velocity = [0, 0];
|
---|
294 | state.movement = [0, 0];
|
---|
295 | state.delta = [0, 0];
|
---|
296 | state.timeStamp = 0;
|
---|
297 | }
|
---|
298 | start(event) {
|
---|
299 | const state = this.state;
|
---|
300 | const config = this.config;
|
---|
301 | if (!state._active) {
|
---|
302 | this.reset();
|
---|
303 | this.computeInitial();
|
---|
304 | state._active = true;
|
---|
305 | state.target = event.target;
|
---|
306 | state.currentTarget = event.currentTarget;
|
---|
307 | state.lastOffset = config.from ? call(config.from, state) : state.offset;
|
---|
308 | state.offset = state.lastOffset;
|
---|
309 | state.startTime = state.timeStamp = event.timeStamp;
|
---|
310 | }
|
---|
311 | }
|
---|
312 | computeValues(values) {
|
---|
313 | const state = this.state;
|
---|
314 | state._values = values;
|
---|
315 | state.values = this.config.transform(values);
|
---|
316 | }
|
---|
317 | computeInitial() {
|
---|
318 | const state = this.state;
|
---|
319 | state._initial = state._values;
|
---|
320 | state.initial = state.values;
|
---|
321 | }
|
---|
322 | compute(event) {
|
---|
323 | const {
|
---|
324 | state,
|
---|
325 | config,
|
---|
326 | shared
|
---|
327 | } = this;
|
---|
328 | state.args = this.args;
|
---|
329 | let dt = 0;
|
---|
330 | if (event) {
|
---|
331 | state.event = event;
|
---|
332 | if (config.preventDefault && event.cancelable) state.event.preventDefault();
|
---|
333 | state.type = event.type;
|
---|
334 | shared.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size;
|
---|
335 | shared.locked = !!document.pointerLockElement;
|
---|
336 | Object.assign(shared, getEventDetails(event));
|
---|
337 | shared.down = shared.pressed = shared.buttons % 2 === 1 || shared.touches > 0;
|
---|
338 | dt = event.timeStamp - state.timeStamp;
|
---|
339 | state.timeStamp = event.timeStamp;
|
---|
340 | state.elapsedTime = state.timeStamp - state.startTime;
|
---|
341 | }
|
---|
342 | if (state._active) {
|
---|
343 | const _absoluteDelta = state._delta.map(Math.abs);
|
---|
344 | V.addTo(state._distance, _absoluteDelta);
|
---|
345 | }
|
---|
346 | if (this.axisIntent) this.axisIntent(event);
|
---|
347 | const [_m0, _m1] = state._movement;
|
---|
348 | const [t0, t1] = config.threshold;
|
---|
349 | const {
|
---|
350 | _step,
|
---|
351 | values
|
---|
352 | } = state;
|
---|
353 | if (config.hasCustomTransform) {
|
---|
354 | if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && values[0];
|
---|
355 | if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && values[1];
|
---|
356 | } else {
|
---|
357 | if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && Math.sign(_m0) * t0;
|
---|
358 | if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && Math.sign(_m1) * t1;
|
---|
359 | }
|
---|
360 | state.intentional = _step[0] !== false || _step[1] !== false;
|
---|
361 | if (!state.intentional) return;
|
---|
362 | const movement = [0, 0];
|
---|
363 | if (config.hasCustomTransform) {
|
---|
364 | const [v0, v1] = values;
|
---|
365 | movement[0] = _step[0] !== false ? v0 - _step[0] : 0;
|
---|
366 | movement[1] = _step[1] !== false ? v1 - _step[1] : 0;
|
---|
367 | } else {
|
---|
368 | movement[0] = _step[0] !== false ? _m0 - _step[0] : 0;
|
---|
369 | movement[1] = _step[1] !== false ? _m1 - _step[1] : 0;
|
---|
370 | }
|
---|
371 | if (this.restrictToAxis && !state._blocked) this.restrictToAxis(movement);
|
---|
372 | const previousOffset = state.offset;
|
---|
373 | const gestureIsActive = state._active && !state._blocked || state.active;
|
---|
374 | if (gestureIsActive) {
|
---|
375 | state.first = state._active && !state.active;
|
---|
376 | state.last = !state._active && state.active;
|
---|
377 | state.active = shared[this.ingKey] = state._active;
|
---|
378 | if (event) {
|
---|
379 | if (state.first) {
|
---|
380 | if ('bounds' in config) state._bounds = call(config.bounds, state);
|
---|
381 | if (this.setup) this.setup();
|
---|
382 | }
|
---|
383 | state.movement = movement;
|
---|
384 | this.computeOffset();
|
---|
385 | }
|
---|
386 | }
|
---|
387 | const [ox, oy] = state.offset;
|
---|
388 | const [[x0, x1], [y0, y1]] = state._bounds;
|
---|
389 | state.overflow = [ox < x0 ? -1 : ox > x1 ? 1 : 0, oy < y0 ? -1 : oy > y1 ? 1 : 0];
|
---|
390 | state._movementBound[0] = state.overflow[0] ? state._movementBound[0] === false ? state._movement[0] : state._movementBound[0] : false;
|
---|
391 | state._movementBound[1] = state.overflow[1] ? state._movementBound[1] === false ? state._movement[1] : state._movementBound[1] : false;
|
---|
392 | const rubberband = state._active ? config.rubberband || [0, 0] : [0, 0];
|
---|
393 | state.offset = computeRubberband(state._bounds, state.offset, rubberband);
|
---|
394 | state.delta = V.sub(state.offset, previousOffset);
|
---|
395 | this.computeMovement();
|
---|
396 | if (gestureIsActive && (!state.last || dt > BEFORE_LAST_KINEMATICS_DELAY)) {
|
---|
397 | state.delta = V.sub(state.offset, previousOffset);
|
---|
398 | const absoluteDelta = state.delta.map(Math.abs);
|
---|
399 | V.addTo(state.distance, absoluteDelta);
|
---|
400 | state.direction = state.delta.map(Math.sign);
|
---|
401 | state._direction = state._delta.map(Math.sign);
|
---|
402 | if (!state.first && dt > 0) {
|
---|
403 | state.velocity = [absoluteDelta[0] / dt, absoluteDelta[1] / dt];
|
---|
404 | state.timeDelta = dt;
|
---|
405 | }
|
---|
406 | }
|
---|
407 | }
|
---|
408 | emit() {
|
---|
409 | const state = this.state;
|
---|
410 | const shared = this.shared;
|
---|
411 | const config = this.config;
|
---|
412 | if (!state._active) this.clean();
|
---|
413 | if ((state._blocked || !state.intentional) && !state._force && !config.triggerAllEvents) return;
|
---|
414 | const memo = this.handler(_objectSpread2(_objectSpread2(_objectSpread2({}, shared), state), {}, {
|
---|
415 | [this.aliasKey]: state.values
|
---|
416 | }));
|
---|
417 | if (memo !== undefined) state.memo = memo;
|
---|
418 | }
|
---|
419 | clean() {
|
---|
420 | this.eventStore.clean();
|
---|
421 | this.timeoutStore.clean();
|
---|
422 | }
|
---|
423 | }
|
---|
424 |
|
---|
425 | function selectAxis([dx, dy], threshold) {
|
---|
426 | const absDx = Math.abs(dx);
|
---|
427 | const absDy = Math.abs(dy);
|
---|
428 | if (absDx > absDy && absDx > threshold) {
|
---|
429 | return 'x';
|
---|
430 | }
|
---|
431 | if (absDy > absDx && absDy > threshold) {
|
---|
432 | return 'y';
|
---|
433 | }
|
---|
434 | return undefined;
|
---|
435 | }
|
---|
436 | class CoordinatesEngine extends Engine {
|
---|
437 | constructor(...args) {
|
---|
438 | super(...args);
|
---|
439 | _defineProperty(this, "aliasKey", 'xy');
|
---|
440 | }
|
---|
441 | reset() {
|
---|
442 | super.reset();
|
---|
443 | this.state.axis = undefined;
|
---|
444 | }
|
---|
445 | init() {
|
---|
446 | this.state.offset = [0, 0];
|
---|
447 | this.state.lastOffset = [0, 0];
|
---|
448 | }
|
---|
449 | computeOffset() {
|
---|
450 | this.state.offset = V.add(this.state.lastOffset, this.state.movement);
|
---|
451 | }
|
---|
452 | computeMovement() {
|
---|
453 | this.state.movement = V.sub(this.state.offset, this.state.lastOffset);
|
---|
454 | }
|
---|
455 | axisIntent(event) {
|
---|
456 | const state = this.state;
|
---|
457 | const config = this.config;
|
---|
458 | if (!state.axis && event) {
|
---|
459 | const threshold = typeof config.axisThreshold === 'object' ? config.axisThreshold[getPointerType(event)] : config.axisThreshold;
|
---|
460 | state.axis = selectAxis(state._movement, threshold);
|
---|
461 | }
|
---|
462 | state._blocked = (config.lockDirection || !!config.axis) && !state.axis || !!config.axis && config.axis !== state.axis;
|
---|
463 | }
|
---|
464 | restrictToAxis(v) {
|
---|
465 | if (this.config.axis || this.config.lockDirection) {
|
---|
466 | switch (this.state.axis) {
|
---|
467 | case 'x':
|
---|
468 | v[1] = 0;
|
---|
469 | break;
|
---|
470 | case 'y':
|
---|
471 | v[0] = 0;
|
---|
472 | break;
|
---|
473 | }
|
---|
474 | }
|
---|
475 | }
|
---|
476 | }
|
---|
477 |
|
---|
478 | const identity = v => v;
|
---|
479 | const DEFAULT_RUBBERBAND = 0.15;
|
---|
480 | const commonConfigResolver = {
|
---|
481 | enabled(value = true) {
|
---|
482 | return value;
|
---|
483 | },
|
---|
484 | eventOptions(value, _k, config) {
|
---|
485 | return _objectSpread2(_objectSpread2({}, config.shared.eventOptions), value);
|
---|
486 | },
|
---|
487 | preventDefault(value = false) {
|
---|
488 | return value;
|
---|
489 | },
|
---|
490 | triggerAllEvents(value = false) {
|
---|
491 | return value;
|
---|
492 | },
|
---|
493 | rubberband(value = 0) {
|
---|
494 | switch (value) {
|
---|
495 | case true:
|
---|
496 | return [DEFAULT_RUBBERBAND, DEFAULT_RUBBERBAND];
|
---|
497 | case false:
|
---|
498 | return [0, 0];
|
---|
499 | default:
|
---|
500 | return V.toVector(value);
|
---|
501 | }
|
---|
502 | },
|
---|
503 | from(value) {
|
---|
504 | if (typeof value === 'function') return value;
|
---|
505 | if (value != null) return V.toVector(value);
|
---|
506 | },
|
---|
507 | transform(value, _k, config) {
|
---|
508 | const transform = value || config.shared.transform;
|
---|
509 | this.hasCustomTransform = !!transform;
|
---|
510 | if (process.env.NODE_ENV === 'development') {
|
---|
511 | const originalTransform = transform || identity;
|
---|
512 | return v => {
|
---|
513 | const r = originalTransform(v);
|
---|
514 | if (!isFinite(r[0]) || !isFinite(r[1])) {
|
---|
515 | console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${r[0]},${[1]}]`);
|
---|
516 | }
|
---|
517 | return r;
|
---|
518 | };
|
---|
519 | }
|
---|
520 | return transform || identity;
|
---|
521 | },
|
---|
522 | threshold(value) {
|
---|
523 | return V.toVector(value, 0);
|
---|
524 | }
|
---|
525 | };
|
---|
526 | if (process.env.NODE_ENV === 'development') {
|
---|
527 | Object.assign(commonConfigResolver, {
|
---|
528 | domTarget(value) {
|
---|
529 | if (value !== undefined) {
|
---|
530 | throw Error(`[@use-gesture]: \`domTarget\` option has been renamed to \`target\`.`);
|
---|
531 | }
|
---|
532 | return NaN;
|
---|
533 | },
|
---|
534 | lockDirection(value) {
|
---|
535 | if (value !== undefined) {
|
---|
536 | throw Error(`[@use-gesture]: \`lockDirection\` option has been merged with \`axis\`. Use it as in \`{ axis: 'lock' }\``);
|
---|
537 | }
|
---|
538 | return NaN;
|
---|
539 | },
|
---|
540 | initial(value) {
|
---|
541 | if (value !== undefined) {
|
---|
542 | throw Error(`[@use-gesture]: \`initial\` option has been renamed to \`from\`.`);
|
---|
543 | }
|
---|
544 | return NaN;
|
---|
545 | }
|
---|
546 | });
|
---|
547 | }
|
---|
548 |
|
---|
549 | const DEFAULT_AXIS_THRESHOLD = 0;
|
---|
550 | const coordinatesConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, {
|
---|
551 | axis(_v, _k, {
|
---|
552 | axis
|
---|
553 | }) {
|
---|
554 | this.lockDirection = axis === 'lock';
|
---|
555 | if (!this.lockDirection) return axis;
|
---|
556 | },
|
---|
557 | axisThreshold(value = DEFAULT_AXIS_THRESHOLD) {
|
---|
558 | return value;
|
---|
559 | },
|
---|
560 | bounds(value = {}) {
|
---|
561 | if (typeof value === 'function') {
|
---|
562 | return state => coordinatesConfigResolver.bounds(value(state));
|
---|
563 | }
|
---|
564 | if ('current' in value) {
|
---|
565 | return () => value.current;
|
---|
566 | }
|
---|
567 | if (typeof HTMLElement === 'function' && value instanceof HTMLElement) {
|
---|
568 | return value;
|
---|
569 | }
|
---|
570 | const {
|
---|
571 | left = -Infinity,
|
---|
572 | right = Infinity,
|
---|
573 | top = -Infinity,
|
---|
574 | bottom = Infinity
|
---|
575 | } = value;
|
---|
576 | return [[left, right], [top, bottom]];
|
---|
577 | }
|
---|
578 | });
|
---|
579 |
|
---|
580 | const KEYS_DELTA_MAP = {
|
---|
581 | ArrowRight: (displacement, factor = 1) => [displacement * factor, 0],
|
---|
582 | ArrowLeft: (displacement, factor = 1) => [-1 * displacement * factor, 0],
|
---|
583 | ArrowUp: (displacement, factor = 1) => [0, -1 * displacement * factor],
|
---|
584 | ArrowDown: (displacement, factor = 1) => [0, displacement * factor]
|
---|
585 | };
|
---|
586 | class DragEngine extends CoordinatesEngine {
|
---|
587 | constructor(...args) {
|
---|
588 | super(...args);
|
---|
589 | _defineProperty(this, "ingKey", 'dragging');
|
---|
590 | }
|
---|
591 | reset() {
|
---|
592 | super.reset();
|
---|
593 | const state = this.state;
|
---|
594 | state._pointerId = undefined;
|
---|
595 | state._pointerActive = false;
|
---|
596 | state._keyboardActive = false;
|
---|
597 | state._preventScroll = false;
|
---|
598 | state._delayed = false;
|
---|
599 | state.swipe = [0, 0];
|
---|
600 | state.tap = false;
|
---|
601 | state.canceled = false;
|
---|
602 | state.cancel = this.cancel.bind(this);
|
---|
603 | }
|
---|
604 | setup() {
|
---|
605 | const state = this.state;
|
---|
606 | if (state._bounds instanceof HTMLElement) {
|
---|
607 | const boundRect = state._bounds.getBoundingClientRect();
|
---|
608 | const targetRect = state.currentTarget.getBoundingClientRect();
|
---|
609 | const _bounds = {
|
---|
610 | left: boundRect.left - targetRect.left + state.offset[0],
|
---|
611 | right: boundRect.right - targetRect.right + state.offset[0],
|
---|
612 | top: boundRect.top - targetRect.top + state.offset[1],
|
---|
613 | bottom: boundRect.bottom - targetRect.bottom + state.offset[1]
|
---|
614 | };
|
---|
615 | state._bounds = coordinatesConfigResolver.bounds(_bounds);
|
---|
616 | }
|
---|
617 | }
|
---|
618 | cancel() {
|
---|
619 | const state = this.state;
|
---|
620 | if (state.canceled) return;
|
---|
621 | state.canceled = true;
|
---|
622 | state._active = false;
|
---|
623 | setTimeout(() => {
|
---|
624 | this.compute();
|
---|
625 | this.emit();
|
---|
626 | }, 0);
|
---|
627 | }
|
---|
628 | setActive() {
|
---|
629 | this.state._active = this.state._pointerActive || this.state._keyboardActive;
|
---|
630 | }
|
---|
631 | clean() {
|
---|
632 | this.pointerClean();
|
---|
633 | this.state._pointerActive = false;
|
---|
634 | this.state._keyboardActive = false;
|
---|
635 | super.clean();
|
---|
636 | }
|
---|
637 | pointerDown(event) {
|
---|
638 | const config = this.config;
|
---|
639 | const state = this.state;
|
---|
640 | if (event.buttons != null && (Array.isArray(config.pointerButtons) ? !config.pointerButtons.includes(event.buttons) : config.pointerButtons !== -1 && config.pointerButtons !== event.buttons)) return;
|
---|
641 | const ctrlIds = this.ctrl.setEventIds(event);
|
---|
642 | if (config.pointerCapture) {
|
---|
643 | event.target.setPointerCapture(event.pointerId);
|
---|
644 | }
|
---|
645 | if (ctrlIds && ctrlIds.size > 1 && state._pointerActive) return;
|
---|
646 | this.start(event);
|
---|
647 | this.setupPointer(event);
|
---|
648 | state._pointerId = pointerId(event);
|
---|
649 | state._pointerActive = true;
|
---|
650 | this.computeValues(pointerValues(event));
|
---|
651 | this.computeInitial();
|
---|
652 | if (config.preventScrollAxis && getPointerType(event) !== 'mouse') {
|
---|
653 | state._active = false;
|
---|
654 | this.setupScrollPrevention(event);
|
---|
655 | } else if (config.delay > 0) {
|
---|
656 | this.setupDelayTrigger(event);
|
---|
657 | if (config.triggerAllEvents) {
|
---|
658 | this.compute(event);
|
---|
659 | this.emit();
|
---|
660 | }
|
---|
661 | } else {
|
---|
662 | this.startPointerDrag(event);
|
---|
663 | }
|
---|
664 | }
|
---|
665 | startPointerDrag(event) {
|
---|
666 | const state = this.state;
|
---|
667 | state._active = true;
|
---|
668 | state._preventScroll = true;
|
---|
669 | state._delayed = false;
|
---|
670 | this.compute(event);
|
---|
671 | this.emit();
|
---|
672 | }
|
---|
673 | pointerMove(event) {
|
---|
674 | const state = this.state;
|
---|
675 | const config = this.config;
|
---|
676 | if (!state._pointerActive) return;
|
---|
677 | const id = pointerId(event);
|
---|
678 | if (state._pointerId !== undefined && id !== state._pointerId) return;
|
---|
679 | const _values = pointerValues(event);
|
---|
680 | if (document.pointerLockElement === event.target) {
|
---|
681 | state._delta = [event.movementX, event.movementY];
|
---|
682 | } else {
|
---|
683 | state._delta = V.sub(_values, state._values);
|
---|
684 | this.computeValues(_values);
|
---|
685 | }
|
---|
686 | V.addTo(state._movement, state._delta);
|
---|
687 | this.compute(event);
|
---|
688 | if (state._delayed && state.intentional) {
|
---|
689 | this.timeoutStore.remove('dragDelay');
|
---|
690 | state.active = false;
|
---|
691 | this.startPointerDrag(event);
|
---|
692 | return;
|
---|
693 | }
|
---|
694 | if (config.preventScrollAxis && !state._preventScroll) {
|
---|
695 | if (state.axis) {
|
---|
696 | if (state.axis === config.preventScrollAxis || config.preventScrollAxis === 'xy') {
|
---|
697 | state._active = false;
|
---|
698 | this.clean();
|
---|
699 | return;
|
---|
700 | } else {
|
---|
701 | this.timeoutStore.remove('startPointerDrag');
|
---|
702 | this.startPointerDrag(event);
|
---|
703 | return;
|
---|
704 | }
|
---|
705 | } else {
|
---|
706 | return;
|
---|
707 | }
|
---|
708 | }
|
---|
709 | this.emit();
|
---|
710 | }
|
---|
711 | pointerUp(event) {
|
---|
712 | this.ctrl.setEventIds(event);
|
---|
713 | try {
|
---|
714 | if (this.config.pointerCapture && event.target.hasPointerCapture(event.pointerId)) {
|
---|
715 | ;
|
---|
716 | event.target.releasePointerCapture(event.pointerId);
|
---|
717 | }
|
---|
718 | } catch (_unused) {
|
---|
719 | if (process.env.NODE_ENV === 'development') {
|
---|
720 | console.warn(`[@use-gesture]: If you see this message, it's likely that you're using an outdated version of \`@react-three/fiber\`. \n\nPlease upgrade to the latest version.`);
|
---|
721 | }
|
---|
722 | }
|
---|
723 | const state = this.state;
|
---|
724 | const config = this.config;
|
---|
725 | if (!state._active || !state._pointerActive) return;
|
---|
726 | const id = pointerId(event);
|
---|
727 | if (state._pointerId !== undefined && id !== state._pointerId) return;
|
---|
728 | this.state._pointerActive = false;
|
---|
729 | this.setActive();
|
---|
730 | this.compute(event);
|
---|
731 | const [dx, dy] = state._distance;
|
---|
732 | state.tap = dx <= config.tapsThreshold && dy <= config.tapsThreshold;
|
---|
733 | if (state.tap && config.filterTaps) {
|
---|
734 | state._force = true;
|
---|
735 | } else {
|
---|
736 | const [_dx, _dy] = state._delta;
|
---|
737 | const [_mx, _my] = state._movement;
|
---|
738 | const [svx, svy] = config.swipe.velocity;
|
---|
739 | const [sx, sy] = config.swipe.distance;
|
---|
740 | const sdt = config.swipe.duration;
|
---|
741 | if (state.elapsedTime < sdt) {
|
---|
742 | const _vx = Math.abs(_dx / state.timeDelta);
|
---|
743 | const _vy = Math.abs(_dy / state.timeDelta);
|
---|
744 | if (_vx > svx && Math.abs(_mx) > sx) state.swipe[0] = Math.sign(_dx);
|
---|
745 | if (_vy > svy && Math.abs(_my) > sy) state.swipe[1] = Math.sign(_dy);
|
---|
746 | }
|
---|
747 | }
|
---|
748 | this.emit();
|
---|
749 | }
|
---|
750 | pointerClick(event) {
|
---|
751 | if (!this.state.tap && event.detail > 0) {
|
---|
752 | event.preventDefault();
|
---|
753 | event.stopPropagation();
|
---|
754 | }
|
---|
755 | }
|
---|
756 | setupPointer(event) {
|
---|
757 | const config = this.config;
|
---|
758 | const device = config.device;
|
---|
759 | if (process.env.NODE_ENV === 'development') {
|
---|
760 | try {
|
---|
761 | if (device === 'pointer' && config.preventScrollDelay === undefined) {
|
---|
762 | const currentTarget = 'uv' in event ? event.sourceEvent.currentTarget : event.currentTarget;
|
---|
763 | const style = window.getComputedStyle(currentTarget);
|
---|
764 | if (style.touchAction === 'auto') {
|
---|
765 | console.warn(`[@use-gesture]: The drag target has its \`touch-action\` style property set to \`auto\`. It is recommended to add \`touch-action: 'none'\` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.`, currentTarget);
|
---|
766 | }
|
---|
767 | }
|
---|
768 | } catch (_unused2) {}
|
---|
769 | }
|
---|
770 | if (config.pointerLock) {
|
---|
771 | event.currentTarget.requestPointerLock();
|
---|
772 | }
|
---|
773 | if (!config.pointerCapture) {
|
---|
774 | this.eventStore.add(this.sharedConfig.window, device, 'change', this.pointerMove.bind(this));
|
---|
775 | this.eventStore.add(this.sharedConfig.window, device, 'end', this.pointerUp.bind(this));
|
---|
776 | this.eventStore.add(this.sharedConfig.window, device, 'cancel', this.pointerUp.bind(this));
|
---|
777 | }
|
---|
778 | }
|
---|
779 | pointerClean() {
|
---|
780 | if (this.config.pointerLock && document.pointerLockElement === this.state.currentTarget) {
|
---|
781 | document.exitPointerLock();
|
---|
782 | }
|
---|
783 | }
|
---|
784 | preventScroll(event) {
|
---|
785 | if (this.state._preventScroll && event.cancelable) {
|
---|
786 | event.preventDefault();
|
---|
787 | }
|
---|
788 | }
|
---|
789 | setupScrollPrevention(event) {
|
---|
790 | this.state._preventScroll = false;
|
---|
791 | persistEvent(event);
|
---|
792 | const remove = this.eventStore.add(this.sharedConfig.window, 'touch', 'change', this.preventScroll.bind(this), {
|
---|
793 | passive: false
|
---|
794 | });
|
---|
795 | this.eventStore.add(this.sharedConfig.window, 'touch', 'end', remove);
|
---|
796 | this.eventStore.add(this.sharedConfig.window, 'touch', 'cancel', remove);
|
---|
797 | this.timeoutStore.add('startPointerDrag', this.startPointerDrag.bind(this), this.config.preventScrollDelay, event);
|
---|
798 | }
|
---|
799 | setupDelayTrigger(event) {
|
---|
800 | this.state._delayed = true;
|
---|
801 | this.timeoutStore.add('dragDelay', () => {
|
---|
802 | this.state._step = [0, 0];
|
---|
803 | this.startPointerDrag(event);
|
---|
804 | }, this.config.delay);
|
---|
805 | }
|
---|
806 | keyDown(event) {
|
---|
807 | const deltaFn = KEYS_DELTA_MAP[event.key];
|
---|
808 | if (deltaFn) {
|
---|
809 | const state = this.state;
|
---|
810 | const factor = event.shiftKey ? 10 : event.altKey ? 0.1 : 1;
|
---|
811 | this.start(event);
|
---|
812 | state._delta = deltaFn(this.config.keyboardDisplacement, factor);
|
---|
813 | state._keyboardActive = true;
|
---|
814 | V.addTo(state._movement, state._delta);
|
---|
815 | this.compute(event);
|
---|
816 | this.emit();
|
---|
817 | }
|
---|
818 | }
|
---|
819 | keyUp(event) {
|
---|
820 | if (!(event.key in KEYS_DELTA_MAP)) return;
|
---|
821 | this.state._keyboardActive = false;
|
---|
822 | this.setActive();
|
---|
823 | this.compute(event);
|
---|
824 | this.emit();
|
---|
825 | }
|
---|
826 | bind(bindFunction) {
|
---|
827 | const device = this.config.device;
|
---|
828 | bindFunction(device, 'start', this.pointerDown.bind(this));
|
---|
829 | if (this.config.pointerCapture) {
|
---|
830 | bindFunction(device, 'change', this.pointerMove.bind(this));
|
---|
831 | bindFunction(device, 'end', this.pointerUp.bind(this));
|
---|
832 | bindFunction(device, 'cancel', this.pointerUp.bind(this));
|
---|
833 | bindFunction('lostPointerCapture', '', this.pointerUp.bind(this));
|
---|
834 | }
|
---|
835 | if (this.config.keys) {
|
---|
836 | bindFunction('key', 'down', this.keyDown.bind(this));
|
---|
837 | bindFunction('key', 'up', this.keyUp.bind(this));
|
---|
838 | }
|
---|
839 | if (this.config.filterTaps) {
|
---|
840 | bindFunction('click', '', this.pointerClick.bind(this), {
|
---|
841 | capture: true,
|
---|
842 | passive: false
|
---|
843 | });
|
---|
844 | }
|
---|
845 | }
|
---|
846 | }
|
---|
847 | function persistEvent(event) {
|
---|
848 | 'persist' in event && typeof event.persist === 'function' && event.persist();
|
---|
849 | }
|
---|
850 |
|
---|
851 | const isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;
|
---|
852 | function supportsTouchEvents() {
|
---|
853 | return isBrowser && 'ontouchstart' in window;
|
---|
854 | }
|
---|
855 | function isTouchScreen() {
|
---|
856 | return supportsTouchEvents() || isBrowser && window.navigator.maxTouchPoints > 1;
|
---|
857 | }
|
---|
858 | function supportsPointerEvents() {
|
---|
859 | return isBrowser && 'onpointerdown' in window;
|
---|
860 | }
|
---|
861 | function supportsPointerLock() {
|
---|
862 | return isBrowser && 'exitPointerLock' in window.document;
|
---|
863 | }
|
---|
864 | function supportsGestureEvents() {
|
---|
865 | try {
|
---|
866 | return 'constructor' in GestureEvent;
|
---|
867 | } catch (e) {
|
---|
868 | return false;
|
---|
869 | }
|
---|
870 | }
|
---|
871 | const SUPPORT = {
|
---|
872 | isBrowser,
|
---|
873 | gesture: supportsGestureEvents(),
|
---|
874 | touch: supportsTouchEvents(),
|
---|
875 | touchscreen: isTouchScreen(),
|
---|
876 | pointer: supportsPointerEvents(),
|
---|
877 | pointerLock: supportsPointerLock()
|
---|
878 | };
|
---|
879 |
|
---|
880 | const DEFAULT_PREVENT_SCROLL_DELAY = 250;
|
---|
881 | const DEFAULT_DRAG_DELAY = 180;
|
---|
882 | const DEFAULT_SWIPE_VELOCITY = 0.5;
|
---|
883 | const DEFAULT_SWIPE_DISTANCE = 50;
|
---|
884 | const DEFAULT_SWIPE_DURATION = 250;
|
---|
885 | const DEFAULT_KEYBOARD_DISPLACEMENT = 10;
|
---|
886 | const DEFAULT_DRAG_AXIS_THRESHOLD = {
|
---|
887 | mouse: 0,
|
---|
888 | touch: 0,
|
---|
889 | pen: 8
|
---|
890 | };
|
---|
891 | const dragConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {
|
---|
892 | device(_v, _k, {
|
---|
893 | pointer: {
|
---|
894 | touch = false,
|
---|
895 | lock = false,
|
---|
896 | mouse = false
|
---|
897 | } = {}
|
---|
898 | }) {
|
---|
899 | this.pointerLock = lock && SUPPORT.pointerLock;
|
---|
900 | if (SUPPORT.touch && touch) return 'touch';
|
---|
901 | if (this.pointerLock) return 'mouse';
|
---|
902 | if (SUPPORT.pointer && !mouse) return 'pointer';
|
---|
903 | if (SUPPORT.touch) return 'touch';
|
---|
904 | return 'mouse';
|
---|
905 | },
|
---|
906 | preventScrollAxis(value, _k, {
|
---|
907 | preventScroll
|
---|
908 | }) {
|
---|
909 | this.preventScrollDelay = typeof preventScroll === 'number' ? preventScroll : preventScroll || preventScroll === undefined && value ? DEFAULT_PREVENT_SCROLL_DELAY : undefined;
|
---|
910 | if (!SUPPORT.touchscreen || preventScroll === false) return undefined;
|
---|
911 | return value ? value : preventScroll !== undefined ? 'y' : undefined;
|
---|
912 | },
|
---|
913 | pointerCapture(_v, _k, {
|
---|
914 | pointer: {
|
---|
915 | capture = true,
|
---|
916 | buttons = 1,
|
---|
917 | keys = true
|
---|
918 | } = {}
|
---|
919 | }) {
|
---|
920 | this.pointerButtons = buttons;
|
---|
921 | this.keys = keys;
|
---|
922 | return !this.pointerLock && this.device === 'pointer' && capture;
|
---|
923 | },
|
---|
924 | threshold(value, _k, {
|
---|
925 | filterTaps = false,
|
---|
926 | tapsThreshold = 3,
|
---|
927 | axis = undefined
|
---|
928 | }) {
|
---|
929 | const threshold = V.toVector(value, filterTaps ? tapsThreshold : axis ? 1 : 0);
|
---|
930 | this.filterTaps = filterTaps;
|
---|
931 | this.tapsThreshold = tapsThreshold;
|
---|
932 | return threshold;
|
---|
933 | },
|
---|
934 | swipe({
|
---|
935 | velocity = DEFAULT_SWIPE_VELOCITY,
|
---|
936 | distance = DEFAULT_SWIPE_DISTANCE,
|
---|
937 | duration = DEFAULT_SWIPE_DURATION
|
---|
938 | } = {}) {
|
---|
939 | return {
|
---|
940 | velocity: this.transform(V.toVector(velocity)),
|
---|
941 | distance: this.transform(V.toVector(distance)),
|
---|
942 | duration
|
---|
943 | };
|
---|
944 | },
|
---|
945 | delay(value = 0) {
|
---|
946 | switch (value) {
|
---|
947 | case true:
|
---|
948 | return DEFAULT_DRAG_DELAY;
|
---|
949 | case false:
|
---|
950 | return 0;
|
---|
951 | default:
|
---|
952 | return value;
|
---|
953 | }
|
---|
954 | },
|
---|
955 | axisThreshold(value) {
|
---|
956 | if (!value) return DEFAULT_DRAG_AXIS_THRESHOLD;
|
---|
957 | return _objectSpread2(_objectSpread2({}, DEFAULT_DRAG_AXIS_THRESHOLD), value);
|
---|
958 | },
|
---|
959 | keyboardDisplacement(value = DEFAULT_KEYBOARD_DISPLACEMENT) {
|
---|
960 | return value;
|
---|
961 | }
|
---|
962 | });
|
---|
963 | if (process.env.NODE_ENV === 'development') {
|
---|
964 | Object.assign(dragConfigResolver, {
|
---|
965 | useTouch(value) {
|
---|
966 | if (value !== undefined) {
|
---|
967 | throw Error(`[@use-gesture]: \`useTouch\` option has been renamed to \`pointer.touch\`. Use it as in \`{ pointer: { touch: true } }\`.`);
|
---|
968 | }
|
---|
969 | return NaN;
|
---|
970 | },
|
---|
971 | experimental_preventWindowScrollY(value) {
|
---|
972 | if (value !== undefined) {
|
---|
973 | throw Error(`[@use-gesture]: \`experimental_preventWindowScrollY\` option has been renamed to \`preventScroll\`.`);
|
---|
974 | }
|
---|
975 | return NaN;
|
---|
976 | },
|
---|
977 | swipeVelocity(value) {
|
---|
978 | if (value !== undefined) {
|
---|
979 | throw Error(`[@use-gesture]: \`swipeVelocity\` option has been renamed to \`swipe.velocity\`. Use it as in \`{ swipe: { velocity: 0.5 } }\`.`);
|
---|
980 | }
|
---|
981 | return NaN;
|
---|
982 | },
|
---|
983 | swipeDistance(value) {
|
---|
984 | if (value !== undefined) {
|
---|
985 | throw Error(`[@use-gesture]: \`swipeDistance\` option has been renamed to \`swipe.distance\`. Use it as in \`{ swipe: { distance: 50 } }\`.`);
|
---|
986 | }
|
---|
987 | return NaN;
|
---|
988 | },
|
---|
989 | swipeDuration(value) {
|
---|
990 | if (value !== undefined) {
|
---|
991 | throw Error(`[@use-gesture]: \`swipeDuration\` option has been renamed to \`swipe.duration\`. Use it as in \`{ swipe: { duration: 250 } }\`.`);
|
---|
992 | }
|
---|
993 | return NaN;
|
---|
994 | }
|
---|
995 | });
|
---|
996 | }
|
---|
997 |
|
---|
998 | function clampStateInternalMovementToBounds(state) {
|
---|
999 | const [ox, oy] = state.overflow;
|
---|
1000 | const [dx, dy] = state._delta;
|
---|
1001 | const [dirx, diry] = state._direction;
|
---|
1002 | if (ox < 0 && dx > 0 && dirx < 0 || ox > 0 && dx < 0 && dirx > 0) {
|
---|
1003 | state._movement[0] = state._movementBound[0];
|
---|
1004 | }
|
---|
1005 | if (oy < 0 && dy > 0 && diry < 0 || oy > 0 && dy < 0 && diry > 0) {
|
---|
1006 | state._movement[1] = state._movementBound[1];
|
---|
1007 | }
|
---|
1008 | }
|
---|
1009 |
|
---|
1010 | const SCALE_ANGLE_RATIO_INTENT_DEG = 30;
|
---|
1011 | const PINCH_WHEEL_RATIO = 100;
|
---|
1012 | class PinchEngine extends Engine {
|
---|
1013 | constructor(...args) {
|
---|
1014 | super(...args);
|
---|
1015 | _defineProperty(this, "ingKey", 'pinching');
|
---|
1016 | _defineProperty(this, "aliasKey", 'da');
|
---|
1017 | }
|
---|
1018 | init() {
|
---|
1019 | this.state.offset = [1, 0];
|
---|
1020 | this.state.lastOffset = [1, 0];
|
---|
1021 | this.state._pointerEvents = new Map();
|
---|
1022 | }
|
---|
1023 | reset() {
|
---|
1024 | super.reset();
|
---|
1025 | const state = this.state;
|
---|
1026 | state._touchIds = [];
|
---|
1027 | state.canceled = false;
|
---|
1028 | state.cancel = this.cancel.bind(this);
|
---|
1029 | state.turns = 0;
|
---|
1030 | }
|
---|
1031 | computeOffset() {
|
---|
1032 | const {
|
---|
1033 | type,
|
---|
1034 | movement,
|
---|
1035 | lastOffset
|
---|
1036 | } = this.state;
|
---|
1037 | if (type === 'wheel') {
|
---|
1038 | this.state.offset = V.add(movement, lastOffset);
|
---|
1039 | } else {
|
---|
1040 | this.state.offset = [(1 + movement[0]) * lastOffset[0], movement[1] + lastOffset[1]];
|
---|
1041 | }
|
---|
1042 | }
|
---|
1043 | computeMovement() {
|
---|
1044 | const {
|
---|
1045 | offset,
|
---|
1046 | lastOffset
|
---|
1047 | } = this.state;
|
---|
1048 | this.state.movement = [offset[0] / lastOffset[0], offset[1] - lastOffset[1]];
|
---|
1049 | }
|
---|
1050 | axisIntent() {
|
---|
1051 | const state = this.state;
|
---|
1052 | const [_m0, _m1] = state._movement;
|
---|
1053 | if (!state.axis) {
|
---|
1054 | const axisMovementDifference = Math.abs(_m0) * SCALE_ANGLE_RATIO_INTENT_DEG - Math.abs(_m1);
|
---|
1055 | if (axisMovementDifference < 0) state.axis = 'angle';else if (axisMovementDifference > 0) state.axis = 'scale';
|
---|
1056 | }
|
---|
1057 | }
|
---|
1058 | restrictToAxis(v) {
|
---|
1059 | if (this.config.lockDirection) {
|
---|
1060 | if (this.state.axis === 'scale') v[1] = 0;else if (this.state.axis === 'angle') v[0] = 0;
|
---|
1061 | }
|
---|
1062 | }
|
---|
1063 | cancel() {
|
---|
1064 | const state = this.state;
|
---|
1065 | if (state.canceled) return;
|
---|
1066 | setTimeout(() => {
|
---|
1067 | state.canceled = true;
|
---|
1068 | state._active = false;
|
---|
1069 | this.compute();
|
---|
1070 | this.emit();
|
---|
1071 | }, 0);
|
---|
1072 | }
|
---|
1073 | touchStart(event) {
|
---|
1074 | this.ctrl.setEventIds(event);
|
---|
1075 | const state = this.state;
|
---|
1076 | const ctrlTouchIds = this.ctrl.touchIds;
|
---|
1077 | if (state._active) {
|
---|
1078 | if (state._touchIds.every(id => ctrlTouchIds.has(id))) return;
|
---|
1079 | }
|
---|
1080 | if (ctrlTouchIds.size < 2) return;
|
---|
1081 | this.start(event);
|
---|
1082 | state._touchIds = Array.from(ctrlTouchIds).slice(0, 2);
|
---|
1083 | const payload = touchDistanceAngle(event, state._touchIds);
|
---|
1084 | if (!payload) return;
|
---|
1085 | this.pinchStart(event, payload);
|
---|
1086 | }
|
---|
1087 | pointerStart(event) {
|
---|
1088 | if (event.buttons != null && event.buttons % 2 !== 1) return;
|
---|
1089 | this.ctrl.setEventIds(event);
|
---|
1090 | event.target.setPointerCapture(event.pointerId);
|
---|
1091 | const state = this.state;
|
---|
1092 | const _pointerEvents = state._pointerEvents;
|
---|
1093 | const ctrlPointerIds = this.ctrl.pointerIds;
|
---|
1094 | if (state._active) {
|
---|
1095 | if (Array.from(_pointerEvents.keys()).every(id => ctrlPointerIds.has(id))) return;
|
---|
1096 | }
|
---|
1097 | if (_pointerEvents.size < 2) {
|
---|
1098 | _pointerEvents.set(event.pointerId, event);
|
---|
1099 | }
|
---|
1100 | if (state._pointerEvents.size < 2) return;
|
---|
1101 | this.start(event);
|
---|
1102 | const payload = distanceAngle(...Array.from(_pointerEvents.values()));
|
---|
1103 | if (!payload) return;
|
---|
1104 | this.pinchStart(event, payload);
|
---|
1105 | }
|
---|
1106 | pinchStart(event, payload) {
|
---|
1107 | const state = this.state;
|
---|
1108 | state.origin = payload.origin;
|
---|
1109 | this.computeValues([payload.distance, payload.angle]);
|
---|
1110 | this.computeInitial();
|
---|
1111 | this.compute(event);
|
---|
1112 | this.emit();
|
---|
1113 | }
|
---|
1114 | touchMove(event) {
|
---|
1115 | if (!this.state._active) return;
|
---|
1116 | const payload = touchDistanceAngle(event, this.state._touchIds);
|
---|
1117 | if (!payload) return;
|
---|
1118 | this.pinchMove(event, payload);
|
---|
1119 | }
|
---|
1120 | pointerMove(event) {
|
---|
1121 | const _pointerEvents = this.state._pointerEvents;
|
---|
1122 | if (_pointerEvents.has(event.pointerId)) {
|
---|
1123 | _pointerEvents.set(event.pointerId, event);
|
---|
1124 | }
|
---|
1125 | if (!this.state._active) return;
|
---|
1126 | const payload = distanceAngle(...Array.from(_pointerEvents.values()));
|
---|
1127 | if (!payload) return;
|
---|
1128 | this.pinchMove(event, payload);
|
---|
1129 | }
|
---|
1130 | pinchMove(event, payload) {
|
---|
1131 | const state = this.state;
|
---|
1132 | const prev_a = state._values[1];
|
---|
1133 | const delta_a = payload.angle - prev_a;
|
---|
1134 | let delta_turns = 0;
|
---|
1135 | if (Math.abs(delta_a) > 270) delta_turns += Math.sign(delta_a);
|
---|
1136 | this.computeValues([payload.distance, payload.angle - 360 * delta_turns]);
|
---|
1137 | state.origin = payload.origin;
|
---|
1138 | state.turns = delta_turns;
|
---|
1139 | state._movement = [state._values[0] / state._initial[0] - 1, state._values[1] - state._initial[1]];
|
---|
1140 | this.compute(event);
|
---|
1141 | this.emit();
|
---|
1142 | }
|
---|
1143 | touchEnd(event) {
|
---|
1144 | this.ctrl.setEventIds(event);
|
---|
1145 | if (!this.state._active) return;
|
---|
1146 | if (this.state._touchIds.some(id => !this.ctrl.touchIds.has(id))) {
|
---|
1147 | this.state._active = false;
|
---|
1148 | this.compute(event);
|
---|
1149 | this.emit();
|
---|
1150 | }
|
---|
1151 | }
|
---|
1152 | pointerEnd(event) {
|
---|
1153 | const state = this.state;
|
---|
1154 | this.ctrl.setEventIds(event);
|
---|
1155 | try {
|
---|
1156 | event.target.releasePointerCapture(event.pointerId);
|
---|
1157 | } catch (_unused) {}
|
---|
1158 | if (state._pointerEvents.has(event.pointerId)) {
|
---|
1159 | state._pointerEvents.delete(event.pointerId);
|
---|
1160 | }
|
---|
1161 | if (!state._active) return;
|
---|
1162 | if (state._pointerEvents.size < 2) {
|
---|
1163 | state._active = false;
|
---|
1164 | this.compute(event);
|
---|
1165 | this.emit();
|
---|
1166 | }
|
---|
1167 | }
|
---|
1168 | gestureStart(event) {
|
---|
1169 | if (event.cancelable) event.preventDefault();
|
---|
1170 | const state = this.state;
|
---|
1171 | if (state._active) return;
|
---|
1172 | this.start(event);
|
---|
1173 | this.computeValues([event.scale, event.rotation]);
|
---|
1174 | state.origin = [event.clientX, event.clientY];
|
---|
1175 | this.compute(event);
|
---|
1176 | this.emit();
|
---|
1177 | }
|
---|
1178 | gestureMove(event) {
|
---|
1179 | if (event.cancelable) event.preventDefault();
|
---|
1180 | if (!this.state._active) return;
|
---|
1181 | const state = this.state;
|
---|
1182 | this.computeValues([event.scale, event.rotation]);
|
---|
1183 | state.origin = [event.clientX, event.clientY];
|
---|
1184 | const _previousMovement = state._movement;
|
---|
1185 | state._movement = [event.scale - 1, event.rotation];
|
---|
1186 | state._delta = V.sub(state._movement, _previousMovement);
|
---|
1187 | this.compute(event);
|
---|
1188 | this.emit();
|
---|
1189 | }
|
---|
1190 | gestureEnd(event) {
|
---|
1191 | if (!this.state._active) return;
|
---|
1192 | this.state._active = false;
|
---|
1193 | this.compute(event);
|
---|
1194 | this.emit();
|
---|
1195 | }
|
---|
1196 | wheel(event) {
|
---|
1197 | const modifierKey = this.config.modifierKey;
|
---|
1198 | if (modifierKey && (Array.isArray(modifierKey) ? !modifierKey.find(k => event[k]) : !event[modifierKey])) return;
|
---|
1199 | if (!this.state._active) this.wheelStart(event);else this.wheelChange(event);
|
---|
1200 | this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));
|
---|
1201 | }
|
---|
1202 | wheelStart(event) {
|
---|
1203 | this.start(event);
|
---|
1204 | this.wheelChange(event);
|
---|
1205 | }
|
---|
1206 | wheelChange(event) {
|
---|
1207 | const isR3f = ('uv' in event);
|
---|
1208 | if (!isR3f) {
|
---|
1209 | if (event.cancelable) {
|
---|
1210 | event.preventDefault();
|
---|
1211 | }
|
---|
1212 | if (process.env.NODE_ENV === 'development' && !event.defaultPrevented) {
|
---|
1213 | console.warn(`[@use-gesture]: To properly support zoom on trackpads, try using the \`target\` option.\n\nThis message will only appear in development mode.`);
|
---|
1214 | }
|
---|
1215 | }
|
---|
1216 | const state = this.state;
|
---|
1217 | state._delta = [-wheelValues(event)[1] / PINCH_WHEEL_RATIO * state.offset[0], 0];
|
---|
1218 | V.addTo(state._movement, state._delta);
|
---|
1219 | clampStateInternalMovementToBounds(state);
|
---|
1220 | this.state.origin = [event.clientX, event.clientY];
|
---|
1221 | this.compute(event);
|
---|
1222 | this.emit();
|
---|
1223 | }
|
---|
1224 | wheelEnd() {
|
---|
1225 | if (!this.state._active) return;
|
---|
1226 | this.state._active = false;
|
---|
1227 | this.compute();
|
---|
1228 | this.emit();
|
---|
1229 | }
|
---|
1230 | bind(bindFunction) {
|
---|
1231 | const device = this.config.device;
|
---|
1232 | if (!!device) {
|
---|
1233 | bindFunction(device, 'start', this[device + 'Start'].bind(this));
|
---|
1234 | bindFunction(device, 'change', this[device + 'Move'].bind(this));
|
---|
1235 | bindFunction(device, 'end', this[device + 'End'].bind(this));
|
---|
1236 | bindFunction(device, 'cancel', this[device + 'End'].bind(this));
|
---|
1237 | bindFunction('lostPointerCapture', '', this[device + 'End'].bind(this));
|
---|
1238 | }
|
---|
1239 | if (this.config.pinchOnWheel) {
|
---|
1240 | bindFunction('wheel', '', this.wheel.bind(this), {
|
---|
1241 | passive: false
|
---|
1242 | });
|
---|
1243 | }
|
---|
1244 | }
|
---|
1245 | }
|
---|
1246 |
|
---|
1247 | const pinchConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, {
|
---|
1248 | device(_v, _k, {
|
---|
1249 | shared,
|
---|
1250 | pointer: {
|
---|
1251 | touch = false
|
---|
1252 | } = {}
|
---|
1253 | }) {
|
---|
1254 | const sharedConfig = shared;
|
---|
1255 | if (sharedConfig.target && !SUPPORT.touch && SUPPORT.gesture) return 'gesture';
|
---|
1256 | if (SUPPORT.touch && touch) return 'touch';
|
---|
1257 | if (SUPPORT.touchscreen) {
|
---|
1258 | if (SUPPORT.pointer) return 'pointer';
|
---|
1259 | if (SUPPORT.touch) return 'touch';
|
---|
1260 | }
|
---|
1261 | },
|
---|
1262 | bounds(_v, _k, {
|
---|
1263 | scaleBounds = {},
|
---|
1264 | angleBounds = {}
|
---|
1265 | }) {
|
---|
1266 | const _scaleBounds = state => {
|
---|
1267 | const D = assignDefault(call(scaleBounds, state), {
|
---|
1268 | min: -Infinity,
|
---|
1269 | max: Infinity
|
---|
1270 | });
|
---|
1271 | return [D.min, D.max];
|
---|
1272 | };
|
---|
1273 | const _angleBounds = state => {
|
---|
1274 | const A = assignDefault(call(angleBounds, state), {
|
---|
1275 | min: -Infinity,
|
---|
1276 | max: Infinity
|
---|
1277 | });
|
---|
1278 | return [A.min, A.max];
|
---|
1279 | };
|
---|
1280 | if (typeof scaleBounds !== 'function' && typeof angleBounds !== 'function') return [_scaleBounds(), _angleBounds()];
|
---|
1281 | return state => [_scaleBounds(state), _angleBounds(state)];
|
---|
1282 | },
|
---|
1283 | threshold(value, _k, config) {
|
---|
1284 | this.lockDirection = config.axis === 'lock';
|
---|
1285 | const threshold = V.toVector(value, this.lockDirection ? [0.1, 3] : 0);
|
---|
1286 | return threshold;
|
---|
1287 | },
|
---|
1288 | modifierKey(value) {
|
---|
1289 | if (value === undefined) return 'ctrlKey';
|
---|
1290 | return value;
|
---|
1291 | },
|
---|
1292 | pinchOnWheel(value = true) {
|
---|
1293 | return value;
|
---|
1294 | }
|
---|
1295 | });
|
---|
1296 |
|
---|
1297 | class MoveEngine extends CoordinatesEngine {
|
---|
1298 | constructor(...args) {
|
---|
1299 | super(...args);
|
---|
1300 | _defineProperty(this, "ingKey", 'moving');
|
---|
1301 | }
|
---|
1302 | move(event) {
|
---|
1303 | if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
|
---|
1304 | if (!this.state._active) this.moveStart(event);else this.moveChange(event);
|
---|
1305 | this.timeoutStore.add('moveEnd', this.moveEnd.bind(this));
|
---|
1306 | }
|
---|
1307 | moveStart(event) {
|
---|
1308 | this.start(event);
|
---|
1309 | this.computeValues(pointerValues(event));
|
---|
1310 | this.compute(event);
|
---|
1311 | this.computeInitial();
|
---|
1312 | this.emit();
|
---|
1313 | }
|
---|
1314 | moveChange(event) {
|
---|
1315 | if (!this.state._active) return;
|
---|
1316 | const values = pointerValues(event);
|
---|
1317 | const state = this.state;
|
---|
1318 | state._delta = V.sub(values, state._values);
|
---|
1319 | V.addTo(state._movement, state._delta);
|
---|
1320 | this.computeValues(values);
|
---|
1321 | this.compute(event);
|
---|
1322 | this.emit();
|
---|
1323 | }
|
---|
1324 | moveEnd(event) {
|
---|
1325 | if (!this.state._active) return;
|
---|
1326 | this.state._active = false;
|
---|
1327 | this.compute(event);
|
---|
1328 | this.emit();
|
---|
1329 | }
|
---|
1330 | bind(bindFunction) {
|
---|
1331 | bindFunction('pointer', 'change', this.move.bind(this));
|
---|
1332 | bindFunction('pointer', 'leave', this.moveEnd.bind(this));
|
---|
1333 | }
|
---|
1334 | }
|
---|
1335 |
|
---|
1336 | const moveConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {
|
---|
1337 | mouseOnly: (value = true) => value
|
---|
1338 | });
|
---|
1339 |
|
---|
1340 | class ScrollEngine extends CoordinatesEngine {
|
---|
1341 | constructor(...args) {
|
---|
1342 | super(...args);
|
---|
1343 | _defineProperty(this, "ingKey", 'scrolling');
|
---|
1344 | }
|
---|
1345 | scroll(event) {
|
---|
1346 | if (!this.state._active) this.start(event);
|
---|
1347 | this.scrollChange(event);
|
---|
1348 | this.timeoutStore.add('scrollEnd', this.scrollEnd.bind(this));
|
---|
1349 | }
|
---|
1350 | scrollChange(event) {
|
---|
1351 | if (event.cancelable) event.preventDefault();
|
---|
1352 | const state = this.state;
|
---|
1353 | const values = scrollValues(event);
|
---|
1354 | state._delta = V.sub(values, state._values);
|
---|
1355 | V.addTo(state._movement, state._delta);
|
---|
1356 | this.computeValues(values);
|
---|
1357 | this.compute(event);
|
---|
1358 | this.emit();
|
---|
1359 | }
|
---|
1360 | scrollEnd() {
|
---|
1361 | if (!this.state._active) return;
|
---|
1362 | this.state._active = false;
|
---|
1363 | this.compute();
|
---|
1364 | this.emit();
|
---|
1365 | }
|
---|
1366 | bind(bindFunction) {
|
---|
1367 | bindFunction('scroll', '', this.scroll.bind(this));
|
---|
1368 | }
|
---|
1369 | }
|
---|
1370 |
|
---|
1371 | const scrollConfigResolver = coordinatesConfigResolver;
|
---|
1372 |
|
---|
1373 | class WheelEngine extends CoordinatesEngine {
|
---|
1374 | constructor(...args) {
|
---|
1375 | super(...args);
|
---|
1376 | _defineProperty(this, "ingKey", 'wheeling');
|
---|
1377 | }
|
---|
1378 | wheel(event) {
|
---|
1379 | if (!this.state._active) this.start(event);
|
---|
1380 | this.wheelChange(event);
|
---|
1381 | this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));
|
---|
1382 | }
|
---|
1383 | wheelChange(event) {
|
---|
1384 | const state = this.state;
|
---|
1385 | state._delta = wheelValues(event);
|
---|
1386 | V.addTo(state._movement, state._delta);
|
---|
1387 | clampStateInternalMovementToBounds(state);
|
---|
1388 | this.compute(event);
|
---|
1389 | this.emit();
|
---|
1390 | }
|
---|
1391 | wheelEnd() {
|
---|
1392 | if (!this.state._active) return;
|
---|
1393 | this.state._active = false;
|
---|
1394 | this.compute();
|
---|
1395 | this.emit();
|
---|
1396 | }
|
---|
1397 | bind(bindFunction) {
|
---|
1398 | bindFunction('wheel', '', this.wheel.bind(this));
|
---|
1399 | }
|
---|
1400 | }
|
---|
1401 |
|
---|
1402 | const wheelConfigResolver = coordinatesConfigResolver;
|
---|
1403 |
|
---|
1404 | class HoverEngine extends CoordinatesEngine {
|
---|
1405 | constructor(...args) {
|
---|
1406 | super(...args);
|
---|
1407 | _defineProperty(this, "ingKey", 'hovering');
|
---|
1408 | }
|
---|
1409 | enter(event) {
|
---|
1410 | if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
|
---|
1411 | this.start(event);
|
---|
1412 | this.computeValues(pointerValues(event));
|
---|
1413 | this.compute(event);
|
---|
1414 | this.emit();
|
---|
1415 | }
|
---|
1416 | leave(event) {
|
---|
1417 | if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
|
---|
1418 | const state = this.state;
|
---|
1419 | if (!state._active) return;
|
---|
1420 | state._active = false;
|
---|
1421 | const values = pointerValues(event);
|
---|
1422 | state._movement = state._delta = V.sub(values, state._values);
|
---|
1423 | this.computeValues(values);
|
---|
1424 | this.compute(event);
|
---|
1425 | state.delta = state.movement;
|
---|
1426 | this.emit();
|
---|
1427 | }
|
---|
1428 | bind(bindFunction) {
|
---|
1429 | bindFunction('pointer', 'enter', this.enter.bind(this));
|
---|
1430 | bindFunction('pointer', 'leave', this.leave.bind(this));
|
---|
1431 | }
|
---|
1432 | }
|
---|
1433 |
|
---|
1434 | const hoverConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {
|
---|
1435 | mouseOnly: (value = true) => value
|
---|
1436 | });
|
---|
1437 |
|
---|
1438 | const EngineMap = new Map();
|
---|
1439 | const ConfigResolverMap = new Map();
|
---|
1440 | function registerAction(action) {
|
---|
1441 | EngineMap.set(action.key, action.engine);
|
---|
1442 | ConfigResolverMap.set(action.key, action.resolver);
|
---|
1443 | }
|
---|
1444 | const dragAction = {
|
---|
1445 | key: 'drag',
|
---|
1446 | engine: DragEngine,
|
---|
1447 | resolver: dragConfigResolver
|
---|
1448 | };
|
---|
1449 | const hoverAction = {
|
---|
1450 | key: 'hover',
|
---|
1451 | engine: HoverEngine,
|
---|
1452 | resolver: hoverConfigResolver
|
---|
1453 | };
|
---|
1454 | const moveAction = {
|
---|
1455 | key: 'move',
|
---|
1456 | engine: MoveEngine,
|
---|
1457 | resolver: moveConfigResolver
|
---|
1458 | };
|
---|
1459 | const pinchAction = {
|
---|
1460 | key: 'pinch',
|
---|
1461 | engine: PinchEngine,
|
---|
1462 | resolver: pinchConfigResolver
|
---|
1463 | };
|
---|
1464 | const scrollAction = {
|
---|
1465 | key: 'scroll',
|
---|
1466 | engine: ScrollEngine,
|
---|
1467 | resolver: scrollConfigResolver
|
---|
1468 | };
|
---|
1469 | const wheelAction = {
|
---|
1470 | key: 'wheel',
|
---|
1471 | engine: WheelEngine,
|
---|
1472 | resolver: wheelConfigResolver
|
---|
1473 | };
|
---|
1474 |
|
---|
1475 | export { ConfigResolverMap as C, EngineMap as E, SUPPORT as S, _objectSpread2 as _, _defineProperty as a, touchIds as b, chain as c, toHandlerProp as d, dragAction as e, pinchAction as f, hoverAction as h, isTouch as i, moveAction as m, parseProp as p, registerAction as r, scrollAction as s, toDomEventType as t, wheelAction as w };
|
---|