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