gesturx 1.11.9 → 1.11.11
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 +34 -0
- package/dist/index.js +108 -103
- 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.d.ts
CHANGED
|
@@ -7,6 +7,27 @@ export declare interface FailWith {
|
|
|
7
7
|
end$: Observable<unknown>;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export declare interface HoldEvent extends RecognizerEvent {
|
|
11
|
+
type: "holdStart" | "holdEnd";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export declare class HoldRecognizer extends Recognizer<HoldRecognizerOptions, HoldEvent> implements HoldRecognizerInterface {
|
|
15
|
+
events$: Observable<HoldEvent>;
|
|
16
|
+
constructor(options?: RecognizerConfig<HoldRecognizerOptions>);
|
|
17
|
+
update(options: RecognizerConfig<HoldRecognizerOptions>): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare interface HoldRecognizerInterface extends Recognizer<HoldRecognizerOptions, HoldEvent> {
|
|
21
|
+
events$: Observable<HoldEvent>;
|
|
22
|
+
update(options: RecognizerConfig<HoldRecognizerOptions>): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare interface HoldRecognizerOptions {
|
|
26
|
+
posThreshold?: number;
|
|
27
|
+
delay?: number;
|
|
28
|
+
numInputs?: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
10
31
|
declare type PanConfig = {
|
|
11
32
|
posThreshold?: number;
|
|
12
33
|
delay?: number;
|
|
@@ -146,6 +167,7 @@ export declare abstract class Recognizer<Options extends object = never, Event e
|
|
|
146
167
|
protected configSubject: BehaviorSubject<RecognizerConfig<Options> & {
|
|
147
168
|
panConfig?: PanConfig;
|
|
148
169
|
}>;
|
|
170
|
+
private stateSubject;
|
|
149
171
|
protected pan$: Observable<RecognizerPanEvent>;
|
|
150
172
|
protected panStart$: Observable<RecognizerEvent>;
|
|
151
173
|
protected panMove$: Observable<RecognizerEvent>;
|
|
@@ -167,6 +189,12 @@ export declare abstract class Recognizer<Options extends object = never, Event e
|
|
|
167
189
|
* Track active running failWith recognizers
|
|
168
190
|
*/
|
|
169
191
|
protected failWithActive$: Observable<boolean>;
|
|
192
|
+
/**
|
|
193
|
+
* Reports in state$ the fingers of the gesture the recognizer's events
|
|
194
|
+
* recognize, until `isEnd` tells its end event, or until nothing listens
|
|
195
|
+
* to them anymore.
|
|
196
|
+
*/
|
|
197
|
+
protected reportFingers: (isEnd: (event: Event) => boolean) => (events$: Observable<Event>) => Observable<Event>;
|
|
170
198
|
constructor(config?: RecognizerConfig<Options>, panConfig?: PanConfig);
|
|
171
199
|
private updateInternal;
|
|
172
200
|
update(config: Partial<RecognizerConfig<Options>>, panConfig?: PanConfig): void;
|
|
@@ -265,6 +293,12 @@ declare interface RotateRecognizerOptions {
|
|
|
265
293
|
}
|
|
266
294
|
|
|
267
295
|
export declare type State = {
|
|
296
|
+
/**
|
|
297
|
+
* Fingers of the gesture the recognizer recognizes, as of its latest
|
|
298
|
+
* event, from its start event until its end event. None the rest of the
|
|
299
|
+
* time, and none for a gesture recognized once the fingers are lifted,
|
|
300
|
+
* as a tap or a swipe.
|
|
301
|
+
*/
|
|
268
302
|
fingers: number;
|
|
269
303
|
};
|
|
270
304
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BehaviorSubject as e, buffer as t, combineLatest as n, debounceTime as r, defaultIfEmpty as i, defer as a, distinctUntilChanged as o, exhaustMap as s, filter as c,
|
|
1
|
+
import { BehaviorSubject as e, buffer as t, combineLatest as n, debounceTime as r, defaultIfEmpty as i, defer as a, distinctUntilChanged as o, exhaustMap as s, filter as c, finalize as l, first as u, fromEvent as d, ignoreElements as f, map as p, merge as m, mergeMap as h, of as g, scan as _, share as v, shareReplay as y, skip as ee, startWith as b, switchMap as x, takeUntil as S, takeWhile as C, tap as w, timer as T, withLatestFrom as E } from "rxjs";
|
|
2
2
|
//#region src/core/utils/geometry.ts
|
|
3
3
|
function D(e, t) {
|
|
4
4
|
return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2);
|
|
@@ -56,17 +56,17 @@ var L = (e, t, n) => ({
|
|
|
56
56
|
function R(e) {
|
|
57
57
|
return (t) => t.pipe(c((t) => t.pointerId === e.pointerId));
|
|
58
58
|
}
|
|
59
|
-
var z = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type === "pointerup",
|
|
60
|
-
let n = e.pipe(c((e) => e.type === "pointerup")), r = e.pipe(c((e) => e.type === "pointerleave")), i = e.pipe(c((e) => e.type === "pointercancel")), o = e.pipe(c((e) => e.type === "pointermove")), s =
|
|
59
|
+
var z = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type === "pointerup", te = (e) => e.button === 0, ne = ({ container: e, afterEventReceived: t = (e) => e }) => d(e, "pointerdown").pipe(p(t), c(te)), B = ({ pointerEvent$: e }) => (t) => {
|
|
60
|
+
let n = e.pipe(c((e) => e.type === "pointerup")), r = e.pipe(c((e) => e.type === "pointerleave")), i = e.pipe(c((e) => e.type === "pointercancel")), o = e.pipe(c((e) => e.type === "pointermove")), s = d(window, "contextmenu"), l = (e) => [
|
|
61
61
|
"pointercancel",
|
|
62
62
|
"pointerleave",
|
|
63
63
|
"pointerup",
|
|
64
64
|
"contextmenu"
|
|
65
65
|
].includes(e.type);
|
|
66
|
-
return t.pipe(
|
|
67
|
-
let t = a(() =>
|
|
68
|
-
return
|
|
69
|
-
}),
|
|
66
|
+
return t.pipe(h((e) => {
|
|
67
|
+
let t = a(() => g(e));
|
|
68
|
+
return m(t, m(o, i, r, n, s)).pipe(R(e), C((e) => !l(e), !0));
|
|
69
|
+
}), _((e, t) => {
|
|
70
70
|
if (l(t)) {
|
|
71
71
|
let { [t.pointerId]: n, ...r } = (e == null ? void 0 : e.pointers) ?? {};
|
|
72
72
|
return {
|
|
@@ -81,16 +81,19 @@ var z = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type
|
|
|
81
81
|
[t.pointerId]: t
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
}, void 0),
|
|
84
|
+
}, void 0), p(({ event: e, pointers: t }) => ({
|
|
85
85
|
event: e,
|
|
86
86
|
pointers: Object.values(t).filter(N)
|
|
87
87
|
})));
|
|
88
|
-
},
|
|
88
|
+
}, V = () => y({
|
|
89
|
+
bufferSize: 1,
|
|
90
|
+
refCount: !0
|
|
91
|
+
}), H = (e) => e.pipe(c((e) => !!e.container)), U = (e) => e.pipe(c(z)), W = (e, t, n, r) => ({
|
|
89
92
|
deltaX: e.x - t.x + n,
|
|
90
93
|
deltaY: e.y - t.y + r
|
|
91
94
|
}), G = (e) => {
|
|
92
95
|
let t = (e) => j(e.latestActivePointers.length ? e.latestActivePointers : [e.event]);
|
|
93
|
-
return e.pipe(
|
|
96
|
+
return e.pipe(_((e, n) => {
|
|
94
97
|
var r, i;
|
|
95
98
|
let a = t(n), o = (e == null ? void 0 : e.center) ?? a, s = (e == null ? void 0 : e.deltaX) ?? 0, c = (e == null ? void 0 : e.deltaY) ?? 0, l = (e == null || (r = e.latestActivePointers) == null ? void 0 : r.length) ?? 1, u = ((i = n.latestActivePointers) == null ? void 0 : i.length) ?? 1, { deltaX: d, deltaY: f } = [
|
|
96
99
|
"pointerdown",
|
|
@@ -107,7 +110,7 @@ var z = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type
|
|
|
107
110
|
deltaY: f,
|
|
108
111
|
deltaPointersAngle: p
|
|
109
112
|
};
|
|
110
|
-
}, void 0),
|
|
113
|
+
}, void 0), p((e) => {
|
|
111
114
|
let { deltaX: t, deltaY: n, latestActivePointers: r, startTime: i, center: a, event: o, deltaPointersAngle: s } = e, c = r ?? [], l = Date.now() - i, { velocityX: u, velocityY: d } = L(l, t, n);
|
|
112
115
|
return {
|
|
113
116
|
deltaX: t,
|
|
@@ -124,12 +127,12 @@ var z = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type
|
|
|
124
127
|
};
|
|
125
128
|
}));
|
|
126
129
|
}, K = ({ container: e, afterEventReceived: t = (e) => e }) => {
|
|
127
|
-
let n =
|
|
130
|
+
let n = ne({
|
|
128
131
|
afterEventReceived: t,
|
|
129
132
|
container: e
|
|
130
|
-
}), r =
|
|
133
|
+
}), r = d(e, "pointerup").pipe(p(t)), i = d(e, "pointermove").pipe(p(t)), a = d(e, "pointerleave").pipe(p(t)), o = d(e, "pointercancel").pipe(p(t));
|
|
131
134
|
return {
|
|
132
|
-
pointerEvents$:
|
|
135
|
+
pointerEvents$: m(n, o, a, r, i),
|
|
133
136
|
pointerDown$: n,
|
|
134
137
|
pointerCancel$: o,
|
|
135
138
|
pointerLeave$: a,
|
|
@@ -179,56 +182,47 @@ function X(e, t, n) {
|
|
|
179
182
|
//#region src/core/recognizer/Recognizer.ts
|
|
180
183
|
var Z = class {
|
|
181
184
|
constructor(t, r) {
|
|
182
|
-
X(this, "configSubject", new e({})), X(this, "pan$", void 0), X(this, "panStart$", void 0), X(this, "panMove$", void 0), X(this, "panEnd$", void 0), X(this, "pointerEvent$", void 0), X(this, "pointerDown$", void 0), X(this, "pointerUp$", void 0), X(this, "pointerCancel$", void 0), X(this, "pointerMove$", void 0), X(this, "pointerOff$", void 0), X(this, "state$", void 0), X(this, "config$", this.configSubject.pipe(H)), X(this, "failWithActive$", void 0)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
X(this, "configSubject", new e({})), X(this, "stateSubject", new e({ fingers: 0 })), X(this, "pan$", void 0), X(this, "panStart$", void 0), X(this, "panMove$", void 0), X(this, "panEnd$", void 0), X(this, "pointerEvent$", void 0), X(this, "pointerDown$", void 0), X(this, "pointerUp$", void 0), X(this, "pointerCancel$", void 0), X(this, "pointerMove$", void 0), X(this, "pointerOff$", void 0), X(this, "state$", void 0), X(this, "config$", this.configSubject.pipe(H)), X(this, "failWithActive$", void 0), X(this, "reportFingers", (e) => (t) => t.pipe(w((t) => {
|
|
186
|
+
this.stateSubject.next({ fingers: e(t) ? 0 : t.pointers.length });
|
|
187
|
+
}), l(() => {
|
|
188
|
+
this.stateSubject.next({ fingers: 0 });
|
|
189
|
+
}))), this.pointerEvent$ = this.config$.pipe(x(({ container: e, afterEventReceived: t }) => K({
|
|
185
190
|
container: e,
|
|
186
191
|
afterEventReceived: t
|
|
187
|
-
}).pointerEvents$),
|
|
188
|
-
let
|
|
189
|
-
this.failWithActive$ =
|
|
192
|
+
}).pointerEvents$), v()), this.pointerDown$ = this.pointerEvent$.pipe(c((e) => e.type === "pointerdown")), this.pointerUp$ = this.pointerEvent$.pipe(c((e) => e.type === "pointerup")), this.pointerMove$ = this.pointerEvent$.pipe(c((e) => e.type === "pointermove")), this.pointerCancel$ = this.pointerEvent$.pipe(c((e) => e.type === "pointercancel")), this.pointerOff$ = this.pointerEvent$.pipe(U);
|
|
193
|
+
let i = this.config$.pipe(p(({ failWith: e }) => e), o());
|
|
194
|
+
this.failWithActive$ = i.pipe(x((e) => {
|
|
190
195
|
let t = e == null ? void 0 : e.map((e) => {
|
|
191
|
-
let t = e.start$.pipe(
|
|
192
|
-
return
|
|
196
|
+
let t = e.start$.pipe(p(() => !0)), n = e.end$.pipe(p(() => !1));
|
|
197
|
+
return m(t, n).pipe(b(!1));
|
|
193
198
|
});
|
|
194
|
-
return t != null && t.length ? n(t) : n([
|
|
195
|
-
}),
|
|
199
|
+
return t != null && t.length ? n(t) : n([g(!1)]);
|
|
200
|
+
}), p((e) => e.some((e) => e)), y(1)), this.pan$ = this.configSubject.pipe(H, x((e) => {
|
|
196
201
|
var t, n, r;
|
|
197
|
-
let i = Math.max(1, ((t = e.panConfig) == null ? void 0 : t.numInputs) ?? 1), a = Math.max(0, ((n = e.panConfig) == null ? void 0 : n.posThreshold) ?? 0), o = Math.max(0, ((r = e.panConfig) == null ? void 0 : r.delay) ?? 0),
|
|
202
|
+
let i = Math.max(1, ((t = e.panConfig) == null ? void 0 : t.numInputs) ?? 1), a = Math.max(0, ((n = e.panConfig) == null ? void 0 : n.posThreshold) ?? 0), o = Math.max(0, ((r = e.panConfig) == null ? void 0 : r.delay) ?? 0), l = this.pointerDown$.pipe(B({
|
|
198
203
|
pointerEvent$: this.pointerEvent$,
|
|
199
204
|
trackMove: !0
|
|
200
|
-
}),
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
})), d = (e) => e.pipe(c((e) => e.pointers.length >= i)), g = (e) => e.pipe(c((e) => e.pointers.length < i));
|
|
204
|
-
return u.pipe(d, s(({ pointers: e }) => {
|
|
205
|
-
let t = u.pipe(g, l(), _()), n = T(o), r = p(...e.map((e) => h(e)), this.pointerDown$).pipe(m((e) => p(this.pointerMove$, h(e)).pipe(R(e), c((t) => I(e, t, a)))), l()).pipe(x(() => n), E(u), f(([, { event: e, pointers: t }]) => ({
|
|
205
|
+
}), V()), d = (e) => e.pipe(c((e) => e.pointers.length >= i)), f = (e) => e.pipe(c((e) => e.pointers.length < i));
|
|
206
|
+
return l.pipe(d, s(({ pointers: e }) => {
|
|
207
|
+
let t = l.pipe(f, u(), v()), n = T(o), r = m(...e.map((e) => g(e)), this.pointerDown$).pipe(h((e) => m(this.pointerMove$, g(e)).pipe(R(e), c((t) => I(e, t, a)))), u()).pipe(x(() => n), E(l), p(([, { event: e, pointers: t }]) => ({
|
|
206
208
|
type: "start",
|
|
207
209
|
event: e,
|
|
208
210
|
latestActivePointers: t
|
|
209
|
-
})),
|
|
210
|
-
bufferSize: 1,
|
|
211
|
-
refCount: !0
|
|
212
|
-
}), S(t)), i = r.pipe(m(() => u.pipe(y(1), f(({ event: e, pointers: t }) => ({
|
|
211
|
+
})), V(), S(t)), i = r.pipe(h(() => l.pipe(ee(1), p(({ event: e, pointers: t }) => ({
|
|
213
212
|
type: "move",
|
|
214
213
|
event: e,
|
|
215
214
|
latestActivePointers: t
|
|
216
|
-
})))), S(t)), s = r.pipe(
|
|
215
|
+
})))), S(t)), s = r.pipe(h(() => t.pipe(p(({ event: e, pointers: t }) => ({
|
|
217
216
|
type: "end",
|
|
218
217
|
event: e,
|
|
219
218
|
latestActivePointers: t
|
|
220
|
-
}))))), d =
|
|
221
|
-
|
|
222
|
-
refCount: !0
|
|
223
|
-
}));
|
|
224
|
-
return d.pipe(G, E(d), f(([e, { type: t }]) => ({
|
|
219
|
+
}))))), d = m(r, i, s).pipe(V());
|
|
220
|
+
return d.pipe(G, E(d), p(([e, { type: t }]) => ({
|
|
225
221
|
...e,
|
|
226
222
|
type: t
|
|
227
223
|
})));
|
|
228
224
|
}));
|
|
229
|
-
}),
|
|
230
|
-
i.next({ fingers: e.pointers.length });
|
|
231
|
-
}), _({ resetOnRefCountZero: () => T(0) })), this.panStart$ = this.pan$.pipe(c((e) => e.type === "start"), f(({ type: e, ...t }) => t)), this.panMove$ = this.pan$.pipe(c((e) => e.type === "move"), f(({ type: e, ...t }) => t)), this.panEnd$ = this.pan$.pipe(c((e) => e.type === "end"), f(({ type: e, ...t }) => t)), this.state$ = i.asObservable(), this.updateInternal(t ?? {}, r);
|
|
225
|
+
}), v({ resetOnRefCountZero: () => T(0) })), this.panStart$ = this.pan$.pipe(c((e) => e.type === "start"), p(({ type: e, ...t }) => t)), this.panMove$ = this.pan$.pipe(c((e) => e.type === "move"), p(({ type: e, ...t }) => t)), this.panEnd$ = this.pan$.pipe(c((e) => e.type === "end"), p(({ type: e, ...t }) => t)), this.state$ = this.stateSubject.pipe(o((e, t) => e.fingers === t.fingers)), this.updateInternal(t ?? {}, r);
|
|
232
226
|
}
|
|
233
227
|
updateInternal(e, t) {
|
|
234
228
|
let n = this.configSubject.getValue();
|
|
@@ -249,36 +243,62 @@ var Z = class {
|
|
|
249
243
|
this.updateInternal(e, t);
|
|
250
244
|
}
|
|
251
245
|
}, Q = class extends Z {
|
|
246
|
+
constructor(e = {}) {
|
|
247
|
+
super(e, {
|
|
248
|
+
numInputs: 1,
|
|
249
|
+
delay: 0,
|
|
250
|
+
posThreshold: 0,
|
|
251
|
+
...e.options
|
|
252
|
+
}), X(this, "events$", void 0);
|
|
253
|
+
let t = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), p(([e]) => ({
|
|
254
|
+
type: "holdStart",
|
|
255
|
+
...e
|
|
256
|
+
})));
|
|
257
|
+
this.events$ = t.pipe(x((e) => {
|
|
258
|
+
let t = this.failWithActive$.pipe(c((e) => e), u()), n = this.panEnd$.pipe(u(), p((e) => ({
|
|
259
|
+
type: "holdEnd",
|
|
260
|
+
...e
|
|
261
|
+
})), S(t)), r = t.pipe(p(() => ({
|
|
262
|
+
...e,
|
|
263
|
+
type: "holdEnd"
|
|
264
|
+
})), S(this.panEnd$));
|
|
265
|
+
return m(g(e), n, r);
|
|
266
|
+
}), this.reportFingers((e) => e.type === "holdEnd"), v());
|
|
267
|
+
}
|
|
268
|
+
update(e) {
|
|
269
|
+
super.update(e, e.options);
|
|
270
|
+
}
|
|
271
|
+
}, re = class extends Z {
|
|
252
272
|
constructor(e) {
|
|
253
273
|
var t;
|
|
254
274
|
super(e, {
|
|
255
275
|
...e == null ? void 0 : e.options,
|
|
256
276
|
posThreshold: (e == null || (t = e.options) == null ? void 0 : t.posThreshold) ?? 15
|
|
257
277
|
}), X(this, "events$", void 0), X(this, "start$", void 0), X(this, "end$", void 0);
|
|
258
|
-
let n = this.panStart$.pipe(
|
|
278
|
+
let n = this.panStart$.pipe(p((e) => ({
|
|
259
279
|
type: "panStart",
|
|
260
280
|
...e
|
|
261
|
-
})), E(this.failWithActive$), c(([, e]) => !e),
|
|
281
|
+
})), E(this.failWithActive$), c(([, e]) => !e), p(([e]) => e), v()), r = this.panEnd$.pipe(p((e) => ({
|
|
262
282
|
type: "panEnd",
|
|
263
283
|
...e
|
|
264
|
-
})),
|
|
284
|
+
})), v()), i = this.panMove$.pipe(p((e) => ({
|
|
265
285
|
type: "panMove",
|
|
266
286
|
...e
|
|
267
287
|
})));
|
|
268
288
|
this.events$ = n.pipe(x((e) => {
|
|
269
|
-
let t = e, n =
|
|
289
|
+
let t = e, n = g(e), a = this.failWithActive$.pipe(c((e) => e), u()), o = m(n, i, r).pipe(w((e) => {
|
|
270
290
|
t = e;
|
|
271
|
-
}), S(a)), s = a.pipe(
|
|
291
|
+
}), S(a)), s = a.pipe(p(() => ({
|
|
272
292
|
...t,
|
|
273
293
|
type: "panEnd"
|
|
274
294
|
})), S(r));
|
|
275
|
-
return
|
|
276
|
-
}),
|
|
295
|
+
return m(o, s);
|
|
296
|
+
}), this.reportFingers((e) => e.type === "panEnd"), v()), this.start$ = this.events$.pipe(c((e) => e.type === "panStart")), this.end$ = this.events$.pipe(c((e) => e.type === "panEnd"));
|
|
277
297
|
}
|
|
278
298
|
update(e) {
|
|
279
299
|
super.update(e, e.options);
|
|
280
300
|
}
|
|
281
|
-
}, $ = ({ type: e, initialEvent: t }) => (n) => n.pipe(
|
|
301
|
+
}, $ = ({ type: e, initialEvent: t }) => (n) => n.pipe(_((t, n) => {
|
|
282
302
|
let r = ((t == null ? void 0 : t.pointers.length) ?? 0) !== n.pointers.length, i = (t == null ? void 0 : t.pointersAverageDistance) ?? n.pointersAverageDistance, a = r ? n.pointersAverageDistance : t && "initialPointersAverageDistance" in t ? t.initialPointersAverageDistance : i, o = a === 0 ? 1 : n.pointersAverageDistance / a, s = n.pointersAverageDistance - a, c = r ? 0 : n.pointersAverageDistance - i, l = r || i === 0 ? 1 : n.pointersAverageDistance / i;
|
|
283
303
|
return {
|
|
284
304
|
...t,
|
|
@@ -290,22 +310,19 @@ var Z = class {
|
|
|
290
310
|
deltaDistance: c,
|
|
291
311
|
deltaDistanceScale: l
|
|
292
312
|
};
|
|
293
|
-
}, t),
|
|
313
|
+
}, t), p(({ initialPointersAverageDistance: e, ...t }) => t)), ie = class extends Z {
|
|
294
314
|
constructor(e) {
|
|
295
315
|
super(e, {
|
|
296
316
|
...e == null ? void 0 : e.options,
|
|
297
317
|
numInputs: 2
|
|
298
318
|
}), X(this, "events$", void 0), X(this, "start$", void 0), X(this, "end$", void 0), this.events$ = this.config$.pipe(x(() => {
|
|
299
|
-
let e, t = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e),
|
|
319
|
+
let e, t = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), p(([e]) => e), x((e) => g(e).pipe($({
|
|
300
320
|
type: "pinchStart",
|
|
301
321
|
initialEvent: void 0
|
|
302
|
-
}))),
|
|
303
|
-
bufferSize: 1,
|
|
304
|
-
refCount: !0
|
|
305
|
-
})), n = this.failWithActive$.pipe(c((e) => e), l()), r = t.pipe(x((e) => this.pan$.pipe(C((e) => e.type !== "end"), $({
|
|
322
|
+
}))), V()), n = this.failWithActive$.pipe(c((e) => e), u()), r = t.pipe(x((e) => this.pan$.pipe(C((e) => e.type !== "end"), $({
|
|
306
323
|
type: "pinchMove",
|
|
307
324
|
initialEvent: e
|
|
308
|
-
}), S(n)))), a = t.pipe(x((t) => this.pan$.pipe(c((e) => e.type === "end"), S(n), i(null),
|
|
325
|
+
}), S(n)))), a = t.pipe(x((t) => this.pan$.pipe(c((e) => e.type === "end"), S(n), i(null), p((n) => {
|
|
309
326
|
let r = e ?? t;
|
|
310
327
|
return {
|
|
311
328
|
...n ?? r,
|
|
@@ -315,46 +332,43 @@ var Z = class {
|
|
|
315
332
|
deltaDistance: 0,
|
|
316
333
|
deltaDistanceScale: 1
|
|
317
334
|
};
|
|
318
|
-
}),
|
|
319
|
-
return
|
|
335
|
+
}), v())));
|
|
336
|
+
return m(t, r, a).pipe(w((t) => {
|
|
320
337
|
e = t;
|
|
321
338
|
}));
|
|
322
|
-
}),
|
|
339
|
+
}), this.reportFingers((e) => e.type === "pinchEnd"), v()), this.start$ = this.events$.pipe(c((e) => e.type === "pinchStart")), this.end$ = this.events$.pipe(c((e) => e.type === "pinchEnd"));
|
|
323
340
|
}
|
|
324
341
|
update(e) {
|
|
325
342
|
super.update(e, e.options);
|
|
326
343
|
}
|
|
327
|
-
},
|
|
344
|
+
}, ae = class {
|
|
328
345
|
constructor(e) {
|
|
329
|
-
X(this, "options", void 0), X(this, "events$", void 0), X(this, "recognizers", void 0), X(this, "state$", void 0), this.options = e, this.recognizers = e.recognizers, this.events$ =
|
|
346
|
+
X(this, "options", void 0), X(this, "events$", void 0), X(this, "recognizers", void 0), X(this, "state$", void 0), this.options = e, this.recognizers = e.recognizers, this.events$ = m(...e.recognizers.map((e) => e.events$.pipe(p((t) => ({
|
|
330
347
|
event: t,
|
|
331
348
|
recognizer: e
|
|
332
|
-
}))))).pipe(
|
|
349
|
+
}))))).pipe(v()), this.state$ = n(this.recognizers.map((e) => e.state$)).pipe(p((e) => e.reduce((e, t) => ({ fingers: Math.max(e.fingers, t.fingers) }))), o((e, t) => e.fingers === t.fingers)), this.update(e);
|
|
333
350
|
}
|
|
334
351
|
update({ disableTextSelection: e, ...t }) {
|
|
335
352
|
t.container && (t.container.style.touchAction = "none", e && (t.container.style.userSelect = "none"));
|
|
336
353
|
for (let e of this.options.recognizers) e.update(t);
|
|
337
354
|
}
|
|
338
|
-
},
|
|
355
|
+
}, oe = class extends Z {
|
|
339
356
|
constructor(e = {}) {
|
|
340
357
|
super(e, {
|
|
341
358
|
numInputs: 2,
|
|
342
359
|
posThreshold: 15,
|
|
343
360
|
...e.options
|
|
344
361
|
}), X(this, "events$", void 0), this.events$ = this.config$.pipe(x(() => {
|
|
345
|
-
let e = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e),
|
|
362
|
+
let e = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), p(([e]) => ({
|
|
346
363
|
...e,
|
|
347
364
|
type: "rotateStart",
|
|
348
365
|
angle: 0,
|
|
349
366
|
deltaAngle: 0
|
|
350
|
-
})),
|
|
351
|
-
bufferSize: 1,
|
|
352
|
-
refCount: !0
|
|
353
|
-
})), t = e.pipe(x((e) => {
|
|
367
|
+
})), V()), t = e.pipe(x((e) => {
|
|
354
368
|
let t = {
|
|
355
369
|
...e,
|
|
356
370
|
type: "start"
|
|
357
|
-
}, n = this.failWithActive$.pipe(c((e) => e),
|
|
371
|
+
}, n = this.failWithActive$.pipe(c((e) => e), u()), r = this.pan$.pipe(_((e, t) => {
|
|
358
372
|
let n = ((e == null ? void 0 : e.angle) ?? 0) + t.deltaPointersAngle;
|
|
359
373
|
return {
|
|
360
374
|
...e,
|
|
@@ -364,86 +378,77 @@ var Z = class {
|
|
|
364
378
|
};
|
|
365
379
|
}, void 0), w((e) => {
|
|
366
380
|
t = e;
|
|
367
|
-
}), S(n)), i = n.pipe(
|
|
381
|
+
}), S(n)), i = n.pipe(p(() => ({
|
|
368
382
|
...t,
|
|
369
383
|
type: "end",
|
|
370
384
|
deltaAngle: 0
|
|
371
385
|
})), S(this.panEnd$));
|
|
372
|
-
return
|
|
373
|
-
}),
|
|
386
|
+
return m(r, i);
|
|
387
|
+
}), v()), n = t.pipe(c((e) => e.type === "move"), p((e) => ({
|
|
374
388
|
...e,
|
|
375
389
|
type: "rotateMove"
|
|
376
|
-
}))), r = t.pipe(c((e) => e.type === "end"),
|
|
390
|
+
}))), r = t.pipe(c((e) => e.type === "end"), p((e) => ({
|
|
377
391
|
...e,
|
|
378
392
|
type: "rotateEnd"
|
|
379
393
|
})));
|
|
380
|
-
return
|
|
381
|
-
}),
|
|
394
|
+
return m(e, n, r);
|
|
395
|
+
}), this.reportFingers((e) => e.type === "rotateEnd"), v());
|
|
382
396
|
}
|
|
383
397
|
update(e) {
|
|
384
398
|
super.update(e, e.options);
|
|
385
399
|
}
|
|
386
|
-
},
|
|
400
|
+
}, se = (e) => (t) => t.pipe(c((t) => Math.abs(t.velocityX) >= e || Math.abs(t.velocityY) >= e)), ce = class extends Z {
|
|
387
401
|
constructor(e) {
|
|
388
402
|
super(e, {
|
|
389
403
|
posThreshold: 0,
|
|
390
404
|
numInputs: 1
|
|
391
405
|
}), X(this, "events$", void 0), this.events$ = this.config$.pipe(x((e) => {
|
|
392
406
|
let { escapeVelocity: t = .9 } = e.options ?? {};
|
|
393
|
-
return this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), x(([e]) => this.panEnd$.pipe(
|
|
407
|
+
return this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), x(([e]) => this.panEnd$.pipe(se(t), p((t) => ({
|
|
394
408
|
type: "swipe",
|
|
395
409
|
angle: A(e.event, t.event),
|
|
396
410
|
...t
|
|
397
|
-
})), S(this.failWithActive$.pipe(c((e) => e))))),
|
|
411
|
+
})), S(this.failWithActive$.pipe(c((e) => e))))), v());
|
|
398
412
|
}));
|
|
399
413
|
}
|
|
400
414
|
update(e) {
|
|
401
415
|
super.update(e);
|
|
402
416
|
}
|
|
403
|
-
},
|
|
417
|
+
}, le = ({ timeout: e, pointerEvent$: t }) => (n) => n.pipe(h((n) => T(e).pipe(S(t.pipe(U, R(n)))))), ue = ({ initialPointerEvent: e, pointerEvent$: t, tolerance: n }) => (r) => r.pipe(h((r) => t.pipe(R(r), C((e) => !z(e), !0), c((t) => I(e, t, n))))), de = class extends Z {
|
|
404
418
|
constructor(e) {
|
|
405
419
|
super(e), X(this, "events$", void 0), this.events$ = this.config$.pipe(x((e) => {
|
|
406
420
|
var n, i;
|
|
407
|
-
let a = ((n = e.options) == null ? void 0 : n.maxTaps) ?? 1, o = ((i = e.options) == null ? void 0 : i.multiTapThreshold) ?? 100 * (a - 1), { maximumPressTime:
|
|
421
|
+
let a = ((n = e.options) == null ? void 0 : n.maxTaps) ?? 1, o = ((i = e.options) == null ? void 0 : i.multiTapThreshold) ?? 100 * (a - 1), { maximumPressTime: l = 150, tolerance: d = 10 } = e.options ?? {}, h = this.pointerDown$.pipe(B({
|
|
408
422
|
pointerEvent$: this.pointerEvent$,
|
|
409
423
|
trackMove: !0
|
|
410
|
-
}), v(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
})), _ = g.pipe(c(({ pointers: e }) => e.length > 1)), y = (e) => e.pipe(t(this.pointerUp$.pipe(r(o))), l());
|
|
414
|
-
return p(this.pointerDown$, g.pipe(d())).pipe(s((e) => {
|
|
415
|
-
let t = p(h(e), this.pointerDown$).pipe(v({
|
|
416
|
-
bufferSize: 1,
|
|
417
|
-
refCount: !0
|
|
418
|
-
})), n = t.pipe(y), r = t.pipe(se({
|
|
424
|
+
}), V()), _ = h.pipe(c(({ pointers: e }) => e.length > 1)), v = (e) => e.pipe(t(this.pointerUp$.pipe(r(o))), u());
|
|
425
|
+
return m(this.pointerDown$, h.pipe(f())).pipe(s((e) => {
|
|
426
|
+
let t = m(g(e), this.pointerDown$).pipe(V()), n = t.pipe(v), r = t.pipe(ue({
|
|
419
427
|
initialPointerEvent: e,
|
|
420
428
|
pointerEvent$: this.pointerEvent$,
|
|
421
|
-
tolerance:
|
|
422
|
-
})), i = t.pipe(
|
|
429
|
+
tolerance: d
|
|
430
|
+
})), i = t.pipe(le({
|
|
423
431
|
pointerEvent$: this.pointerEvent$,
|
|
424
|
-
timeout:
|
|
425
|
-
})), o =
|
|
432
|
+
timeout: l
|
|
433
|
+
})), o = m(this.failWithActive$.pipe(c((e) => e)), this.pointerCancel$, _, r, i), s = n.pipe(F, c((e) => e.length <= a), p((e) => ({
|
|
426
434
|
type: "tap",
|
|
427
435
|
taps: e.length,
|
|
428
436
|
latestActivePointers: e,
|
|
429
437
|
event: e[0]
|
|
430
|
-
})),
|
|
431
|
-
|
|
432
|
-
refCount: !0
|
|
433
|
-
}));
|
|
434
|
-
return s.pipe(G, E(s), f(([e, { type: t, taps: n }]) => ({
|
|
438
|
+
})), V());
|
|
439
|
+
return s.pipe(G, E(s), p(([e, { type: t, taps: n }]) => ({
|
|
435
440
|
...e,
|
|
436
441
|
type: t,
|
|
437
442
|
taps: n
|
|
438
443
|
})), S(o));
|
|
439
444
|
}));
|
|
440
|
-
}),
|
|
445
|
+
}), v());
|
|
441
446
|
}
|
|
442
447
|
update(e) {
|
|
443
448
|
super.update(e);
|
|
444
449
|
}
|
|
445
450
|
};
|
|
446
451
|
//#endregion
|
|
447
|
-
export { Q as PanRecognizer,
|
|
452
|
+
export { Q as HoldRecognizer, re as PanRecognizer, ie as PinchRecognizer, ae as Recognizable, Z as Recognizer, oe as RotateRecognizer, ce as SwipeRecognizer, de as TapRecognizer };
|
|
448
453
|
|
|
449
454
|
//# sourceMappingURL=index.js.map
|