gesturx 1.8.0 → 1.8.2

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