gesturx 1.7.6 → 1.8.0
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 +438 -402
- 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 v, takeWhile as V, scan as U, map as c, BehaviorSubject as q, switchMap as y, distinctUntilChanged as re, startWith as H, shareReplay as M, combineLatest as W, exhaustMap as J, first as F, share as w, 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 =
|
|
94
|
-
return
|
|
91
|
+
return n.pipe(
|
|
92
|
+
S((r) => {
|
|
93
|
+
const l = oe(() => T(r));
|
|
94
|
+
return v(
|
|
95
95
|
l,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
v(
|
|
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(
|
|
201
|
-
return
|
|
200
|
+
).pipe(c(n));
|
|
201
|
+
return v(
|
|
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
|
+
y(
|
|
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
|
+
y((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 v(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
|
+
y((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
|
+
w()
|
|
286
|
+
), Y = K(r), C = v(
|
|
287
|
+
...m.map((g) => T(g)),
|
|
274
288
|
this.pointerDown$
|
|
275
289
|
).pipe(
|
|
276
|
-
|
|
277
|
-
(
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
290
|
+
S(
|
|
291
|
+
(g) => v(this.pointerMove$, T(g)).pipe(
|
|
292
|
+
X(g),
|
|
293
|
+
h(
|
|
294
|
+
(x) => Z(
|
|
295
|
+
g,
|
|
296
|
+
x,
|
|
297
|
+
o
|
|
284
298
|
)
|
|
285
299
|
)
|
|
286
300
|
)
|
|
287
301
|
),
|
|
288
|
-
|
|
302
|
+
F()
|
|
289
303
|
).pipe(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
304
|
+
y(() => Y),
|
|
305
|
+
L(l),
|
|
306
|
+
c(([, { event: g, pointers: x }]) => ({
|
|
293
307
|
type: "start",
|
|
294
|
-
event:
|
|
295
|
-
latestActivePointers:
|
|
308
|
+
event: g,
|
|
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: g, pointers: x }) => ({
|
|
307
321
|
type: "move",
|
|
308
|
-
event:
|
|
309
|
-
latestActivePointers:
|
|
322
|
+
event: g,
|
|
323
|
+
latestActivePointers: x
|
|
310
324
|
}))
|
|
311
325
|
)
|
|
312
326
|
),
|
|
313
|
-
|
|
314
|
-
),
|
|
315
|
-
|
|
316
|
-
() =>
|
|
317
|
-
|
|
327
|
+
b(D)
|
|
328
|
+
), P = C.pipe(
|
|
329
|
+
S(
|
|
330
|
+
() => D.pipe(
|
|
331
|
+
c(({ event: g, pointers: x }) => ({
|
|
318
332
|
type: "end",
|
|
319
|
-
event:
|
|
320
|
-
latestActivePointers:
|
|
333
|
+
event: g,
|
|
334
|
+
latestActivePointers: x
|
|
321
335
|
}))
|
|
322
336
|
)
|
|
323
337
|
)
|
|
324
|
-
),
|
|
325
|
-
|
|
338
|
+
), O = v(C, k, P).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(([g, { type: x }]) => ({
|
|
345
|
+
...g,
|
|
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
|
+
w()
|
|
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,97 @@ 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
|
+
w()
|
|
406
|
+
), s = this.panEnd$.pipe(
|
|
407
|
+
c((o) => ({
|
|
391
408
|
type: "panEnd",
|
|
392
|
-
...
|
|
409
|
+
...o
|
|
393
410
|
})),
|
|
394
|
-
|
|
411
|
+
w()
|
|
412
|
+
), p = this.panMove$.pipe(
|
|
413
|
+
c((o) => ({
|
|
414
|
+
type: "panMove",
|
|
415
|
+
...o
|
|
416
|
+
}))
|
|
395
417
|
);
|
|
396
|
-
this.events$ =
|
|
397
|
-
i
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
418
|
+
this.events$ = v(
|
|
419
|
+
i.pipe(
|
|
420
|
+
y((o) => {
|
|
421
|
+
let r = o;
|
|
422
|
+
const l = this.failWithActive$.pipe(
|
|
423
|
+
h((d) => d),
|
|
424
|
+
F()
|
|
425
|
+
), u = v(T(o), p, s).pipe(
|
|
426
|
+
Q((d) => {
|
|
427
|
+
r = d;
|
|
428
|
+
}),
|
|
429
|
+
b(l)
|
|
430
|
+
), f = l.pipe(
|
|
431
|
+
c(() => ({
|
|
432
|
+
...r,
|
|
433
|
+
type: "panEnd"
|
|
434
|
+
})),
|
|
435
|
+
b(s)
|
|
436
|
+
);
|
|
437
|
+
return v(u, f);
|
|
438
|
+
})
|
|
439
|
+
)
|
|
440
|
+
), this.start$ = this.events$.pipe(
|
|
441
|
+
h((o) => o.type === "panStart")
|
|
442
|
+
), this.end$ = this.events$.pipe(h((o) => o.type === "panEnd"));
|
|
406
443
|
}
|
|
407
444
|
update(e) {
|
|
408
445
|
super.update(e, e.options);
|
|
409
446
|
}
|
|
410
447
|
}
|
|
411
|
-
const we = (
|
|
412
|
-
|
|
448
|
+
const we = (t) => (n) => n.pipe(
|
|
449
|
+
h((e) => Math.abs(e.velocityX) >= t || Math.abs(e.velocityY) >= t)
|
|
413
450
|
);
|
|
414
|
-
class
|
|
451
|
+
class Se extends z {
|
|
415
452
|
constructor(e) {
|
|
416
453
|
super(e, {
|
|
417
454
|
posThreshold: 0,
|
|
418
455
|
numInputs: 1
|
|
419
456
|
});
|
|
420
|
-
|
|
457
|
+
$(this, "events$");
|
|
421
458
|
this.events$ = this.config$.pipe(
|
|
422
|
-
|
|
423
|
-
const { escapeVelocity:
|
|
459
|
+
y((i) => {
|
|
460
|
+
const { escapeVelocity: s = 0.9 } = i.options ?? {};
|
|
424
461
|
return this.panStart$.pipe(
|
|
425
|
-
|
|
426
|
-
we(
|
|
427
|
-
|
|
462
|
+
y((p) => this.panEnd$.pipe(
|
|
463
|
+
we(s),
|
|
464
|
+
c((a) => ({
|
|
428
465
|
type: "swipe",
|
|
429
|
-
angle:
|
|
430
|
-
|
|
466
|
+
angle: ve(
|
|
467
|
+
p.event,
|
|
431
468
|
a.event
|
|
432
469
|
),
|
|
433
470
|
...a
|
|
434
471
|
}))
|
|
435
472
|
)),
|
|
436
|
-
|
|
473
|
+
w()
|
|
437
474
|
);
|
|
438
475
|
})
|
|
439
476
|
);
|
|
@@ -443,27 +480,27 @@ class Te extends z {
|
|
|
443
480
|
}
|
|
444
481
|
}
|
|
445
482
|
const Me = ({
|
|
446
|
-
timeout:
|
|
447
|
-
pointerEvent$:
|
|
483
|
+
timeout: t,
|
|
484
|
+
pointerEvent$: n
|
|
448
485
|
}) => (e) => e.pipe(
|
|
449
|
-
|
|
450
|
-
(i) =>
|
|
451
|
-
|
|
452
|
-
|
|
486
|
+
S(
|
|
487
|
+
(i) => K(t).pipe(
|
|
488
|
+
b(
|
|
489
|
+
n.pipe(ie, X(i))
|
|
453
490
|
)
|
|
454
491
|
)
|
|
455
492
|
)
|
|
456
|
-
),
|
|
457
|
-
initialPointerEvent:
|
|
458
|
-
pointerEvent$:
|
|
493
|
+
), Ee = ({
|
|
494
|
+
initialPointerEvent: t,
|
|
495
|
+
pointerEvent$: n,
|
|
459
496
|
tolerance: e
|
|
460
497
|
}) => (i) => i.pipe(
|
|
461
|
-
|
|
462
|
-
(
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
(
|
|
498
|
+
S(
|
|
499
|
+
(s) => n.pipe(
|
|
500
|
+
X(s),
|
|
501
|
+
V((p) => !ee(p), !0),
|
|
502
|
+
h(
|
|
503
|
+
(p) => Z(t, p, e)
|
|
467
504
|
)
|
|
468
505
|
)
|
|
469
506
|
)
|
|
@@ -471,76 +508,72 @@ const Me = ({
|
|
|
471
508
|
class be extends z {
|
|
472
509
|
constructor(e) {
|
|
473
510
|
super(e);
|
|
474
|
-
|
|
511
|
+
$(this, "events$");
|
|
475
512
|
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({
|
|
513
|
+
y((i) => {
|
|
514
|
+
var d, E;
|
|
515
|
+
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(
|
|
516
|
+
te({
|
|
484
517
|
pointerEvent$: this.pointerEvent$,
|
|
485
518
|
trackMove: !0
|
|
486
519
|
}),
|
|
487
|
-
|
|
488
|
-
), l =
|
|
489
|
-
|
|
490
|
-
),
|
|
491
|
-
|
|
492
|
-
|
|
520
|
+
M(1)
|
|
521
|
+
), l = r.pipe(
|
|
522
|
+
h(({ pointers: A }) => A.length > 1)
|
|
523
|
+
), u = (A) => A.pipe(
|
|
524
|
+
he(this.pointerUp$.pipe(ce(p))),
|
|
525
|
+
F()
|
|
493
526
|
);
|
|
494
|
-
return
|
|
527
|
+
return v(
|
|
495
528
|
this.pointerDown$,
|
|
496
|
-
|
|
529
|
+
r.pipe(le())
|
|
497
530
|
).pipe(
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
531
|
+
J((A) => {
|
|
532
|
+
const m = v(
|
|
533
|
+
T(A),
|
|
501
534
|
this.pointerDown$
|
|
502
|
-
).pipe(
|
|
503
|
-
|
|
504
|
-
initialPointerEvent:
|
|
535
|
+
).pipe(M(1)), D = m.pipe(u), Y = m.pipe(
|
|
536
|
+
Ee({
|
|
537
|
+
initialPointerEvent: A,
|
|
505
538
|
pointerEvent$: this.pointerEvent$,
|
|
506
|
-
tolerance:
|
|
539
|
+
tolerance: o
|
|
507
540
|
})
|
|
508
|
-
),
|
|
541
|
+
), B = m.pipe(
|
|
509
542
|
Me({
|
|
510
543
|
pointerEvent$: this.pointerEvent$,
|
|
511
|
-
timeout:
|
|
544
|
+
timeout: a
|
|
512
545
|
})
|
|
513
|
-
),
|
|
514
|
-
this.
|
|
546
|
+
), C = v(
|
|
547
|
+
this.failWithActive$.pipe(h((P) => P)),
|
|
515
548
|
this.pointerCancel$,
|
|
516
549
|
l,
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
),
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
550
|
+
Y,
|
|
551
|
+
B
|
|
552
|
+
), k = D.pipe(
|
|
553
|
+
fe,
|
|
554
|
+
h((P) => P.length <= s),
|
|
555
|
+
c((P) => ({
|
|
523
556
|
type: "tap",
|
|
524
|
-
taps:
|
|
525
|
-
latestActivePointers:
|
|
526
|
-
event:
|
|
557
|
+
taps: P.length,
|
|
558
|
+
latestActivePointers: P,
|
|
559
|
+
event: P[0]
|
|
527
560
|
})),
|
|
528
|
-
|
|
561
|
+
M(1)
|
|
529
562
|
);
|
|
530
|
-
return
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
...
|
|
535
|
-
type:
|
|
536
|
-
taps:
|
|
563
|
+
return k.pipe(
|
|
564
|
+
ne,
|
|
565
|
+
L(k),
|
|
566
|
+
c(([P, { type: O, taps: g }]) => ({
|
|
567
|
+
...P,
|
|
568
|
+
type: O,
|
|
569
|
+
taps: g
|
|
537
570
|
})),
|
|
538
|
-
|
|
571
|
+
b(C)
|
|
539
572
|
);
|
|
540
573
|
})
|
|
541
574
|
);
|
|
542
575
|
}),
|
|
543
|
-
|
|
576
|
+
w()
|
|
544
577
|
);
|
|
545
578
|
}
|
|
546
579
|
update(e) {
|
|
@@ -554,153 +587,156 @@ class Ce extends z {
|
|
|
554
587
|
posThreshold: 15,
|
|
555
588
|
...e.options
|
|
556
589
|
});
|
|
557
|
-
|
|
590
|
+
$(this, "events$");
|
|
558
591
|
this.events$ = this.config$.pipe(
|
|
559
|
-
|
|
592
|
+
y(() => {
|
|
560
593
|
const i = this.panStart$.pipe(
|
|
561
|
-
|
|
562
|
-
...
|
|
594
|
+
c((o) => ({
|
|
595
|
+
...o,
|
|
563
596
|
type: "rotateStart",
|
|
564
597
|
angle: 0,
|
|
565
598
|
deltaAngle: 0
|
|
566
599
|
})),
|
|
567
|
-
|
|
568
|
-
),
|
|
569
|
-
|
|
600
|
+
M(1)
|
|
601
|
+
), s = i.pipe(
|
|
602
|
+
y(
|
|
570
603
|
() => this.pan$.pipe(
|
|
571
|
-
|
|
572
|
-
const l = ((
|
|
604
|
+
U((o, r) => {
|
|
605
|
+
const l = ((o == null ? void 0 : o.angle) ?? 0) + r.deltaPointersAngle;
|
|
573
606
|
return {
|
|
607
|
+
...o,
|
|
574
608
|
...r,
|
|
575
|
-
...p,
|
|
576
609
|
angle: l,
|
|
577
|
-
deltaAngle:
|
|
610
|
+
deltaAngle: r.deltaPointersAngle
|
|
578
611
|
};
|
|
579
612
|
}, void 0)
|
|
580
613
|
)
|
|
581
614
|
),
|
|
582
|
-
|
|
583
|
-
),
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
), a =
|
|
587
|
-
|
|
588
|
-
|
|
615
|
+
w()
|
|
616
|
+
), p = s.pipe(
|
|
617
|
+
h((o) => o.type === "move"),
|
|
618
|
+
c((o) => ({ ...o, type: "rotateMove" }))
|
|
619
|
+
), a = s.pipe(
|
|
620
|
+
h((o) => o.type === "end"),
|
|
621
|
+
c((o) => ({ ...o, type: "rotateEnd" }))
|
|
589
622
|
);
|
|
590
|
-
return
|
|
623
|
+
return v(i, p, a);
|
|
591
624
|
}),
|
|
592
|
-
|
|
625
|
+
w()
|
|
593
626
|
);
|
|
594
627
|
}
|
|
595
628
|
update(e) {
|
|
596
629
|
super.update(e, e.options);
|
|
597
630
|
}
|
|
598
631
|
}
|
|
599
|
-
const
|
|
600
|
-
type:
|
|
601
|
-
initialEvent:
|
|
632
|
+
const j = ({
|
|
633
|
+
type: t,
|
|
634
|
+
initialEvent: n
|
|
602
635
|
}) => (e) => e.pipe(
|
|
603
|
-
|
|
604
|
-
const a = ((i == null ? void 0 : i.pointers.length) ?? 0) !==
|
|
636
|
+
U((i, s) => {
|
|
637
|
+
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
638
|
return {
|
|
606
639
|
...i,
|
|
607
|
-
...
|
|
608
|
-
type:
|
|
609
|
-
initialPointersAverageDistance:
|
|
640
|
+
...s,
|
|
641
|
+
type: t,
|
|
642
|
+
initialPointersAverageDistance: r,
|
|
610
643
|
scale: l,
|
|
611
|
-
distance:
|
|
612
|
-
deltaDistance:
|
|
644
|
+
distance: u,
|
|
645
|
+
deltaDistance: f,
|
|
613
646
|
deltaDistanceScale: d
|
|
614
647
|
};
|
|
615
|
-
},
|
|
616
|
-
|
|
648
|
+
}, n),
|
|
649
|
+
c(({ initialPointersAverageDistance: i, ...s }) => s)
|
|
617
650
|
);
|
|
618
|
-
class
|
|
651
|
+
class Re extends z {
|
|
619
652
|
constructor(e) {
|
|
620
653
|
super(e, {
|
|
621
654
|
...e == null ? void 0 : e.options,
|
|
622
655
|
numInputs: 2
|
|
623
656
|
});
|
|
624
|
-
|
|
625
|
-
|
|
657
|
+
$(this, "events$");
|
|
658
|
+
$(this, "start$");
|
|
659
|
+
$(this, "end$");
|
|
626
660
|
const i = this.panStart$.pipe(
|
|
627
|
-
|
|
628
|
-
(
|
|
629
|
-
|
|
661
|
+
y(
|
|
662
|
+
(s) => T(s).pipe(
|
|
663
|
+
j({
|
|
630
664
|
type: "pinchStart",
|
|
631
665
|
initialEvent: void 0
|
|
632
666
|
})
|
|
633
667
|
)
|
|
634
668
|
),
|
|
635
|
-
|
|
669
|
+
w()
|
|
636
670
|
);
|
|
637
671
|
this.events$ = this.config$.pipe(
|
|
638
|
-
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
672
|
+
y(() => {
|
|
673
|
+
const s = i.pipe(M(1)), p = s.pipe(
|
|
674
|
+
y((o) => this.pan$.pipe(
|
|
675
|
+
V((r) => r.type !== "end"),
|
|
676
|
+
j({
|
|
643
677
|
type: "pinchMove",
|
|
644
|
-
initialEvent:
|
|
678
|
+
initialEvent: o
|
|
645
679
|
})
|
|
646
680
|
))
|
|
647
|
-
), a =
|
|
648
|
-
|
|
649
|
-
(
|
|
681
|
+
), a = s.pipe(
|
|
682
|
+
y(
|
|
683
|
+
(o) => this.pan$.pipe(
|
|
650
684
|
// we cannot have a panEnd without a previous event so it will always emit
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
([
|
|
656
|
-
|
|
685
|
+
H(o),
|
|
686
|
+
$e(),
|
|
687
|
+
h(([, r]) => r.type === "end"),
|
|
688
|
+
y(
|
|
689
|
+
([r, l]) => T(l).pipe(
|
|
690
|
+
j({
|
|
657
691
|
type: "pinchEnd",
|
|
658
|
-
initialEvent:
|
|
692
|
+
initialEvent: r
|
|
659
693
|
})
|
|
660
694
|
)
|
|
661
695
|
)
|
|
662
696
|
)
|
|
663
697
|
)
|
|
664
698
|
);
|
|
665
|
-
return
|
|
699
|
+
return v(s, p, a);
|
|
666
700
|
}),
|
|
667
|
-
|
|
668
|
-
), this.start$ =
|
|
701
|
+
w()
|
|
702
|
+
), this.start$ = this.events$.pipe(
|
|
703
|
+
h((s) => s.type === "pinchStart")
|
|
704
|
+
), this.end$ = this.events$.pipe(h((s) => s.type === "pinchEnd"));
|
|
669
705
|
}
|
|
670
706
|
update(e) {
|
|
671
707
|
super.update(e, e.options);
|
|
672
708
|
}
|
|
673
709
|
}
|
|
674
|
-
class
|
|
675
|
-
constructor(
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
this.options =
|
|
680
|
-
...
|
|
681
|
-
).pipe(
|
|
710
|
+
class ze {
|
|
711
|
+
constructor(n) {
|
|
712
|
+
$(this, "events$");
|
|
713
|
+
$(this, "recognizers");
|
|
714
|
+
$(this, "state$");
|
|
715
|
+
this.options = n, this.recognizers = n.recognizers, this.events$ = v(
|
|
716
|
+
...n.recognizers.map((e) => e.events$)
|
|
717
|
+
).pipe(w()), this.state$ = W(
|
|
682
718
|
this.recognizers.map((e) => e.state$)
|
|
683
719
|
).pipe(
|
|
684
|
-
|
|
685
|
-
(e) => e.reduce((i,
|
|
686
|
-
fingers: Math.max(i.fingers,
|
|
720
|
+
c(
|
|
721
|
+
(e) => e.reduce((i, s) => ({
|
|
722
|
+
fingers: Math.max(i.fingers, s.fingers)
|
|
687
723
|
}))
|
|
688
724
|
)
|
|
689
|
-
), this.update(
|
|
725
|
+
), this.update(n);
|
|
690
726
|
}
|
|
691
|
-
update(
|
|
692
|
-
|
|
693
|
-
e.update(
|
|
727
|
+
update(n) {
|
|
728
|
+
n.container && (n.container.style.touchAction = "none", n.container.style.userSelect = "none"), this.options.recognizers.forEach((e) => {
|
|
729
|
+
e.update(n);
|
|
694
730
|
});
|
|
695
731
|
}
|
|
696
732
|
}
|
|
697
733
|
export {
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
734
|
+
Ie as PanRecognizer,
|
|
735
|
+
Re as PinchRecognizer,
|
|
736
|
+
ze as Recognizable,
|
|
701
737
|
z as Recognizer,
|
|
702
738
|
Ce as RotateRecognizer,
|
|
703
|
-
|
|
739
|
+
Se as SwipeRecognizer,
|
|
704
740
|
be as TapRecognizer
|
|
705
741
|
};
|
|
706
742
|
//# sourceMappingURL=index.js.map
|