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