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