gesturx 1.8.4 → 1.8.7
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/dist/index.d.ts +6 -4
- package/dist/index.js +225 -214
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +16 -12
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var ie = Object.defineProperty;
|
|
2
2
|
var se = (t, n, e) => n in t ? ie(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
3
|
-
var
|
|
4
|
-
import { filter as
|
|
3
|
+
var $ = (t, n, e) => se(t, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
import { filter as h, fromEvent as S, map as c, mergeMap as b, defer as pe, of as T, merge as g, takeWhile as V, scan as L, BehaviorSubject as q, switchMap as v, share as P, distinctUntilChanged as oe, startWith as re, shareReplay as M, combineLatest as j, exhaustMap as H, first as z, timer as J, withLatestFrom as C, takeUntil as I, skip as ae, tap as K, ignoreElements as le, buffer as he, debounceTime as ce, NEVER as $e, defaultIfEmpty as ue } from "rxjs";
|
|
5
5
|
function de(t, n) {
|
|
6
6
|
return Math.sqrt(
|
|
7
7
|
Math.pow(n.x - t.x, 2) + Math.pow(n.y - t.y, 2)
|
|
@@ -20,7 +20,7 @@ function N(t, n) {
|
|
|
20
20
|
function ge(t, n) {
|
|
21
21
|
return N(t, n) * (180 / Math.PI);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function F(t) {
|
|
24
24
|
const n = t.reduce(
|
|
25
25
|
(i, o) => (i.x += o.x, i.y += o.y, i),
|
|
26
26
|
{ x: 0, y: 0 }
|
|
@@ -33,18 +33,18 @@ function k(t) {
|
|
|
33
33
|
function ye(t, n) {
|
|
34
34
|
if (t.length !== n.length)
|
|
35
35
|
throw new Error("Initial and new points arrays must have the same length.");
|
|
36
|
-
const e =
|
|
36
|
+
const e = F(t), i = F(n);
|
|
37
37
|
let o = 0;
|
|
38
38
|
for (let s = 0; s < t.length; s++) {
|
|
39
39
|
const r = N(
|
|
40
40
|
e,
|
|
41
41
|
t[s]
|
|
42
42
|
);
|
|
43
|
-
let
|
|
43
|
+
let u = N(
|
|
44
44
|
i,
|
|
45
45
|
n[s]
|
|
46
46
|
) - r;
|
|
47
|
-
|
|
47
|
+
u > Math.PI ? u -= 2 * Math.PI : u < -Math.PI && (u += 2 * Math.PI), o += u;
|
|
48
48
|
}
|
|
49
49
|
const p = o / t.length, a = p * (180 / Math.PI);
|
|
50
50
|
return { radianDelta: p, degreesDelta: a };
|
|
@@ -52,9 +52,9 @@ function ye(t, n) {
|
|
|
52
52
|
function fe(t) {
|
|
53
53
|
return t != null;
|
|
54
54
|
}
|
|
55
|
-
const me = (t) => t.length > 0, Ae = (t) => t.pipe(
|
|
55
|
+
const me = (t) => t.length > 0, Ae = (t) => t.pipe(h(me));
|
|
56
56
|
function Q(t, n, e) {
|
|
57
|
-
const i =
|
|
57
|
+
const i = F([t]), o = F([n]);
|
|
58
58
|
return Math.abs(o.x - i.x) >= e || Math.abs(o.y - i.y) >= e;
|
|
59
59
|
}
|
|
60
60
|
const De = (t, n, e) => {
|
|
@@ -64,33 +64,33 @@ const De = (t, n, e) => {
|
|
|
64
64
|
velocityY: o
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
|
-
function
|
|
67
|
+
function U(t) {
|
|
68
68
|
return (n) => n.pipe(
|
|
69
|
-
|
|
69
|
+
h((e) => e.pointerId === t.pointerId)
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
const Z = (t) => t.type === "pointerleave" || t.type === "pointercancel" || t.type === "pointerup", Pe = ({
|
|
73
73
|
container: t,
|
|
74
74
|
afterEventReceived: n = (e) => e
|
|
75
75
|
}) => S(t, "pointerdown").pipe(
|
|
76
|
-
|
|
76
|
+
c(n)
|
|
77
77
|
), ee = ({
|
|
78
78
|
pointerEvent$: t
|
|
79
79
|
}) => (n) => {
|
|
80
80
|
const e = t.pipe(
|
|
81
|
-
|
|
81
|
+
h((r) => r.type === "pointerup")
|
|
82
82
|
), i = t.pipe(
|
|
83
|
-
|
|
83
|
+
h((r) => r.type === "pointerleave")
|
|
84
84
|
), o = t.pipe(
|
|
85
|
-
|
|
85
|
+
h((r) => r.type === "pointercancel")
|
|
86
86
|
), p = t.pipe(
|
|
87
|
-
|
|
87
|
+
h((r) => r.type === "pointermove")
|
|
88
88
|
), a = S(window, "contextmenu"), s = (r) => ["pointercancel", "pointerleave", "pointerup", "contextmenu"].includes(
|
|
89
89
|
r.type
|
|
90
90
|
);
|
|
91
91
|
return n.pipe(
|
|
92
92
|
b((r) => {
|
|
93
|
-
const l = pe(() =>
|
|
93
|
+
const l = pe(() => T(r));
|
|
94
94
|
return g(
|
|
95
95
|
l,
|
|
96
96
|
g(
|
|
@@ -101,13 +101,13 @@ const Z = (t) => t.type === "pointerleave" || t.type === "pointercancel" || t.ty
|
|
|
101
101
|
a
|
|
102
102
|
)
|
|
103
103
|
).pipe(
|
|
104
|
-
|
|
104
|
+
U(r),
|
|
105
105
|
V((m) => !s(m), !0)
|
|
106
106
|
);
|
|
107
107
|
}),
|
|
108
|
-
|
|
108
|
+
L((r, l) => {
|
|
109
109
|
if (s(l)) {
|
|
110
|
-
const { [l.pointerId]:
|
|
110
|
+
const { [l.pointerId]: u, ...m } = (r == null ? void 0 : r.pointers) ?? {};
|
|
111
111
|
return {
|
|
112
112
|
event: l,
|
|
113
113
|
pointers: m
|
|
@@ -121,7 +121,7 @@ const Z = (t) => t.type === "pointerleave" || t.type === "pointercancel" || t.ty
|
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
}, void 0),
|
|
124
|
-
|
|
124
|
+
c(({ event: r, pointers: l }) => ({
|
|
125
125
|
event: r,
|
|
126
126
|
pointers: Object.values(l).filter(fe)
|
|
127
127
|
}))
|
|
@@ -133,15 +133,15 @@ const Z = (t) => t.type === "pointerleave" || t.type === "pointercancel" || t.ty
|
|
|
133
133
|
deltaY: p
|
|
134
134
|
};
|
|
135
135
|
}, te = (t) => {
|
|
136
|
-
const n = (e) =>
|
|
136
|
+
const n = (e) => F(
|
|
137
137
|
e.latestActivePointers.length ? e.latestActivePointers : [e.event]
|
|
138
138
|
);
|
|
139
139
|
return t.pipe(
|
|
140
|
-
|
|
141
|
-
var f,
|
|
142
|
-
const o = n(i), p = (e == null ? void 0 : e.center) ?? o, a = (e == null ? void 0 : e.deltaX) ?? 0, s = (e == null ? void 0 : e.deltaY) ?? 0, r = ((f = e == null ? void 0 : e.latestActivePointers) == null ? void 0 : f.length) ?? 1, l = ((
|
|
140
|
+
L((e, i) => {
|
|
141
|
+
var f, E;
|
|
142
|
+
const o = n(i), p = (e == null ? void 0 : e.center) ?? o, a = (e == null ? void 0 : e.deltaX) ?? 0, s = (e == null ? void 0 : e.deltaY) ?? 0, r = ((f = e == null ? void 0 : e.latestActivePointers) == null ? void 0 : f.length) ?? 1, l = ((E = i.latestActivePointers) == null ? void 0 : E.length) ?? 1, u = ["pointerdown", "pointercancel", "pointerleave", "pointerup"].includes(
|
|
143
143
|
i.event.type
|
|
144
|
-
) && r !== l, m = l > 0, { deltaX: y, deltaY: A } =
|
|
144
|
+
) && r !== l, m = l > 0, { deltaX: y, deltaY: A } = u && m ? _(o, o, a, s) : _(o, p, a, s), { degreesDelta: D } = r === l && r >= 2 && l >= 2 ? ye(
|
|
145
145
|
(e == null ? void 0 : e.latestActivePointers) ?? [],
|
|
146
146
|
i.latestActivePointers ?? []
|
|
147
147
|
) : { degreesDelta: 0 };
|
|
@@ -155,7 +155,7 @@ const Z = (t) => t.type === "pointerleave" || t.type === "pointercancel" || t.ty
|
|
|
155
155
|
deltaPointersAngle: D
|
|
156
156
|
};
|
|
157
157
|
}, void 0),
|
|
158
|
-
|
|
158
|
+
c((e) => {
|
|
159
159
|
const {
|
|
160
160
|
deltaX: i,
|
|
161
161
|
deltaY: o,
|
|
@@ -164,7 +164,7 @@ const Z = (t) => t.type === "pointerleave" || t.type === "pointercancel" || t.ty
|
|
|
164
164
|
center: s,
|
|
165
165
|
event: r,
|
|
166
166
|
deltaPointersAngle: l
|
|
167
|
-
} = e,
|
|
167
|
+
} = e, u = p ?? [], y = Date.now() - a, { velocityX: A, velocityY: D } = De(y, i, o), f = ve(p);
|
|
168
168
|
return {
|
|
169
169
|
deltaX: i,
|
|
170
170
|
deltaY: o,
|
|
@@ -172,7 +172,7 @@ const Z = (t) => t.type === "pointerleave" || t.type === "pointercancel" || t.ty
|
|
|
172
172
|
velocityY: D,
|
|
173
173
|
delay: y,
|
|
174
174
|
center: s,
|
|
175
|
-
pointers:
|
|
175
|
+
pointers: u,
|
|
176
176
|
startTime: a,
|
|
177
177
|
event: r,
|
|
178
178
|
deltaPointersAngle: l,
|
|
@@ -181,116 +181,123 @@ const Z = (t) => t.type === "pointerleave" || t.type === "pointercancel" || t.ty
|
|
|
181
181
|
})
|
|
182
182
|
);
|
|
183
183
|
}, G = (t) => t.pipe(
|
|
184
|
-
|
|
184
|
+
h(
|
|
185
185
|
(n) => !!n.container
|
|
186
186
|
)
|
|
187
|
-
), ne = (t) => t.pipe(
|
|
187
|
+
), ne = (t) => t.pipe(h(Z)), Ee = ({
|
|
188
188
|
container: t,
|
|
189
189
|
afterEventReceived: n = (e) => e
|
|
190
190
|
}) => {
|
|
191
191
|
const e = Pe({ afterEventReceived: n, container: t }), i = S(t, "pointerup").pipe(
|
|
192
|
-
|
|
192
|
+
c(n)
|
|
193
193
|
), o = S(t, "pointermove").pipe(
|
|
194
|
-
|
|
194
|
+
c(n)
|
|
195
195
|
), p = S(t, "pointerleave").pipe(
|
|
196
|
-
|
|
196
|
+
c(n)
|
|
197
197
|
), a = S(
|
|
198
198
|
t,
|
|
199
199
|
"pointercancel"
|
|
200
|
-
).pipe(
|
|
201
|
-
return
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
200
|
+
).pipe(c(n));
|
|
201
|
+
return {
|
|
202
|
+
pointerEvents$: g(
|
|
203
|
+
e,
|
|
204
|
+
a,
|
|
205
|
+
p,
|
|
206
|
+
i,
|
|
207
|
+
o
|
|
208
|
+
),
|
|
209
|
+
pointerDown$: e,
|
|
210
|
+
pointerCancel$: a,
|
|
211
|
+
pointerLeave$: p,
|
|
212
|
+
pointerUp$: i,
|
|
213
|
+
pointerMove$: o
|
|
214
|
+
};
|
|
208
215
|
};
|
|
209
|
-
class
|
|
216
|
+
class O {
|
|
210
217
|
constructor(n, e) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
218
|
+
$(this, "configSubject", new q({}));
|
|
219
|
+
$(this, "pan$");
|
|
220
|
+
$(this, "panStart$");
|
|
221
|
+
$(this, "panMove$");
|
|
222
|
+
$(this, "panEnd$");
|
|
223
|
+
$(this, "pointerEvent$");
|
|
224
|
+
$(this, "pointerDown$");
|
|
225
|
+
$(this, "pointerUp$");
|
|
226
|
+
$(this, "pointerCancel$");
|
|
227
|
+
$(this, "pointerMove$");
|
|
228
|
+
$(this, "pointerOff$");
|
|
229
|
+
$(this, "state$");
|
|
230
|
+
$(this, "config$", this.configSubject.pipe(G));
|
|
224
231
|
/**
|
|
225
232
|
* Track active running failWith recognizers
|
|
226
233
|
*/
|
|
227
|
-
|
|
234
|
+
$(this, "failWithActive$");
|
|
228
235
|
const i = new q({
|
|
229
236
|
fingers: 0
|
|
230
237
|
});
|
|
231
238
|
this.pointerEvent$ = this.config$.pipe(
|
|
232
239
|
v(
|
|
233
|
-
({ container: p, afterEventReceived: a }) =>
|
|
240
|
+
({ container: p, afterEventReceived: a }) => Ee({
|
|
234
241
|
container: p,
|
|
235
242
|
afterEventReceived: a
|
|
236
|
-
})
|
|
237
|
-
)
|
|
243
|
+
}).pointerEvents$
|
|
244
|
+
),
|
|
245
|
+
P()
|
|
238
246
|
), this.pointerDown$ = this.pointerEvent$.pipe(
|
|
239
|
-
|
|
247
|
+
h((p) => p.type === "pointerdown")
|
|
240
248
|
), this.pointerUp$ = this.pointerEvent$.pipe(
|
|
241
|
-
|
|
249
|
+
h((p) => p.type === "pointerup")
|
|
242
250
|
), this.pointerMove$ = this.pointerEvent$.pipe(
|
|
243
|
-
|
|
251
|
+
h((p) => p.type === "pointermove")
|
|
244
252
|
), this.pointerCancel$ = this.pointerEvent$.pipe(
|
|
245
|
-
|
|
253
|
+
h((p) => p.type === "pointercancel")
|
|
246
254
|
), this.pointerOff$ = this.pointerEvent$.pipe(ne);
|
|
247
255
|
const o = this.config$.pipe(
|
|
248
|
-
|
|
256
|
+
c(({ failWith: p }) => p),
|
|
249
257
|
oe()
|
|
250
258
|
);
|
|
251
259
|
this.failWithActive$ = o.pipe(
|
|
252
260
|
v((p) => {
|
|
253
261
|
const a = p == null ? void 0 : p.map((s) => {
|
|
254
|
-
const r = s.start$.pipe(
|
|
262
|
+
const r = s.start$.pipe(c(() => !0)), l = s.end$.pipe(c(() => !1));
|
|
255
263
|
return g(r, l).pipe(
|
|
256
264
|
re(!1),
|
|
257
|
-
|
|
265
|
+
M(1)
|
|
258
266
|
);
|
|
259
267
|
});
|
|
260
|
-
return a != null && a.length ? j(a) : j([
|
|
268
|
+
return a != null && a.length ? j(a) : j([T(!1)]);
|
|
261
269
|
}),
|
|
262
|
-
|
|
263
|
-
|
|
270
|
+
c((p) => p.some((a) => a)),
|
|
271
|
+
M(1)
|
|
264
272
|
), this.pan$ = this.configSubject.pipe(
|
|
265
273
|
G,
|
|
266
274
|
v((p) => {
|
|
267
275
|
var y, A, D;
|
|
268
276
|
const a = Math.max(1, ((y = p.panConfig) == null ? void 0 : y.numInputs) ?? 1), s = Math.max(0, ((A = p.panConfig) == null ? void 0 : A.posThreshold) ?? 0), r = Math.max(0, ((D = p.panConfig) == null ? void 0 : D.delay) ?? 0), l = this.pointerDown$.pipe(
|
|
269
277
|
ee({
|
|
270
|
-
pointerEvent$: this.pointerEvent
|
|
271
|
-
trackMove: !0
|
|
278
|
+
pointerEvent$: this.pointerEvent$
|
|
272
279
|
}),
|
|
273
|
-
|
|
274
|
-
),
|
|
275
|
-
|
|
276
|
-
(
|
|
280
|
+
M(1)
|
|
281
|
+
), u = (f) => f.pipe(
|
|
282
|
+
h(
|
|
283
|
+
(E) => E.pointers.length >= a
|
|
277
284
|
)
|
|
278
|
-
), m = (f) => f.pipe(
|
|
285
|
+
), m = (f) => f.pipe(h((E) => E.pointers.length < a));
|
|
279
286
|
return l.pipe(
|
|
280
|
-
|
|
287
|
+
u,
|
|
281
288
|
H(({ pointers: f }) => {
|
|
282
|
-
const
|
|
289
|
+
const E = l.pipe(
|
|
283
290
|
m,
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
), X = J(r),
|
|
287
|
-
...f.map((d) =>
|
|
291
|
+
z(),
|
|
292
|
+
P()
|
|
293
|
+
), X = J(r), R = g(
|
|
294
|
+
...f.map((d) => T(d)),
|
|
288
295
|
this.pointerDown$
|
|
289
296
|
).pipe(
|
|
290
297
|
b(
|
|
291
|
-
(d) => g(this.pointerMove$,
|
|
292
|
-
|
|
293
|
-
|
|
298
|
+
(d) => g(this.pointerMove$, T(d)).pipe(
|
|
299
|
+
U(d),
|
|
300
|
+
h(
|
|
294
301
|
(x) => Q(
|
|
295
302
|
d,
|
|
296
303
|
x,
|
|
@@ -299,49 +306,49 @@ class F {
|
|
|
299
306
|
)
|
|
300
307
|
)
|
|
301
308
|
),
|
|
302
|
-
|
|
309
|
+
z()
|
|
303
310
|
).pipe(
|
|
304
311
|
v(() => X),
|
|
305
|
-
|
|
306
|
-
|
|
312
|
+
C(l),
|
|
313
|
+
c(([, { event: d, pointers: x }]) => ({
|
|
307
314
|
type: "start",
|
|
308
315
|
event: d,
|
|
309
316
|
latestActivePointers: x
|
|
310
317
|
})),
|
|
311
|
-
|
|
318
|
+
M({
|
|
312
319
|
bufferSize: 1,
|
|
313
320
|
refCount: !1
|
|
314
321
|
}),
|
|
315
|
-
|
|
316
|
-
),
|
|
322
|
+
I(E)
|
|
323
|
+
), k = R.pipe(
|
|
317
324
|
b(
|
|
318
325
|
() => l.pipe(
|
|
319
326
|
ae(1),
|
|
320
|
-
|
|
327
|
+
c(({ event: d, pointers: x }) => ({
|
|
321
328
|
type: "move",
|
|
322
329
|
event: d,
|
|
323
330
|
latestActivePointers: x
|
|
324
331
|
}))
|
|
325
332
|
)
|
|
326
333
|
),
|
|
327
|
-
|
|
328
|
-
),
|
|
334
|
+
I(E)
|
|
335
|
+
), w = R.pipe(
|
|
329
336
|
b(
|
|
330
|
-
() =>
|
|
331
|
-
|
|
337
|
+
() => E.pipe(
|
|
338
|
+
c(({ event: d, pointers: x }) => ({
|
|
332
339
|
type: "end",
|
|
333
340
|
event: d,
|
|
334
341
|
latestActivePointers: x
|
|
335
342
|
}))
|
|
336
343
|
)
|
|
337
344
|
)
|
|
338
|
-
),
|
|
339
|
-
|
|
345
|
+
), W = g(R, k, w).pipe(
|
|
346
|
+
M(1)
|
|
340
347
|
);
|
|
341
|
-
return
|
|
348
|
+
return W.pipe(
|
|
342
349
|
te,
|
|
343
|
-
|
|
344
|
-
|
|
350
|
+
C(W),
|
|
351
|
+
c(([d, { type: x }]) => ({
|
|
345
352
|
...d,
|
|
346
353
|
type: x
|
|
347
354
|
}))
|
|
@@ -354,16 +361,16 @@ class F {
|
|
|
354
361
|
fingers: p.pointers.length
|
|
355
362
|
});
|
|
356
363
|
}),
|
|
357
|
-
|
|
364
|
+
P()
|
|
358
365
|
), this.panStart$ = this.pan$.pipe(
|
|
359
|
-
|
|
360
|
-
|
|
366
|
+
h((p) => p.type === "start"),
|
|
367
|
+
c(({ type: p, ...a }) => a)
|
|
361
368
|
), this.panMove$ = this.pan$.pipe(
|
|
362
|
-
|
|
363
|
-
|
|
369
|
+
h((p) => p.type === "move"),
|
|
370
|
+
c(({ type: p, ...a }) => a)
|
|
364
371
|
), this.panEnd$ = this.pan$.pipe(
|
|
365
|
-
|
|
366
|
-
|
|
372
|
+
h((p) => p.type === "end"),
|
|
373
|
+
c(({ type: p, ...a }) => a)
|
|
367
374
|
), this.state$ = i.asObservable(), this.updateInternal(n ?? {}, e);
|
|
368
375
|
}
|
|
369
376
|
updateInternal(n, e) {
|
|
@@ -384,33 +391,33 @@ class F {
|
|
|
384
391
|
this.updateInternal(n, e);
|
|
385
392
|
}
|
|
386
393
|
}
|
|
387
|
-
class Se extends
|
|
394
|
+
class Se extends O {
|
|
388
395
|
constructor(e) {
|
|
389
396
|
var a;
|
|
390
397
|
super(e, {
|
|
391
398
|
...e,
|
|
392
399
|
posThreshold: ((a = e == null ? void 0 : e.options) == null ? void 0 : a.posThreshold) ?? 15
|
|
393
400
|
});
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
401
|
+
$(this, "events$");
|
|
402
|
+
$(this, "start$");
|
|
403
|
+
$(this, "end$");
|
|
397
404
|
const i = this.panStart$.pipe(
|
|
398
|
-
|
|
405
|
+
c((s) => ({
|
|
399
406
|
type: "panStart",
|
|
400
407
|
...s
|
|
401
408
|
})),
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
409
|
+
C(this.failWithActive$),
|
|
410
|
+
h(([, s]) => !s),
|
|
411
|
+
c(([s]) => s),
|
|
412
|
+
P()
|
|
406
413
|
), o = this.panEnd$.pipe(
|
|
407
|
-
|
|
414
|
+
c((s) => ({
|
|
408
415
|
type: "panEnd",
|
|
409
416
|
...s
|
|
410
417
|
})),
|
|
411
|
-
|
|
418
|
+
P()
|
|
412
419
|
), p = this.panMove$.pipe(
|
|
413
|
-
|
|
420
|
+
c((s) => ({
|
|
414
421
|
type: "panMove",
|
|
415
422
|
...s
|
|
416
423
|
}))
|
|
@@ -418,58 +425,63 @@ class Se extends F {
|
|
|
418
425
|
this.events$ = i.pipe(
|
|
419
426
|
v((s) => {
|
|
420
427
|
let r = s;
|
|
421
|
-
const l =
|
|
422
|
-
|
|
423
|
-
|
|
428
|
+
const l = T(s), u = this.failWithActive$.pipe(
|
|
429
|
+
h((A) => A),
|
|
430
|
+
z()
|
|
424
431
|
), m = g(l, p, o).pipe(
|
|
425
432
|
K((A) => {
|
|
426
433
|
r = A;
|
|
427
434
|
}),
|
|
428
|
-
|
|
429
|
-
), y =
|
|
430
|
-
|
|
435
|
+
I(u)
|
|
436
|
+
), y = u.pipe(
|
|
437
|
+
c(() => ({
|
|
431
438
|
...r,
|
|
432
439
|
type: "panEnd"
|
|
433
440
|
})),
|
|
434
|
-
|
|
441
|
+
I(o)
|
|
435
442
|
);
|
|
436
443
|
return g(m, y);
|
|
437
444
|
}),
|
|
438
|
-
|
|
445
|
+
P()
|
|
439
446
|
), this.start$ = this.events$.pipe(
|
|
440
|
-
|
|
441
|
-
), this.end$ = this.events$.pipe(
|
|
447
|
+
h((s) => s.type === "panStart")
|
|
448
|
+
), this.end$ = this.events$.pipe(h((s) => s.type === "panEnd"));
|
|
442
449
|
}
|
|
443
450
|
update(e) {
|
|
444
451
|
super.update(e, e.options);
|
|
445
452
|
}
|
|
446
453
|
}
|
|
447
|
-
const
|
|
448
|
-
|
|
454
|
+
const we = (t) => (n) => n.pipe(
|
|
455
|
+
h((e) => Math.abs(e.velocityX) >= t || Math.abs(e.velocityY) >= t)
|
|
449
456
|
);
|
|
450
|
-
class be extends
|
|
457
|
+
class be extends O {
|
|
451
458
|
constructor(e) {
|
|
452
459
|
super(e, {
|
|
453
460
|
posThreshold: 0,
|
|
454
461
|
numInputs: 1
|
|
455
462
|
});
|
|
456
|
-
|
|
463
|
+
$(this, "events$");
|
|
457
464
|
this.events$ = this.config$.pipe(
|
|
458
465
|
v((i) => {
|
|
459
466
|
const { escapeVelocity: o = 0.9 } = i.options ?? {};
|
|
460
467
|
return this.panStart$.pipe(
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
468
|
+
C(this.failWithActive$),
|
|
469
|
+
h(([, p]) => !p),
|
|
470
|
+
v(([p]) => this.panEnd$.pipe(
|
|
471
|
+
we(o),
|
|
472
|
+
c((a) => ({
|
|
464
473
|
type: "swipe",
|
|
465
474
|
angle: ge(
|
|
466
475
|
p.event,
|
|
467
476
|
a.event
|
|
468
477
|
),
|
|
469
478
|
...a
|
|
470
|
-
}))
|
|
479
|
+
})),
|
|
480
|
+
I(
|
|
481
|
+
this.failWithActive$.pipe(h((a) => a))
|
|
482
|
+
)
|
|
471
483
|
)),
|
|
472
|
-
|
|
484
|
+
P()
|
|
473
485
|
);
|
|
474
486
|
})
|
|
475
487
|
);
|
|
@@ -478,14 +490,14 @@ class be extends F {
|
|
|
478
490
|
super.update(e);
|
|
479
491
|
}
|
|
480
492
|
}
|
|
481
|
-
const
|
|
493
|
+
const Me = ({
|
|
482
494
|
timeout: t,
|
|
483
495
|
pointerEvent$: n
|
|
484
496
|
}) => (e) => e.pipe(
|
|
485
497
|
b(
|
|
486
498
|
(i) => J(t).pipe(
|
|
487
|
-
|
|
488
|
-
n.pipe(ne,
|
|
499
|
+
I(
|
|
500
|
+
n.pipe(ne, U(i))
|
|
489
501
|
)
|
|
490
502
|
)
|
|
491
503
|
)
|
|
@@ -496,32 +508,31 @@ const Ee = ({
|
|
|
496
508
|
}) => (i) => i.pipe(
|
|
497
509
|
b(
|
|
498
510
|
(o) => n.pipe(
|
|
499
|
-
|
|
511
|
+
U(o),
|
|
500
512
|
V((p) => !Z(p), !0),
|
|
501
|
-
|
|
513
|
+
h(
|
|
502
514
|
(p) => Q(t, p, e)
|
|
503
515
|
)
|
|
504
516
|
)
|
|
505
517
|
)
|
|
506
518
|
);
|
|
507
|
-
class Ce extends
|
|
519
|
+
class Ce extends O {
|
|
508
520
|
constructor(e) {
|
|
509
521
|
super(e);
|
|
510
|
-
|
|
522
|
+
$(this, "events$");
|
|
511
523
|
this.events$ = this.config$.pipe(
|
|
512
524
|
v((i) => {
|
|
513
525
|
var y, A;
|
|
514
526
|
const o = ((y = i.options) == null ? void 0 : y.maxTaps) ?? 1, p = ((A = i.options) == null ? void 0 : A.multiTapThreshold) ?? 100 * (o - 1), { maximumPressTime: a = 150, tolerance: s = 10 } = i.options ?? {}, r = this.pointerDown$.pipe(
|
|
515
527
|
ee({
|
|
516
|
-
pointerEvent$: this.pointerEvent
|
|
517
|
-
trackMove: !0
|
|
528
|
+
pointerEvent$: this.pointerEvent$
|
|
518
529
|
}),
|
|
519
|
-
|
|
530
|
+
M(1)
|
|
520
531
|
), l = r.pipe(
|
|
521
|
-
|
|
522
|
-
),
|
|
532
|
+
h(({ pointers: D }) => D.length > 1)
|
|
533
|
+
), u = (D) => D.pipe(
|
|
523
534
|
he(this.pointerUp$.pipe(ce(p))),
|
|
524
|
-
|
|
535
|
+
z()
|
|
525
536
|
);
|
|
526
537
|
return g(
|
|
527
538
|
this.pointerDown$,
|
|
@@ -529,78 +540,78 @@ class Ce extends F {
|
|
|
529
540
|
).pipe(
|
|
530
541
|
H((D) => {
|
|
531
542
|
const f = g(
|
|
532
|
-
|
|
543
|
+
T(D),
|
|
533
544
|
this.pointerDown$
|
|
534
|
-
).pipe(
|
|
545
|
+
).pipe(M(1)), E = f.pipe(u), X = f.pipe(
|
|
535
546
|
xe({
|
|
536
547
|
initialPointerEvent: D,
|
|
537
548
|
pointerEvent$: this.pointerEvent$,
|
|
538
549
|
tolerance: s
|
|
539
550
|
})
|
|
540
551
|
), B = f.pipe(
|
|
541
|
-
|
|
552
|
+
Me({
|
|
542
553
|
pointerEvent$: this.pointerEvent$,
|
|
543
554
|
timeout: a
|
|
544
555
|
})
|
|
545
|
-
),
|
|
546
|
-
this.failWithActive$.pipe(
|
|
556
|
+
), R = g(
|
|
557
|
+
this.failWithActive$.pipe(h((w) => w)),
|
|
547
558
|
this.pointerCancel$,
|
|
548
559
|
l,
|
|
549
560
|
X,
|
|
550
561
|
B
|
|
551
|
-
),
|
|
562
|
+
), k = E.pipe(
|
|
552
563
|
Ae,
|
|
553
|
-
|
|
554
|
-
|
|
564
|
+
h((w) => w.length <= o),
|
|
565
|
+
c((w) => ({
|
|
555
566
|
type: "tap",
|
|
556
|
-
taps:
|
|
557
|
-
latestActivePointers:
|
|
558
|
-
event:
|
|
567
|
+
taps: w.length,
|
|
568
|
+
latestActivePointers: w,
|
|
569
|
+
event: w[0]
|
|
559
570
|
})),
|
|
560
|
-
|
|
571
|
+
M(1)
|
|
561
572
|
);
|
|
562
|
-
return
|
|
573
|
+
return k.pipe(
|
|
563
574
|
te,
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
...
|
|
567
|
-
type:
|
|
575
|
+
C(k),
|
|
576
|
+
c(([w, { type: W, taps: d }]) => ({
|
|
577
|
+
...w,
|
|
578
|
+
type: W,
|
|
568
579
|
taps: d
|
|
569
580
|
})),
|
|
570
|
-
|
|
581
|
+
I(R)
|
|
571
582
|
);
|
|
572
583
|
})
|
|
573
584
|
);
|
|
574
585
|
}),
|
|
575
|
-
|
|
586
|
+
P()
|
|
576
587
|
);
|
|
577
588
|
}
|
|
578
589
|
update(e) {
|
|
579
590
|
super.update(e);
|
|
580
591
|
}
|
|
581
592
|
}
|
|
582
|
-
class Re extends
|
|
593
|
+
class Re extends O {
|
|
583
594
|
constructor(e = {}) {
|
|
584
595
|
super(e, {
|
|
585
596
|
numInputs: 2,
|
|
586
597
|
posThreshold: 15,
|
|
587
598
|
...e.options
|
|
588
599
|
});
|
|
589
|
-
|
|
600
|
+
$(this, "events$");
|
|
590
601
|
this.events$ = this.config$.pipe(
|
|
591
602
|
v(() => {
|
|
592
603
|
const i = this.panStart$.pipe(
|
|
593
|
-
|
|
604
|
+
c((s) => ({
|
|
594
605
|
...s,
|
|
595
606
|
type: "rotateStart",
|
|
596
607
|
angle: 0,
|
|
597
608
|
deltaAngle: 0
|
|
598
609
|
})),
|
|
599
|
-
|
|
610
|
+
M(1)
|
|
600
611
|
), o = i.pipe(
|
|
601
612
|
v(
|
|
602
613
|
() => this.pan$.pipe(
|
|
603
|
-
|
|
614
|
+
L((s, r) => {
|
|
604
615
|
const l = ((s == null ? void 0 : s.angle) ?? 0) + r.deltaPointersAngle;
|
|
605
616
|
return {
|
|
606
617
|
...s,
|
|
@@ -611,17 +622,17 @@ class Re extends F {
|
|
|
611
622
|
}, void 0)
|
|
612
623
|
)
|
|
613
624
|
),
|
|
614
|
-
|
|
625
|
+
P()
|
|
615
626
|
), p = o.pipe(
|
|
616
|
-
|
|
617
|
-
|
|
627
|
+
h((s) => s.type === "move"),
|
|
628
|
+
c((s) => ({ ...s, type: "rotateMove" }))
|
|
618
629
|
), a = o.pipe(
|
|
619
|
-
|
|
620
|
-
|
|
630
|
+
h((s) => s.type === "end"),
|
|
631
|
+
c((s) => ({ ...s, type: "rotateEnd" }))
|
|
621
632
|
);
|
|
622
633
|
return g(i, p, a);
|
|
623
634
|
}),
|
|
624
|
-
|
|
635
|
+
P()
|
|
625
636
|
);
|
|
626
637
|
}
|
|
627
638
|
update(e) {
|
|
@@ -632,38 +643,38 @@ const Y = ({
|
|
|
632
643
|
type: t,
|
|
633
644
|
initialEvent: n
|
|
634
645
|
}) => (e) => e.pipe(
|
|
635
|
-
|
|
636
|
-
const a = ((i == null ? void 0 : i.pointers.length) ?? 0) !== o.pointers.length, s = (i == null ? void 0 : i.pointersAverageDistance) ?? o.pointersAverageDistance, r = a ? o.pointersAverageDistance : i && "initialPointersAverageDistance" in i ? i.initialPointersAverageDistance : o.pointersAverageDistance, l = r === 0 ? 1 : o.pointersAverageDistance / r,
|
|
646
|
+
L((i, o) => {
|
|
647
|
+
const a = ((i == null ? void 0 : i.pointers.length) ?? 0) !== o.pointers.length, s = (i == null ? void 0 : i.pointersAverageDistance) ?? o.pointersAverageDistance, r = a ? o.pointersAverageDistance : i && "initialPointersAverageDistance" in i ? i.initialPointersAverageDistance : o.pointersAverageDistance, l = r === 0 ? 1 : o.pointersAverageDistance / r, u = o.pointersAverageDistance - r, m = o.pointersAverageDistance - r, y = a || s === 0 ? 1 : o.pointersAverageDistance / s;
|
|
637
648
|
return {
|
|
638
649
|
...i,
|
|
639
650
|
...o,
|
|
640
651
|
type: t,
|
|
641
652
|
initialPointersAverageDistance: r,
|
|
642
653
|
scale: l,
|
|
643
|
-
distance:
|
|
654
|
+
distance: u,
|
|
644
655
|
deltaDistance: m,
|
|
645
656
|
deltaDistanceScale: y
|
|
646
657
|
};
|
|
647
658
|
}, n),
|
|
648
|
-
|
|
659
|
+
c(({ initialPointersAverageDistance: i, ...o }) => o)
|
|
649
660
|
);
|
|
650
|
-
class ze extends
|
|
661
|
+
class ze extends O {
|
|
651
662
|
constructor(e) {
|
|
652
663
|
super(e, {
|
|
653
664
|
...e == null ? void 0 : e.options,
|
|
654
665
|
numInputs: 2
|
|
655
666
|
});
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
667
|
+
$(this, "events$");
|
|
668
|
+
$(this, "start$");
|
|
669
|
+
$(this, "end$");
|
|
659
670
|
this.events$ = this.config$.pipe(
|
|
660
671
|
v(() => {
|
|
661
672
|
const i = this.panStart$.pipe(
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
673
|
+
C(this.failWithActive$),
|
|
674
|
+
h(([, s]) => !s),
|
|
675
|
+
c(([s]) => s),
|
|
665
676
|
v(
|
|
666
|
-
(s) =>
|
|
677
|
+
(s) => T(s).pipe(
|
|
667
678
|
// we don't want a scan on pinch start
|
|
668
679
|
Y({
|
|
669
680
|
type: "pinchStart",
|
|
@@ -671,10 +682,10 @@ class ze extends F {
|
|
|
671
682
|
})
|
|
672
683
|
)
|
|
673
684
|
),
|
|
674
|
-
|
|
685
|
+
M(1)
|
|
675
686
|
), o = this.failWithActive$.pipe(
|
|
676
|
-
|
|
677
|
-
|
|
687
|
+
h((s) => s),
|
|
688
|
+
z()
|
|
678
689
|
), p = i.pipe(
|
|
679
690
|
v((s) => this.pan$.pipe(
|
|
680
691
|
V((r) => r.type !== "end"),
|
|
@@ -683,47 +694,47 @@ class ze extends F {
|
|
|
683
694
|
initialEvent: s
|
|
684
695
|
})
|
|
685
696
|
)),
|
|
686
|
-
|
|
697
|
+
I(o)
|
|
687
698
|
), a = i.pipe(
|
|
688
699
|
v((s) => {
|
|
689
700
|
let r = s;
|
|
690
701
|
return this.pan$.pipe(
|
|
691
|
-
v((l) => l.type === "end" ?
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
702
|
+
v((l) => l.type === "end" ? T(l) : (r = l, $e)),
|
|
703
|
+
I(o),
|
|
704
|
+
ue(null),
|
|
705
|
+
c(
|
|
695
706
|
(l) => l || r
|
|
696
707
|
),
|
|
697
708
|
Y({
|
|
698
709
|
type: "pinchEnd",
|
|
699
710
|
initialEvent: r
|
|
700
711
|
}),
|
|
701
|
-
|
|
712
|
+
P()
|
|
702
713
|
);
|
|
703
714
|
})
|
|
704
715
|
);
|
|
705
716
|
return g(i, p, a);
|
|
706
717
|
}),
|
|
707
|
-
|
|
718
|
+
P()
|
|
708
719
|
), this.start$ = this.events$.pipe(
|
|
709
|
-
|
|
710
|
-
), this.end$ = this.events$.pipe(
|
|
720
|
+
h((i) => i.type === "pinchStart")
|
|
721
|
+
), this.end$ = this.events$.pipe(h((i) => i.type === "pinchEnd"));
|
|
711
722
|
}
|
|
712
723
|
update(e) {
|
|
713
724
|
super.update(e, e.options);
|
|
714
725
|
}
|
|
715
726
|
}
|
|
716
|
-
class
|
|
727
|
+
class Fe {
|
|
717
728
|
constructor(n) {
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
729
|
+
$(this, "events$");
|
|
730
|
+
$(this, "recognizers");
|
|
731
|
+
$(this, "state$");
|
|
721
732
|
this.options = n, this.recognizers = n.recognizers, this.events$ = g(
|
|
722
733
|
...n.recognizers.map((e) => e.events$)
|
|
723
|
-
).pipe(
|
|
734
|
+
).pipe(P()), this.state$ = j(
|
|
724
735
|
this.recognizers.map((e) => e.state$)
|
|
725
736
|
).pipe(
|
|
726
|
-
|
|
737
|
+
c(
|
|
727
738
|
(e) => e.reduce((i, o) => ({
|
|
728
739
|
fingers: Math.max(i.fingers, o.fingers)
|
|
729
740
|
}))
|
|
@@ -742,8 +753,8 @@ class ke {
|
|
|
742
753
|
export {
|
|
743
754
|
Se as PanRecognizer,
|
|
744
755
|
ze as PinchRecognizer,
|
|
745
|
-
|
|
746
|
-
|
|
756
|
+
Fe as Recognizable,
|
|
757
|
+
O as Recognizer,
|
|
747
758
|
Re as RotateRecognizer,
|
|
748
759
|
be as SwipeRecognizer,
|
|
749
760
|
Ce as TapRecognizer
|