gesturx 1.8.0 → 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 +367 -365
- 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 =
|
|
92
|
+
b((r) => {
|
|
93
|
+
const l = pe(() => S(r));
|
|
94
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(
|
|
200
|
+
).pipe(h(n));
|
|
201
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(
|
|
254
|
+
const r = o.start$.pipe(h(() => !0)), l = o.end$.pipe(h(() => !1));
|
|
255
255
|
return v(r, l).pipe(
|
|
256
|
-
|
|
257
|
-
|
|
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
|
-
|
|
285
|
-
|
|
286
|
-
),
|
|
287
|
-
...
|
|
280
|
+
$,
|
|
281
|
+
H(({ pointers: y }) => {
|
|
282
|
+
const w = l.pipe(
|
|
283
|
+
m,
|
|
284
|
+
R(),
|
|
285
|
+
P()
|
|
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,93 +384,92 @@ 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
|
-
|
|
405
|
-
|
|
406
|
-
),
|
|
407
|
-
|
|
402
|
+
z(this.failWithActive$),
|
|
403
|
+
c(([, o]) => !o),
|
|
404
|
+
h(([o]) => o),
|
|
405
|
+
P()
|
|
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
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
)
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
)
|
|
418
|
+
this.events$ = s.pipe(
|
|
419
|
+
f((o) => {
|
|
420
|
+
let r = o;
|
|
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
|
+
}),
|
|
428
|
+
I($)
|
|
429
|
+
), g = $.pipe(
|
|
430
|
+
h(() => ({
|
|
431
|
+
...r,
|
|
432
|
+
type: "panEnd"
|
|
433
|
+
})),
|
|
434
|
+
I(i)
|
|
435
|
+
);
|
|
436
|
+
return v(m, g);
|
|
437
|
+
}),
|
|
438
|
+
P()
|
|
440
439
|
), this.start$ = this.events$.pipe(
|
|
441
|
-
|
|
442
|
-
), this.end$ = this.events$.pipe(
|
|
440
|
+
c((o) => o.type === "panStart")
|
|
441
|
+
), this.end$ = this.events$.pipe(c((o) => o.type === "panEnd"));
|
|
443
442
|
}
|
|
444
443
|
update(e) {
|
|
445
444
|
super.update(e, e.options);
|
|
446
445
|
}
|
|
447
446
|
}
|
|
448
|
-
const
|
|
449
|
-
|
|
447
|
+
const Me = (t) => (n) => n.pipe(
|
|
448
|
+
c((e) => Math.abs(e.velocityX) >= t || Math.abs(e.velocityY) >= t)
|
|
450
449
|
);
|
|
451
|
-
class
|
|
450
|
+
class be extends F {
|
|
452
451
|
constructor(e) {
|
|
453
452
|
super(e, {
|
|
454
453
|
posThreshold: 0,
|
|
455
454
|
numInputs: 1
|
|
456
455
|
});
|
|
457
|
-
|
|
456
|
+
u(this, "events$");
|
|
458
457
|
this.events$ = this.config$.pipe(
|
|
459
|
-
|
|
460
|
-
const { escapeVelocity:
|
|
458
|
+
f((s) => {
|
|
459
|
+
const { escapeVelocity: i = 0.9 } = s.options ?? {};
|
|
461
460
|
return this.panStart$.pipe(
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
461
|
+
f((p) => this.panEnd$.pipe(
|
|
462
|
+
Me(i),
|
|
463
|
+
h((a) => ({
|
|
465
464
|
type: "swipe",
|
|
466
|
-
angle:
|
|
465
|
+
angle: ge(
|
|
467
466
|
p.event,
|
|
468
467
|
a.event
|
|
469
468
|
),
|
|
470
469
|
...a
|
|
471
470
|
}))
|
|
472
471
|
)),
|
|
473
|
-
|
|
472
|
+
P()
|
|
474
473
|
);
|
|
475
474
|
})
|
|
476
475
|
);
|
|
@@ -479,127 +478,127 @@ class Se extends z {
|
|
|
479
478
|
super.update(e);
|
|
480
479
|
}
|
|
481
480
|
}
|
|
482
|
-
const
|
|
481
|
+
const Ee = ({
|
|
483
482
|
timeout: t,
|
|
484
483
|
pointerEvent$: n
|
|
485
484
|
}) => (e) => e.pipe(
|
|
486
|
-
|
|
487
|
-
(
|
|
488
|
-
|
|
489
|
-
n.pipe(
|
|
485
|
+
b(
|
|
486
|
+
(s) => J(t).pipe(
|
|
487
|
+
I(
|
|
488
|
+
n.pipe(ne, W(s))
|
|
490
489
|
)
|
|
491
490
|
)
|
|
492
491
|
)
|
|
493
|
-
),
|
|
492
|
+
), xe = ({
|
|
494
493
|
initialPointerEvent: t,
|
|
495
494
|
pointerEvent$: n,
|
|
496
495
|
tolerance: e
|
|
497
|
-
}) => (
|
|
498
|
-
|
|
499
|
-
(
|
|
500
|
-
|
|
501
|
-
V((p) => !
|
|
502
|
-
|
|
503
|
-
(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)
|
|
504
503
|
)
|
|
505
504
|
)
|
|
506
505
|
)
|
|
507
506
|
);
|
|
508
|
-
class
|
|
507
|
+
class Ce extends F {
|
|
509
508
|
constructor(e) {
|
|
510
509
|
super(e);
|
|
511
|
-
|
|
510
|
+
u(this, "events$");
|
|
512
511
|
this.events$ = this.config$.pipe(
|
|
513
|
-
|
|
514
|
-
var
|
|
515
|
-
const
|
|
516
|
-
|
|
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({
|
|
517
516
|
pointerEvent$: this.pointerEvent$,
|
|
518
517
|
trackMove: !0
|
|
519
518
|
}),
|
|
520
|
-
|
|
519
|
+
E(1)
|
|
521
520
|
), l = r.pipe(
|
|
522
|
-
|
|
523
|
-
),
|
|
521
|
+
c(({ pointers: D }) => D.length > 1)
|
|
522
|
+
), $ = (D) => D.pipe(
|
|
524
523
|
he(this.pointerUp$.pipe(ce(p))),
|
|
525
|
-
|
|
524
|
+
R()
|
|
526
525
|
);
|
|
527
526
|
return v(
|
|
528
527
|
this.pointerDown$,
|
|
529
528
|
r.pipe(le())
|
|
530
529
|
).pipe(
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
|
|
530
|
+
H((D) => {
|
|
531
|
+
const y = v(
|
|
532
|
+
S(D),
|
|
534
533
|
this.pointerDown$
|
|
535
|
-
).pipe(
|
|
536
|
-
|
|
537
|
-
initialPointerEvent:
|
|
534
|
+
).pipe(E(1)), w = y.pipe($), X = y.pipe(
|
|
535
|
+
xe({
|
|
536
|
+
initialPointerEvent: D,
|
|
538
537
|
pointerEvent$: this.pointerEvent$,
|
|
539
538
|
tolerance: o
|
|
540
539
|
})
|
|
541
|
-
), B =
|
|
542
|
-
|
|
540
|
+
), B = y.pipe(
|
|
541
|
+
Ee({
|
|
543
542
|
pointerEvent$: this.pointerEvent$,
|
|
544
543
|
timeout: a
|
|
545
544
|
})
|
|
546
545
|
), C = v(
|
|
547
|
-
this.failWithActive$.pipe(
|
|
546
|
+
this.failWithActive$.pipe(c((M) => M)),
|
|
548
547
|
this.pointerCancel$,
|
|
549
548
|
l,
|
|
550
|
-
|
|
549
|
+
X,
|
|
551
550
|
B
|
|
552
|
-
),
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
551
|
+
), O = w.pipe(
|
|
552
|
+
Ae,
|
|
553
|
+
c((M) => M.length <= i),
|
|
554
|
+
h((M) => ({
|
|
556
555
|
type: "tap",
|
|
557
|
-
taps:
|
|
558
|
-
latestActivePointers:
|
|
559
|
-
event:
|
|
556
|
+
taps: M.length,
|
|
557
|
+
latestActivePointers: M,
|
|
558
|
+
event: M[0]
|
|
560
559
|
})),
|
|
561
|
-
|
|
560
|
+
E(1)
|
|
562
561
|
);
|
|
563
|
-
return
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
...
|
|
568
|
-
type:
|
|
569
|
-
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
|
|
570
569
|
})),
|
|
571
|
-
|
|
570
|
+
I(C)
|
|
572
571
|
);
|
|
573
572
|
})
|
|
574
573
|
);
|
|
575
574
|
}),
|
|
576
|
-
|
|
575
|
+
P()
|
|
577
576
|
);
|
|
578
577
|
}
|
|
579
578
|
update(e) {
|
|
580
579
|
super.update(e);
|
|
581
580
|
}
|
|
582
581
|
}
|
|
583
|
-
class
|
|
582
|
+
class Re extends F {
|
|
584
583
|
constructor(e = {}) {
|
|
585
584
|
super(e, {
|
|
586
585
|
numInputs: 2,
|
|
587
586
|
posThreshold: 15,
|
|
588
587
|
...e.options
|
|
589
588
|
});
|
|
590
|
-
|
|
589
|
+
u(this, "events$");
|
|
591
590
|
this.events$ = this.config$.pipe(
|
|
592
|
-
|
|
593
|
-
const
|
|
594
|
-
|
|
591
|
+
f(() => {
|
|
592
|
+
const s = this.panStart$.pipe(
|
|
593
|
+
h((o) => ({
|
|
595
594
|
...o,
|
|
596
595
|
type: "rotateStart",
|
|
597
596
|
angle: 0,
|
|
598
597
|
deltaAngle: 0
|
|
599
598
|
})),
|
|
600
|
-
|
|
601
|
-
),
|
|
602
|
-
|
|
599
|
+
E(1)
|
|
600
|
+
), i = s.pipe(
|
|
601
|
+
f(
|
|
603
602
|
() => this.pan$.pipe(
|
|
604
603
|
U((o, r) => {
|
|
605
604
|
const l = ((o == null ? void 0 : o.angle) ?? 0) + r.deltaPointersAngle;
|
|
@@ -612,114 +611,117 @@ class Ce extends z {
|
|
|
612
611
|
}, void 0)
|
|
613
612
|
)
|
|
614
613
|
),
|
|
615
|
-
|
|
616
|
-
), p =
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
), a =
|
|
620
|
-
|
|
621
|
-
|
|
614
|
+
P()
|
|
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" }))
|
|
622
621
|
);
|
|
623
|
-
return v(
|
|
622
|
+
return v(s, p, a);
|
|
624
623
|
}),
|
|
625
|
-
|
|
624
|
+
P()
|
|
626
625
|
);
|
|
627
626
|
}
|
|
628
627
|
update(e) {
|
|
629
628
|
super.update(e, e.options);
|
|
630
629
|
}
|
|
631
630
|
}
|
|
632
|
-
const
|
|
631
|
+
const Y = ({
|
|
633
632
|
type: t,
|
|
634
633
|
initialEvent: n
|
|
635
634
|
}) => (e) => e.pipe(
|
|
636
|
-
U((
|
|
637
|
-
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;
|
|
638
637
|
return {
|
|
639
|
-
...i,
|
|
640
638
|
...s,
|
|
639
|
+
...i,
|
|
641
640
|
type: t,
|
|
642
641
|
initialPointersAverageDistance: r,
|
|
643
642
|
scale: l,
|
|
644
|
-
distance:
|
|
645
|
-
deltaDistance:
|
|
646
|
-
deltaDistanceScale:
|
|
643
|
+
distance: $,
|
|
644
|
+
deltaDistance: m,
|
|
645
|
+
deltaDistanceScale: g
|
|
647
646
|
};
|
|
648
647
|
}, n),
|
|
649
|
-
|
|
648
|
+
h(({ initialPointersAverageDistance: s, ...i }) => i)
|
|
650
649
|
);
|
|
651
|
-
class
|
|
650
|
+
class ze extends F {
|
|
652
651
|
constructor(e) {
|
|
653
652
|
super(e, {
|
|
654
653
|
...e == null ? void 0 : e.options,
|
|
655
654
|
numInputs: 2
|
|
656
655
|
});
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
)
|
|
669
|
-
w()
|
|
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
|
+
}),
|
|
667
|
+
P()
|
|
670
668
|
);
|
|
671
669
|
this.events$ = this.config$.pipe(
|
|
672
|
-
|
|
673
|
-
const
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
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({
|
|
677
678
|
type: "pinchMove",
|
|
678
|
-
initialEvent:
|
|
679
|
+
initialEvent: r
|
|
679
680
|
})
|
|
680
|
-
))
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
$
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
)
|
|
696
|
-
|
|
697
|
-
|
|
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
|
+
})
|
|
698
700
|
);
|
|
699
|
-
return v(
|
|
701
|
+
return v(i, a, o);
|
|
700
702
|
}),
|
|
701
|
-
|
|
703
|
+
P()
|
|
702
704
|
), this.start$ = this.events$.pipe(
|
|
703
|
-
|
|
704
|
-
), this.end$ = this.events$.pipe(
|
|
705
|
+
c((i) => i.type === "pinchStart")
|
|
706
|
+
), this.end$ = this.events$.pipe(c((i) => i.type === "pinchEnd"));
|
|
705
707
|
}
|
|
706
708
|
update(e) {
|
|
707
709
|
super.update(e, e.options);
|
|
708
710
|
}
|
|
709
711
|
}
|
|
710
|
-
class
|
|
712
|
+
class ke {
|
|
711
713
|
constructor(n) {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
714
|
+
u(this, "events$");
|
|
715
|
+
u(this, "recognizers");
|
|
716
|
+
u(this, "state$");
|
|
715
717
|
this.options = n, this.recognizers = n.recognizers, this.events$ = v(
|
|
716
718
|
...n.recognizers.map((e) => e.events$)
|
|
717
|
-
).pipe(
|
|
719
|
+
).pipe(P()), this.state$ = j(
|
|
718
720
|
this.recognizers.map((e) => e.state$)
|
|
719
721
|
).pipe(
|
|
720
|
-
|
|
721
|
-
(e) => e.reduce((
|
|
722
|
-
fingers: Math.max(
|
|
722
|
+
h(
|
|
723
|
+
(e) => e.reduce((s, i) => ({
|
|
724
|
+
fingers: Math.max(s.fingers, i.fingers)
|
|
723
725
|
}))
|
|
724
726
|
)
|
|
725
727
|
), this.update(n);
|
|
@@ -731,12 +733,12 @@ class ze {
|
|
|
731
733
|
}
|
|
732
734
|
}
|
|
733
735
|
export {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
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
|
|
741
743
|
};
|
|
742
744
|
//# sourceMappingURL=index.js.map
|