gesturx 1.7.4 → 1.7.6
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/README.md +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +278 -265
- 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,24 +1,24 @@
|
|
|
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
|
|
5
|
-
function
|
|
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, distinctUntilChanged as se, NEVER as ie, shareReplay as x, exhaustMap as _, first as X, share as f, timer as G, withLatestFrom as Y, takeUntil as k, skip as pe, tap as oe, ignoreElements as re, buffer as ae, debounceTime as le, startWith as he, pairwise as ce, combineLatest as ue } from "rxjs";
|
|
5
|
+
function $e(n, s) {
|
|
6
6
|
return Math.sqrt(
|
|
7
7
|
Math.pow(s.x - n.x, 2) + Math.pow(s.y - n.y, 2)
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function de(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 + $e(o, p), 0), 0), i = s * (s - 1) / 2;
|
|
14
14
|
return e / i;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function j(n, s) {
|
|
17
17
|
const e = s.x - n.x, i = s.y - n.y;
|
|
18
18
|
return Math.atan2(i, e);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
20
|
+
function ge(n, s) {
|
|
21
|
+
return j(n, s) * (180 / Math.PI);
|
|
22
22
|
}
|
|
23
23
|
function C(n) {
|
|
24
24
|
const s = n.reduce(
|
|
@@ -30,34 +30,34 @@ function C(n) {
|
|
|
30
30
|
y: s.y / e
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function ve(n, s) {
|
|
34
34
|
if (n.length !== s.length)
|
|
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 = j(
|
|
40
40
|
e,
|
|
41
|
-
n[
|
|
41
|
+
n[r]
|
|
42
42
|
);
|
|
43
|
-
let
|
|
43
|
+
let $ = j(
|
|
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 };
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function ye(n) {
|
|
53
53
|
return n != null;
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
function
|
|
55
|
+
const me = (n) => n.length > 0, De = (n) => n.pipe(c(me));
|
|
56
|
+
function H(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;
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const Pe = (n, s, e) => {
|
|
61
61
|
const i = n > 0 ? s / n : 0, t = n > 0 ? e / n : 0;
|
|
62
62
|
return {
|
|
63
63
|
velocityX: i,
|
|
@@ -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
|
-
const
|
|
72
|
+
const J = (n) => n.type === "pointerleave" || n.type === "pointercancel" || n.type === "pointerup", fe = ({
|
|
73
73
|
container: n,
|
|
74
74
|
afterEventReceived: s = (e) => e
|
|
75
|
-
}) =>
|
|
76
|
-
|
|
77
|
-
),
|
|
75
|
+
}) => S(n, "pointerdown").pipe(
|
|
76
|
+
u(s)
|
|
77
|
+
), K = ({
|
|
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(ye)
|
|
119
127
|
}))
|
|
120
128
|
);
|
|
121
129
|
}, q = (n, s, e, i) => {
|
|
@@ -124,16 +132,16 @@ const K = (n) => n.type === "pointerleave" || n.type === "pointercancel" || n.ty
|
|
|
124
132
|
deltaX: t,
|
|
125
133
|
deltaY: o
|
|
126
134
|
};
|
|
127
|
-
},
|
|
135
|
+
}, Q = (n) => {
|
|
128
136
|
const s = (e) => C(
|
|
129
137
|
e.latestActivePointers.length ? e.latestActivePointers : [e.event]
|
|
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 ? ve(
|
|
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 } = Pe(d, i, t), g = de(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
|
-
},
|
|
176
|
-
|
|
183
|
+
}, W = (n) => n.pipe(
|
|
184
|
+
c(
|
|
177
185
|
(s) => !!s.container
|
|
178
186
|
)
|
|
179
|
-
),
|
|
187
|
+
), Z = (n) => n.pipe(c(J)), Ae = ({
|
|
180
188
|
container: n,
|
|
181
189
|
afterEventReceived: s = (e) => e
|
|
182
190
|
}) => {
|
|
183
|
-
const e =
|
|
184
|
-
|
|
185
|
-
), t =
|
|
186
|
-
|
|
187
|
-
), o =
|
|
188
|
-
|
|
189
|
-
), a =
|
|
191
|
+
const e = fe({ 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(W));
|
|
217
225
|
const i = new B({
|
|
218
226
|
fingers: 0
|
|
219
227
|
});
|
|
@@ -225,120 +233,123 @@ 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
|
-
|
|
235
|
-
), this.pointerOff$ = this.pointerEvent$.pipe(
|
|
242
|
+
c((t) => t.type === "pointercancel")
|
|
243
|
+
), this.pointerOff$ = this.pointerEvent$.pipe(Z), this.failWith$ = this.config$.pipe(
|
|
244
|
+
se(
|
|
245
|
+
(t, o) => t.failWith === o.failWith
|
|
246
|
+
),
|
|
236
247
|
v(
|
|
237
|
-
({ failWith: t }) => t != null && t.length ? y(...(t == null ? void 0 : t.map(({ start$: o }) => o)) ?? []) :
|
|
248
|
+
({ failWith: t }) => t != null && t.length ? y(...(t == null ? void 0 : t.map(({ start$: o }) => o)) ?? []) : ie
|
|
238
249
|
)
|
|
239
250
|
), this.pan$ = this.configSubject.pipe(
|
|
240
|
-
|
|
251
|
+
W,
|
|
241
252
|
v((t) => {
|
|
242
|
-
var
|
|
243
|
-
const o = Math.max(1, ((
|
|
244
|
-
|
|
253
|
+
var D, d, A;
|
|
254
|
+
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(
|
|
255
|
+
K({
|
|
245
256
|
pointerEvent$: this.pointerEvent$,
|
|
246
257
|
trackMove: !0
|
|
247
258
|
}),
|
|
248
|
-
|
|
249
|
-
),
|
|
250
|
-
|
|
259
|
+
x(1)
|
|
260
|
+
), l = (P) => P.pipe(
|
|
261
|
+
c(
|
|
251
262
|
(g) => g.pointers.length >= o
|
|
252
263
|
)
|
|
253
|
-
),
|
|
254
|
-
return
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const g =
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
),
|
|
262
|
-
...
|
|
264
|
+
), $ = (P) => P.pipe(c((g) => g.pointers.length < o));
|
|
265
|
+
return p.pipe(
|
|
266
|
+
l,
|
|
267
|
+
_(({ pointers: P }) => {
|
|
268
|
+
const g = p.pipe(
|
|
269
|
+
$,
|
|
270
|
+
X(),
|
|
271
|
+
f()
|
|
272
|
+
), E = G(r), I = y(
|
|
273
|
+
...P.map((m) => b(m)),
|
|
263
274
|
this.pointerDown$
|
|
264
275
|
).pipe(
|
|
265
|
-
|
|
266
|
-
(m) => y(this.pointerMove$,
|
|
276
|
+
T(
|
|
277
|
+
(m) => y(this.pointerMove$, b(m)).pipe(
|
|
267
278
|
F(m),
|
|
268
|
-
|
|
269
|
-
(
|
|
279
|
+
c(
|
|
280
|
+
(M) => H(
|
|
270
281
|
m,
|
|
271
|
-
|
|
282
|
+
M,
|
|
272
283
|
a
|
|
273
284
|
)
|
|
274
285
|
)
|
|
275
286
|
)
|
|
276
287
|
),
|
|
277
|
-
|
|
288
|
+
X()
|
|
278
289
|
).pipe(
|
|
279
|
-
v(() =>
|
|
280
|
-
|
|
281
|
-
|
|
290
|
+
v(() => E),
|
|
291
|
+
Y(p),
|
|
292
|
+
u(([, { event: m, pointers: M }]) => ({
|
|
282
293
|
type: "start",
|
|
283
294
|
event: m,
|
|
284
|
-
latestActivePointers:
|
|
295
|
+
latestActivePointers: M
|
|
285
296
|
})),
|
|
286
|
-
|
|
297
|
+
x({
|
|
287
298
|
bufferSize: 1,
|
|
288
299
|
refCount: !1
|
|
289
300
|
}),
|
|
290
301
|
k(g)
|
|
291
|
-
),
|
|
292
|
-
|
|
293
|
-
() =>
|
|
294
|
-
|
|
295
|
-
|
|
302
|
+
), w = I.pipe(
|
|
303
|
+
T(
|
|
304
|
+
() => p.pipe(
|
|
305
|
+
pe(1),
|
|
306
|
+
u(({ event: m, pointers: M }) => ({
|
|
296
307
|
type: "move",
|
|
297
308
|
event: m,
|
|
298
|
-
latestActivePointers:
|
|
309
|
+
latestActivePointers: M
|
|
299
310
|
}))
|
|
300
311
|
)
|
|
301
312
|
),
|
|
302
313
|
k(g)
|
|
303
314
|
), L = I.pipe(
|
|
304
|
-
|
|
315
|
+
T(
|
|
305
316
|
() => g.pipe(
|
|
306
|
-
|
|
317
|
+
u(({ event: m, pointers: M }) => ({
|
|
307
318
|
type: "end",
|
|
308
319
|
event: m,
|
|
309
|
-
latestActivePointers:
|
|
320
|
+
latestActivePointers: M
|
|
310
321
|
}))
|
|
311
322
|
)
|
|
312
323
|
)
|
|
313
|
-
), R = y(I,
|
|
314
|
-
|
|
324
|
+
), R = y(I, w, L).pipe(
|
|
325
|
+
x(1)
|
|
315
326
|
);
|
|
316
327
|
return R.pipe(
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
328
|
+
Q,
|
|
329
|
+
Y(R),
|
|
330
|
+
u(([m, { type: M }]) => ({
|
|
320
331
|
...m,
|
|
321
|
-
type:
|
|
332
|
+
type: M
|
|
322
333
|
}))
|
|
323
334
|
);
|
|
324
335
|
})
|
|
325
336
|
);
|
|
326
337
|
}),
|
|
327
|
-
|
|
338
|
+
oe((t) => {
|
|
328
339
|
i.next({
|
|
329
340
|
fingers: t.pointers.length
|
|
330
341
|
});
|
|
331
342
|
}),
|
|
332
|
-
|
|
343
|
+
f()
|
|
333
344
|
), this.panStart$ = this.pan$.pipe(
|
|
334
|
-
|
|
335
|
-
|
|
345
|
+
c((t) => t.type === "start"),
|
|
346
|
+
u(({ type: t, ...o }) => o)
|
|
336
347
|
), this.panMove$ = this.pan$.pipe(
|
|
337
|
-
|
|
338
|
-
|
|
348
|
+
c((t) => t.type === "move"),
|
|
349
|
+
u(({ type: t, ...o }) => o)
|
|
339
350
|
), this.panEnd$ = this.pan$.pipe(
|
|
340
|
-
|
|
341
|
-
|
|
351
|
+
c((t) => t.type === "end"),
|
|
352
|
+
u(({ type: t, ...o }) => o)
|
|
342
353
|
), this.state$ = i.asObservable(), this.updateInternal(s ?? {}, e);
|
|
343
354
|
}
|
|
344
355
|
updateInternal(s, e) {
|
|
@@ -359,33 +370,33 @@ class z {
|
|
|
359
370
|
this.updateInternal(s, e);
|
|
360
371
|
}
|
|
361
372
|
}
|
|
362
|
-
class
|
|
373
|
+
class Se extends z {
|
|
363
374
|
constructor(e) {
|
|
364
375
|
var o;
|
|
365
376
|
super(e, {
|
|
366
377
|
...e,
|
|
367
378
|
posThreshold: ((o = e == null ? void 0 : e.options) == null ? void 0 : o.posThreshold) ?? 15
|
|
368
379
|
});
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
380
|
+
h(this, "events$");
|
|
381
|
+
h(this, "start$");
|
|
382
|
+
h(this, "end$");
|
|
372
383
|
const i = this.panStart$.pipe(
|
|
373
|
-
|
|
384
|
+
u((a) => ({
|
|
374
385
|
type: "panStart",
|
|
375
386
|
...a
|
|
376
387
|
})),
|
|
377
|
-
|
|
388
|
+
f()
|
|
378
389
|
), t = this.panEnd$.pipe(
|
|
379
|
-
|
|
390
|
+
u((a) => ({
|
|
380
391
|
type: "panEnd",
|
|
381
392
|
...a
|
|
382
393
|
})),
|
|
383
|
-
|
|
394
|
+
f()
|
|
384
395
|
);
|
|
385
396
|
this.events$ = y(
|
|
386
397
|
i,
|
|
387
398
|
this.panMove$.pipe(
|
|
388
|
-
|
|
399
|
+
u((a) => ({
|
|
389
400
|
type: "panMove",
|
|
390
401
|
...a
|
|
391
402
|
}))
|
|
@@ -397,32 +408,32 @@ class Ie extends z {
|
|
|
397
408
|
super.update(e, e.options);
|
|
398
409
|
}
|
|
399
410
|
}
|
|
400
|
-
const
|
|
401
|
-
|
|
411
|
+
const we = (n) => (s) => s.pipe(
|
|
412
|
+
c((e) => Math.abs(e.velocityX) >= n || Math.abs(e.velocityY) >= n)
|
|
402
413
|
);
|
|
403
|
-
class
|
|
414
|
+
class Te extends z {
|
|
404
415
|
constructor(e) {
|
|
405
416
|
super(e, {
|
|
406
417
|
posThreshold: 0,
|
|
407
418
|
numInputs: 1
|
|
408
419
|
});
|
|
409
|
-
|
|
420
|
+
h(this, "events$");
|
|
410
421
|
this.events$ = this.config$.pipe(
|
|
411
422
|
v((i) => {
|
|
412
423
|
const { escapeVelocity: t = 0.9 } = i.options ?? {};
|
|
413
424
|
return this.panStart$.pipe(
|
|
414
425
|
v((o) => this.panEnd$.pipe(
|
|
415
|
-
|
|
416
|
-
|
|
426
|
+
we(t),
|
|
427
|
+
u((a) => ({
|
|
417
428
|
type: "swipe",
|
|
418
|
-
angle:
|
|
429
|
+
angle: ge(
|
|
419
430
|
o.event,
|
|
420
431
|
a.event
|
|
421
432
|
),
|
|
422
433
|
...a
|
|
423
434
|
}))
|
|
424
435
|
)),
|
|
425
|
-
|
|
436
|
+
f()
|
|
426
437
|
);
|
|
427
438
|
})
|
|
428
439
|
);
|
|
@@ -431,96 +442,96 @@ class Se extends z {
|
|
|
431
442
|
super.update(e);
|
|
432
443
|
}
|
|
433
444
|
}
|
|
434
|
-
const
|
|
445
|
+
const Me = ({
|
|
435
446
|
timeout: n,
|
|
436
447
|
pointerEvent$: s
|
|
437
448
|
}) => (e) => e.pipe(
|
|
438
|
-
|
|
439
|
-
(i) =>
|
|
449
|
+
T(
|
|
450
|
+
(i) => G(n).pipe(
|
|
440
451
|
k(
|
|
441
|
-
s.pipe(
|
|
452
|
+
s.pipe(Z, F(i))
|
|
442
453
|
)
|
|
443
454
|
)
|
|
444
455
|
)
|
|
445
|
-
),
|
|
456
|
+
), xe = ({
|
|
446
457
|
initialPointerEvent: n,
|
|
447
458
|
pointerEvent$: s,
|
|
448
459
|
tolerance: e
|
|
449
460
|
}) => (i) => i.pipe(
|
|
450
|
-
|
|
461
|
+
T(
|
|
451
462
|
(t) => s.pipe(
|
|
452
463
|
F(t),
|
|
453
|
-
N((o) => !
|
|
454
|
-
|
|
455
|
-
(o) =>
|
|
464
|
+
N((o) => !J(o), !0),
|
|
465
|
+
c(
|
|
466
|
+
(o) => H(n, o, e)
|
|
456
467
|
)
|
|
457
468
|
)
|
|
458
469
|
)
|
|
459
470
|
);
|
|
460
|
-
class
|
|
471
|
+
class be extends z {
|
|
461
472
|
constructor(e) {
|
|
462
473
|
super(e);
|
|
463
|
-
|
|
474
|
+
h(this, "events$");
|
|
464
475
|
this.events$ = this.config$.pipe(
|
|
465
476
|
v((i) => {
|
|
466
477
|
const {
|
|
467
478
|
multiTapThreshold: t = 0,
|
|
468
479
|
maximumPressTime: o = 150,
|
|
469
480
|
maxTaps: a = 1,
|
|
470
|
-
tolerance:
|
|
471
|
-
} = i.options ?? {},
|
|
472
|
-
|
|
481
|
+
tolerance: r = 10
|
|
482
|
+
} = i.options ?? {}, p = this.pointerDown$.pipe(
|
|
483
|
+
K({
|
|
473
484
|
pointerEvent$: this.pointerEvent$,
|
|
474
485
|
trackMove: !0
|
|
475
486
|
}),
|
|
476
|
-
|
|
477
|
-
),
|
|
478
|
-
|
|
479
|
-
),
|
|
480
|
-
|
|
481
|
-
|
|
487
|
+
x(1)
|
|
488
|
+
), l = p.pipe(
|
|
489
|
+
c(({ pointers: d }) => d.length > 1)
|
|
490
|
+
), $ = (d) => d.pipe(
|
|
491
|
+
ae(this.pointerUp$.pipe(le(t))),
|
|
492
|
+
X()
|
|
482
493
|
);
|
|
483
494
|
return y(
|
|
484
495
|
this.pointerDown$,
|
|
485
|
-
|
|
496
|
+
p.pipe(re())
|
|
486
497
|
).pipe(
|
|
487
|
-
|
|
488
|
-
const
|
|
489
|
-
|
|
498
|
+
_((d) => {
|
|
499
|
+
const A = y(
|
|
500
|
+
b(d),
|
|
490
501
|
this.pointerDown$
|
|
491
|
-
).pipe(
|
|
492
|
-
|
|
502
|
+
).pipe(x(1)), P = A.pipe($), g = A.pipe(
|
|
503
|
+
xe({
|
|
493
504
|
initialPointerEvent: d,
|
|
494
505
|
pointerEvent$: this.pointerEvent$,
|
|
495
|
-
tolerance:
|
|
506
|
+
tolerance: r
|
|
496
507
|
})
|
|
497
|
-
),
|
|
498
|
-
|
|
508
|
+
), E = A.pipe(
|
|
509
|
+
Me({
|
|
499
510
|
pointerEvent$: this.pointerEvent$,
|
|
500
511
|
timeout: o
|
|
501
512
|
})
|
|
502
513
|
), V = y(
|
|
503
514
|
this.failWith$,
|
|
504
515
|
this.pointerCancel$,
|
|
505
|
-
|
|
516
|
+
l,
|
|
506
517
|
g,
|
|
507
|
-
|
|
508
|
-
), I =
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
518
|
+
E
|
|
519
|
+
), I = P.pipe(
|
|
520
|
+
De,
|
|
521
|
+
c((w) => w.length <= a),
|
|
522
|
+
u((w) => ({
|
|
512
523
|
type: "tap",
|
|
513
|
-
taps:
|
|
514
|
-
latestActivePointers:
|
|
515
|
-
event:
|
|
524
|
+
taps: w.length,
|
|
525
|
+
latestActivePointers: w,
|
|
526
|
+
event: w[0]
|
|
516
527
|
})),
|
|
517
|
-
|
|
528
|
+
x(1)
|
|
518
529
|
);
|
|
519
530
|
return I.pipe(
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
...
|
|
531
|
+
Q,
|
|
532
|
+
Y(I),
|
|
533
|
+
u(([w, { type: L, taps: R }]) => ({
|
|
534
|
+
...w,
|
|
524
535
|
type: L,
|
|
525
536
|
taps: R
|
|
526
537
|
})),
|
|
@@ -529,118 +540,120 @@ class Te extends z {
|
|
|
529
540
|
})
|
|
530
541
|
);
|
|
531
542
|
}),
|
|
532
|
-
|
|
543
|
+
f()
|
|
533
544
|
);
|
|
534
545
|
}
|
|
535
546
|
update(e) {
|
|
536
547
|
super.update(e);
|
|
537
548
|
}
|
|
538
549
|
}
|
|
539
|
-
class
|
|
550
|
+
class Ce extends z {
|
|
540
551
|
constructor(e = {}) {
|
|
541
552
|
super(e, {
|
|
542
553
|
numInputs: 2,
|
|
543
554
|
posThreshold: 15,
|
|
544
555
|
...e.options
|
|
545
556
|
});
|
|
546
|
-
|
|
557
|
+
h(this, "events$");
|
|
547
558
|
this.events$ = this.config$.pipe(
|
|
548
559
|
v(() => {
|
|
549
560
|
const i = this.panStart$.pipe(
|
|
550
|
-
|
|
551
|
-
...
|
|
561
|
+
u((r) => ({
|
|
562
|
+
...r,
|
|
552
563
|
type: "rotateStart",
|
|
553
564
|
angle: 0,
|
|
554
565
|
deltaAngle: 0
|
|
555
566
|
})),
|
|
556
|
-
|
|
567
|
+
x(1)
|
|
557
568
|
), t = i.pipe(
|
|
558
569
|
v(
|
|
559
570
|
() => this.pan$.pipe(
|
|
560
|
-
O((
|
|
561
|
-
const
|
|
571
|
+
O((r, p) => {
|
|
572
|
+
const l = ((r == null ? void 0 : r.angle) ?? 0) + p.deltaPointersAngle;
|
|
562
573
|
return {
|
|
563
|
-
...p,
|
|
564
574
|
...r,
|
|
565
|
-
|
|
566
|
-
|
|
575
|
+
...p,
|
|
576
|
+
angle: l,
|
|
577
|
+
deltaAngle: p.deltaPointersAngle
|
|
567
578
|
};
|
|
568
579
|
}, void 0)
|
|
569
580
|
)
|
|
570
581
|
),
|
|
571
|
-
|
|
582
|
+
f()
|
|
572
583
|
), o = t.pipe(
|
|
573
|
-
|
|
574
|
-
|
|
584
|
+
c((r) => r.type === "move"),
|
|
585
|
+
u((r) => ({ ...r, type: "rotateMove" }))
|
|
575
586
|
), a = t.pipe(
|
|
576
|
-
|
|
577
|
-
|
|
587
|
+
c((r) => r.type === "end"),
|
|
588
|
+
u((r) => ({ ...r, type: "rotateEnd" }))
|
|
578
589
|
);
|
|
579
590
|
return y(i, o, a);
|
|
580
591
|
}),
|
|
581
|
-
|
|
592
|
+
f()
|
|
582
593
|
);
|
|
583
594
|
}
|
|
584
595
|
update(e) {
|
|
585
596
|
super.update(e, e.options);
|
|
586
597
|
}
|
|
587
598
|
}
|
|
588
|
-
const
|
|
599
|
+
const U = ({
|
|
589
600
|
type: n,
|
|
590
601
|
initialEvent: s
|
|
591
602
|
}) => (e) => e.pipe(
|
|
592
603
|
O((i, t) => {
|
|
593
|
-
const a = ((i == null ? void 0 : i.pointers.length) ?? 0) !== t.pointers.length,
|
|
604
|
+
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
605
|
return {
|
|
595
606
|
...i,
|
|
596
607
|
...t,
|
|
597
608
|
type: n,
|
|
598
|
-
initialPointersAverageDistance:
|
|
599
|
-
scale:
|
|
600
|
-
distance:
|
|
601
|
-
deltaDistance:
|
|
609
|
+
initialPointersAverageDistance: p,
|
|
610
|
+
scale: l,
|
|
611
|
+
distance: $,
|
|
612
|
+
deltaDistance: D,
|
|
602
613
|
deltaDistanceScale: d
|
|
603
614
|
};
|
|
604
615
|
}, s),
|
|
605
|
-
|
|
616
|
+
u(({ initialPointersAverageDistance: i, ...t }) => t)
|
|
606
617
|
);
|
|
607
|
-
class
|
|
618
|
+
class ze extends z {
|
|
608
619
|
constructor(e) {
|
|
609
620
|
super(e, {
|
|
610
621
|
...e == null ? void 0 : e.options,
|
|
611
622
|
numInputs: 2
|
|
612
623
|
});
|
|
613
|
-
|
|
624
|
+
h(this, "events$");
|
|
625
|
+
h(this, "start$");
|
|
626
|
+
const i = this.panStart$.pipe(
|
|
627
|
+
v(
|
|
628
|
+
(t) => b(t).pipe(
|
|
629
|
+
U({
|
|
630
|
+
type: "pinchStart",
|
|
631
|
+
initialEvent: void 0
|
|
632
|
+
})
|
|
633
|
+
)
|
|
634
|
+
),
|
|
635
|
+
f()
|
|
636
|
+
);
|
|
614
637
|
this.events$ = this.config$.pipe(
|
|
615
638
|
v(() => {
|
|
616
|
-
const i =
|
|
617
|
-
v(
|
|
618
|
-
(a) => T(a).pipe(
|
|
619
|
-
X({
|
|
620
|
-
type: "pinchStart",
|
|
621
|
-
initialEvent: void 0
|
|
622
|
-
})
|
|
623
|
-
)
|
|
624
|
-
),
|
|
625
|
-
E(1)
|
|
626
|
-
), t = i.pipe(
|
|
627
|
-
v((a) => this.pan$.pipe(
|
|
639
|
+
const t = i.pipe(x(1)), o = t.pipe(
|
|
640
|
+
v((r) => this.pan$.pipe(
|
|
628
641
|
N((p) => p.type !== "end"),
|
|
629
|
-
|
|
642
|
+
U({
|
|
630
643
|
type: "pinchMove",
|
|
631
|
-
initialEvent:
|
|
644
|
+
initialEvent: r
|
|
632
645
|
})
|
|
633
646
|
))
|
|
634
|
-
),
|
|
647
|
+
), a = t.pipe(
|
|
635
648
|
v(
|
|
636
|
-
(
|
|
649
|
+
(r) => this.pan$.pipe(
|
|
637
650
|
// we cannot have a panEnd without a previous event so it will always emit
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
651
|
+
he(r),
|
|
652
|
+
ce(),
|
|
653
|
+
c(([, p]) => p.type === "end"),
|
|
641
654
|
v(
|
|
642
|
-
([p,
|
|
643
|
-
|
|
655
|
+
([p, l]) => b(l).pipe(
|
|
656
|
+
U({
|
|
644
657
|
type: "pinchEnd",
|
|
645
658
|
initialEvent: p
|
|
646
659
|
})
|
|
@@ -649,26 +662,26 @@ class Ce extends z {
|
|
|
649
662
|
)
|
|
650
663
|
)
|
|
651
664
|
);
|
|
652
|
-
return y(
|
|
665
|
+
return y(t, o, a);
|
|
653
666
|
}),
|
|
654
|
-
|
|
655
|
-
);
|
|
667
|
+
f()
|
|
668
|
+
), this.start$ = i;
|
|
656
669
|
}
|
|
657
670
|
update(e) {
|
|
658
671
|
super.update(e, e.options);
|
|
659
672
|
}
|
|
660
673
|
}
|
|
661
|
-
class
|
|
674
|
+
class Re {
|
|
662
675
|
constructor(s) {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
676
|
+
h(this, "events$");
|
|
677
|
+
h(this, "recognizers");
|
|
678
|
+
h(this, "state$");
|
|
666
679
|
this.options = s, this.recognizers = s.recognizers, this.events$ = y(
|
|
667
680
|
...s.recognizers.map((e) => e.events$)
|
|
668
|
-
).pipe(
|
|
681
|
+
).pipe(f()), this.state$ = ue(
|
|
669
682
|
this.recognizers.map((e) => e.state$)
|
|
670
683
|
).pipe(
|
|
671
|
-
|
|
684
|
+
u(
|
|
672
685
|
(e) => e.reduce((i, t) => ({
|
|
673
686
|
fingers: Math.max(i.fingers, t.fingers)
|
|
674
687
|
}))
|
|
@@ -682,12 +695,12 @@ class ze {
|
|
|
682
695
|
}
|
|
683
696
|
}
|
|
684
697
|
export {
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
698
|
+
Se as PanRecognizer,
|
|
699
|
+
ze as PinchRecognizer,
|
|
700
|
+
Re as Recognizable,
|
|
688
701
|
z as Recognizer,
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
702
|
+
Ce as RotateRecognizer,
|
|
703
|
+
Te as SwipeRecognizer,
|
|
704
|
+
be as TapRecognizer
|
|
692
705
|
};
|
|
693
706
|
//# sourceMappingURL=index.js.map
|