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