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