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