gesturx 1.11.10 → 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 +13 -0
- package/dist/index.js +116 -116
- 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
|
@@ -167,6 +167,7 @@ export declare abstract class Recognizer<Options extends object = never, Event e
|
|
|
167
167
|
protected configSubject: BehaviorSubject<RecognizerConfig<Options> & {
|
|
168
168
|
panConfig?: PanConfig;
|
|
169
169
|
}>;
|
|
170
|
+
private stateSubject;
|
|
170
171
|
protected pan$: Observable<RecognizerPanEvent>;
|
|
171
172
|
protected panStart$: Observable<RecognizerEvent>;
|
|
172
173
|
protected panMove$: Observable<RecognizerEvent>;
|
|
@@ -188,6 +189,12 @@ export declare abstract class Recognizer<Options extends object = never, Event e
|
|
|
188
189
|
* Track active running failWith recognizers
|
|
189
190
|
*/
|
|
190
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>;
|
|
191
198
|
constructor(config?: RecognizerConfig<Options>, panConfig?: PanConfig);
|
|
192
199
|
private updateInternal;
|
|
193
200
|
update(config: Partial<RecognizerConfig<Options>>, panConfig?: PanConfig): void;
|
|
@@ -286,6 +293,12 @@ declare interface RotateRecognizerOptions {
|
|
|
286
293
|
}
|
|
287
294
|
|
|
288
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
|
+
*/
|
|
289
302
|
fingers: number;
|
|
290
303
|
};
|
|
291
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);
|
|
@@ -24,7 +24,7 @@ function j(e) {
|
|
|
24
24
|
y: t.y / n
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function M(e, t) {
|
|
28
28
|
if (e.length !== t.length) throw Error("Initial and new points arrays must have the same length.");
|
|
29
29
|
let n = j(e), r = j(t), i = 0;
|
|
30
30
|
e.forEach((e, a) => {
|
|
@@ -39,34 +39,34 @@ function ee(e, t) {
|
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/core/utils/utils.ts
|
|
42
|
-
function
|
|
42
|
+
function N(e) {
|
|
43
43
|
return e != null;
|
|
44
44
|
}
|
|
45
|
-
var
|
|
46
|
-
function
|
|
45
|
+
var P = (e) => e.length > 0, F = (e) => e.pipe(c(P));
|
|
46
|
+
function I(e, t, n) {
|
|
47
47
|
let r = j([e]), i = j([t]);
|
|
48
48
|
return Math.abs(i.x - r.x) >= n || Math.abs(i.y - r.y) >= n;
|
|
49
49
|
}
|
|
50
|
-
var
|
|
50
|
+
var L = (e, t, n) => ({
|
|
51
51
|
velocityX: e > 0 ? t / e : 0,
|
|
52
52
|
velocityY: e > 0 ? n / e : 0
|
|
53
53
|
});
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/core/utils/events.ts
|
|
56
|
-
function
|
|
56
|
+
function R(e) {
|
|
57
57
|
return (t) => t.pipe(c((t) => t.pointerId === e.pointerId));
|
|
58
58
|
}
|
|
59
|
-
var
|
|
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,26 +81,26 @@ var R = (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
|
-
pointers: Object.values(t).filter(
|
|
86
|
+
pointers: Object.values(t).filter(N)
|
|
87
87
|
})));
|
|
88
|
-
},
|
|
88
|
+
}, V = () => y({
|
|
89
89
|
bufferSize: 1,
|
|
90
90
|
refCount: !0
|
|
91
|
-
}),
|
|
91
|
+
}), H = (e) => e.pipe(c((e) => !!e.container)), U = (e) => e.pipe(c(z)), W = (e, t, n, r) => ({
|
|
92
92
|
deltaX: e.x - t.x + n,
|
|
93
93
|
deltaY: e.y - t.y + r
|
|
94
|
-
}),
|
|
94
|
+
}), G = (e) => {
|
|
95
95
|
let t = (e) => j(e.latestActivePointers.length ? e.latestActivePointers : [e.event]);
|
|
96
|
-
return e.pipe(
|
|
96
|
+
return e.pipe(_((e, n) => {
|
|
97
97
|
var r, i;
|
|
98
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 } = [
|
|
99
99
|
"pointerdown",
|
|
100
100
|
"pointercancel",
|
|
101
101
|
"pointerleave",
|
|
102
102
|
"pointerup"
|
|
103
|
-
].includes(n.event.type) && l !== u && u > 0 || n.event.type === "pointercancel" ?
|
|
103
|
+
].includes(n.event.type) && l !== u && u > 0 || n.event.type === "pointercancel" ? W(a, a, s, c) : W(a, o, s, c), { degreesDelta: p } = l === u && l >= 2 && u >= 2 && n.event.type !== "pointercancel" ? M((e == null ? void 0 : e.latestActivePointers) ?? [], n.latestActivePointers ?? []) : { degreesDelta: 0 };
|
|
104
104
|
return {
|
|
105
105
|
startTime: Date.now(),
|
|
106
106
|
...e,
|
|
@@ -110,8 +110,8 @@ var R = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type
|
|
|
110
110
|
deltaY: f,
|
|
111
111
|
deltaPointersAngle: p
|
|
112
112
|
};
|
|
113
|
-
}, void 0),
|
|
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 } =
|
|
113
|
+
}, void 0), p((e) => {
|
|
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);
|
|
115
115
|
return {
|
|
116
116
|
deltaX: t,
|
|
117
117
|
deltaY: n,
|
|
@@ -126,13 +126,13 @@ var R = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type
|
|
|
126
126
|
pointersAverageDistance: O(r)
|
|
127
127
|
};
|
|
128
128
|
}));
|
|
129
|
-
},
|
|
130
|
-
let n =
|
|
129
|
+
}, K = ({ container: e, afterEventReceived: t = (e) => e }) => {
|
|
130
|
+
let n = ne({
|
|
131
131
|
afterEventReceived: t,
|
|
132
132
|
container: e
|
|
133
|
-
}), 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));
|
|
134
134
|
return {
|
|
135
|
-
pointerEvents$:
|
|
135
|
+
pointerEvents$: m(n, o, a, r, i),
|
|
136
136
|
pointerDown$: n,
|
|
137
137
|
pointerCancel$: o,
|
|
138
138
|
pointerLeave$: a,
|
|
@@ -142,36 +142,36 @@ var R = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type
|
|
|
142
142
|
};
|
|
143
143
|
//#endregion
|
|
144
144
|
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/typeof.js
|
|
145
|
-
function
|
|
145
|
+
function q(e) {
|
|
146
146
|
"@babel/helpers - typeof";
|
|
147
|
-
return
|
|
147
|
+
return q = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
148
148
|
return typeof e;
|
|
149
149
|
} : function(e) {
|
|
150
150
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
151
|
-
},
|
|
151
|
+
}, q(e);
|
|
152
152
|
}
|
|
153
153
|
//#endregion
|
|
154
154
|
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/toPrimitive.js
|
|
155
|
-
function
|
|
156
|
-
if (
|
|
155
|
+
function J(e, t) {
|
|
156
|
+
if (q(e) != "object" || !e) return e;
|
|
157
157
|
var n = e[Symbol.toPrimitive];
|
|
158
158
|
if (n !== void 0) {
|
|
159
159
|
var r = n.call(e, t || "default");
|
|
160
|
-
if (
|
|
160
|
+
if (q(r) != "object") return r;
|
|
161
161
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
162
162
|
}
|
|
163
163
|
return (t === "string" ? String : Number)(e);
|
|
164
164
|
}
|
|
165
165
|
//#endregion
|
|
166
166
|
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/toPropertyKey.js
|
|
167
|
-
function
|
|
168
|
-
var t =
|
|
169
|
-
return
|
|
167
|
+
function Y(e) {
|
|
168
|
+
var t = J(e, "string");
|
|
169
|
+
return q(t) == "symbol" ? t : t + "";
|
|
170
170
|
}
|
|
171
171
|
//#endregion
|
|
172
172
|
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/defineProperty.js
|
|
173
|
-
function
|
|
174
|
-
return (t =
|
|
173
|
+
function X(e, t, n) {
|
|
174
|
+
return (t = Y(t)) in e ? Object.defineProperty(e, t, {
|
|
175
175
|
value: n,
|
|
176
176
|
enumerable: !0,
|
|
177
177
|
configurable: !0,
|
|
@@ -180,49 +180,49 @@ function Z(e, t, n) {
|
|
|
180
180
|
}
|
|
181
181
|
//#endregion
|
|
182
182
|
//#region src/core/recognizer/Recognizer.ts
|
|
183
|
-
var
|
|
183
|
+
var Z = class {
|
|
184
184
|
constructor(t, r) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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({
|
|
188
190
|
container: e,
|
|
189
191
|
afterEventReceived: t
|
|
190
|
-
}).pointerEvents$),
|
|
191
|
-
let
|
|
192
|
-
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) => {
|
|
193
195
|
let t = e == null ? void 0 : e.map((e) => {
|
|
194
|
-
let t = e.start$.pipe(
|
|
195
|
-
return
|
|
196
|
+
let t = e.start$.pipe(p(() => !0)), n = e.end$.pipe(p(() => !1));
|
|
197
|
+
return m(t, n).pipe(b(!1));
|
|
196
198
|
});
|
|
197
|
-
return t != null && t.length ? n(t) : n([
|
|
198
|
-
}),
|
|
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) => {
|
|
199
201
|
var t, n, r;
|
|
200
|
-
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({
|
|
201
203
|
pointerEvent$: this.pointerEvent$,
|
|
202
204
|
trackMove: !0
|
|
203
|
-
}),
|
|
204
|
-
return
|
|
205
|
-
let 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
|
-
})),
|
|
211
|
+
})), V(), S(t)), i = r.pipe(h(() => l.pipe(ee(1), p(({ event: e, pointers: t }) => ({
|
|
210
212
|
type: "move",
|
|
211
213
|
event: e,
|
|
212
214
|
latestActivePointers: t
|
|
213
|
-
})))), S(t)), s = r.pipe(
|
|
215
|
+
})))), S(t)), s = r.pipe(h(() => t.pipe(p(({ event: e, pointers: t }) => ({
|
|
214
216
|
type: "end",
|
|
215
217
|
event: e,
|
|
216
218
|
latestActivePointers: t
|
|
217
|
-
}))))), d =
|
|
218
|
-
return d.pipe(
|
|
219
|
+
}))))), d = m(r, i, s).pipe(V());
|
|
220
|
+
return d.pipe(G, E(d), p(([e, { type: t }]) => ({
|
|
219
221
|
...e,
|
|
220
222
|
type: t
|
|
221
223
|
})));
|
|
222
224
|
}));
|
|
223
|
-
}),
|
|
224
|
-
i.next({ fingers: e.pointers.length });
|
|
225
|
-
}), _({ 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);
|
|
226
226
|
}
|
|
227
227
|
updateInternal(e, t) {
|
|
228
228
|
let n = this.configSubject.getValue();
|
|
@@ -242,63 +242,63 @@ var Q = class {
|
|
|
242
242
|
update(e, t) {
|
|
243
243
|
this.updateInternal(e, t);
|
|
244
244
|
}
|
|
245
|
-
},
|
|
245
|
+
}, Q = class extends Z {
|
|
246
246
|
constructor(e = {}) {
|
|
247
247
|
super(e, {
|
|
248
248
|
numInputs: 1,
|
|
249
249
|
delay: 0,
|
|
250
250
|
posThreshold: 0,
|
|
251
251
|
...e.options
|
|
252
|
-
}),
|
|
253
|
-
let t = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e),
|
|
252
|
+
}), X(this, "events$", void 0);
|
|
253
|
+
let t = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), p(([e]) => ({
|
|
254
254
|
type: "holdStart",
|
|
255
255
|
...e
|
|
256
256
|
})));
|
|
257
257
|
this.events$ = t.pipe(x((e) => {
|
|
258
|
-
let t = this.failWithActive$.pipe(c((e) => e),
|
|
258
|
+
let t = this.failWithActive$.pipe(c((e) => e), u()), n = this.panEnd$.pipe(u(), p((e) => ({
|
|
259
259
|
type: "holdEnd",
|
|
260
260
|
...e
|
|
261
|
-
})), S(t)), r = t.pipe(
|
|
261
|
+
})), S(t)), r = t.pipe(p(() => ({
|
|
262
262
|
...e,
|
|
263
263
|
type: "holdEnd"
|
|
264
264
|
})), S(this.panEnd$));
|
|
265
|
-
return
|
|
266
|
-
}),
|
|
265
|
+
return m(g(e), n, r);
|
|
266
|
+
}), this.reportFingers((e) => e.type === "holdEnd"), v());
|
|
267
267
|
}
|
|
268
268
|
update(e) {
|
|
269
269
|
super.update(e, e.options);
|
|
270
270
|
}
|
|
271
|
-
},
|
|
271
|
+
}, re = class extends Z {
|
|
272
272
|
constructor(e) {
|
|
273
273
|
var t;
|
|
274
274
|
super(e, {
|
|
275
275
|
...e == null ? void 0 : e.options,
|
|
276
276
|
posThreshold: (e == null || (t = e.options) == null ? void 0 : t.posThreshold) ?? 15
|
|
277
|
-
}),
|
|
278
|
-
let n = this.panStart$.pipe(
|
|
277
|
+
}), X(this, "events$", void 0), X(this, "start$", void 0), X(this, "end$", void 0);
|
|
278
|
+
let n = this.panStart$.pipe(p((e) => ({
|
|
279
279
|
type: "panStart",
|
|
280
280
|
...e
|
|
281
|
-
})), E(this.failWithActive$), c(([, e]) => !e),
|
|
281
|
+
})), E(this.failWithActive$), c(([, e]) => !e), p(([e]) => e), v()), r = this.panEnd$.pipe(p((e) => ({
|
|
282
282
|
type: "panEnd",
|
|
283
283
|
...e
|
|
284
|
-
})),
|
|
284
|
+
})), v()), i = this.panMove$.pipe(p((e) => ({
|
|
285
285
|
type: "panMove",
|
|
286
286
|
...e
|
|
287
287
|
})));
|
|
288
288
|
this.events$ = n.pipe(x((e) => {
|
|
289
|
-
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) => {
|
|
290
290
|
t = e;
|
|
291
|
-
}), S(a)), s = a.pipe(
|
|
291
|
+
}), S(a)), s = a.pipe(p(() => ({
|
|
292
292
|
...t,
|
|
293
293
|
type: "panEnd"
|
|
294
294
|
})), S(r));
|
|
295
|
-
return
|
|
296
|
-
}),
|
|
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"));
|
|
297
297
|
}
|
|
298
298
|
update(e) {
|
|
299
299
|
super.update(e, e.options);
|
|
300
300
|
}
|
|
301
|
-
}, $ = ({ type: e, initialEvent: t }) => (n) => n.pipe(
|
|
301
|
+
}, $ = ({ type: e, initialEvent: t }) => (n) => n.pipe(_((t, n) => {
|
|
302
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;
|
|
303
303
|
return {
|
|
304
304
|
...t,
|
|
@@ -310,19 +310,19 @@ var Q = class {
|
|
|
310
310
|
deltaDistance: c,
|
|
311
311
|
deltaDistanceScale: l
|
|
312
312
|
};
|
|
313
|
-
}, t),
|
|
313
|
+
}, t), p(({ initialPointersAverageDistance: e, ...t }) => t)), ie = class extends Z {
|
|
314
314
|
constructor(e) {
|
|
315
315
|
super(e, {
|
|
316
316
|
...e == null ? void 0 : e.options,
|
|
317
317
|
numInputs: 2
|
|
318
|
-
}),
|
|
319
|
-
let e, t = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e),
|
|
318
|
+
}), X(this, "events$", void 0), X(this, "start$", void 0), X(this, "end$", void 0), this.events$ = this.config$.pipe(x(() => {
|
|
319
|
+
let e, t = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), p(([e]) => e), x((e) => g(e).pipe($({
|
|
320
320
|
type: "pinchStart",
|
|
321
321
|
initialEvent: void 0
|
|
322
|
-
}))),
|
|
322
|
+
}))), V()), n = this.failWithActive$.pipe(c((e) => e), u()), r = t.pipe(x((e) => this.pan$.pipe(C((e) => e.type !== "end"), $({
|
|
323
323
|
type: "pinchMove",
|
|
324
324
|
initialEvent: e
|
|
325
|
-
}), 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) => {
|
|
326
326
|
let r = e ?? t;
|
|
327
327
|
return {
|
|
328
328
|
...n ?? r,
|
|
@@ -332,43 +332,43 @@ var Q = class {
|
|
|
332
332
|
deltaDistance: 0,
|
|
333
333
|
deltaDistanceScale: 1
|
|
334
334
|
};
|
|
335
|
-
}),
|
|
336
|
-
return
|
|
335
|
+
}), v())));
|
|
336
|
+
return m(t, r, a).pipe(w((t) => {
|
|
337
337
|
e = t;
|
|
338
338
|
}));
|
|
339
|
-
}),
|
|
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"));
|
|
340
340
|
}
|
|
341
341
|
update(e) {
|
|
342
342
|
super.update(e, e.options);
|
|
343
343
|
}
|
|
344
|
-
},
|
|
344
|
+
}, ae = class {
|
|
345
345
|
constructor(e) {
|
|
346
|
-
|
|
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) => ({
|
|
347
347
|
event: t,
|
|
348
348
|
recognizer: e
|
|
349
|
-
}))))).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);
|
|
350
350
|
}
|
|
351
351
|
update({ disableTextSelection: e, ...t }) {
|
|
352
352
|
t.container && (t.container.style.touchAction = "none", e && (t.container.style.userSelect = "none"));
|
|
353
353
|
for (let e of this.options.recognizers) e.update(t);
|
|
354
354
|
}
|
|
355
|
-
},
|
|
355
|
+
}, oe = class extends Z {
|
|
356
356
|
constructor(e = {}) {
|
|
357
357
|
super(e, {
|
|
358
358
|
numInputs: 2,
|
|
359
359
|
posThreshold: 15,
|
|
360
360
|
...e.options
|
|
361
|
-
}),
|
|
362
|
-
let e = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e),
|
|
361
|
+
}), X(this, "events$", void 0), this.events$ = this.config$.pipe(x(() => {
|
|
362
|
+
let e = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), p(([e]) => ({
|
|
363
363
|
...e,
|
|
364
364
|
type: "rotateStart",
|
|
365
365
|
angle: 0,
|
|
366
366
|
deltaAngle: 0
|
|
367
|
-
})),
|
|
367
|
+
})), V()), t = e.pipe(x((e) => {
|
|
368
368
|
let t = {
|
|
369
369
|
...e,
|
|
370
370
|
type: "start"
|
|
371
|
-
}, n = this.failWithActive$.pipe(c((e) => e),
|
|
371
|
+
}, n = this.failWithActive$.pipe(c((e) => e), u()), r = this.pan$.pipe(_((e, t) => {
|
|
372
372
|
let n = ((e == null ? void 0 : e.angle) ?? 0) + t.deltaPointersAngle;
|
|
373
373
|
return {
|
|
374
374
|
...e,
|
|
@@ -378,77 +378,77 @@ var Q = class {
|
|
|
378
378
|
};
|
|
379
379
|
}, void 0), w((e) => {
|
|
380
380
|
t = e;
|
|
381
|
-
}), S(n)), i = n.pipe(
|
|
381
|
+
}), S(n)), i = n.pipe(p(() => ({
|
|
382
382
|
...t,
|
|
383
383
|
type: "end",
|
|
384
384
|
deltaAngle: 0
|
|
385
385
|
})), S(this.panEnd$));
|
|
386
|
-
return
|
|
387
|
-
}),
|
|
386
|
+
return m(r, i);
|
|
387
|
+
}), v()), n = t.pipe(c((e) => e.type === "move"), p((e) => ({
|
|
388
388
|
...e,
|
|
389
389
|
type: "rotateMove"
|
|
390
|
-
}))), r = t.pipe(c((e) => e.type === "end"),
|
|
390
|
+
}))), r = t.pipe(c((e) => e.type === "end"), p((e) => ({
|
|
391
391
|
...e,
|
|
392
392
|
type: "rotateEnd"
|
|
393
393
|
})));
|
|
394
|
-
return
|
|
395
|
-
}),
|
|
394
|
+
return m(e, n, r);
|
|
395
|
+
}), this.reportFingers((e) => e.type === "rotateEnd"), v());
|
|
396
396
|
}
|
|
397
397
|
update(e) {
|
|
398
398
|
super.update(e, e.options);
|
|
399
399
|
}
|
|
400
|
-
},
|
|
400
|
+
}, se = (e) => (t) => t.pipe(c((t) => Math.abs(t.velocityX) >= e || Math.abs(t.velocityY) >= e)), ce = class extends Z {
|
|
401
401
|
constructor(e) {
|
|
402
402
|
super(e, {
|
|
403
403
|
posThreshold: 0,
|
|
404
404
|
numInputs: 1
|
|
405
|
-
}),
|
|
405
|
+
}), X(this, "events$", void 0), this.events$ = this.config$.pipe(x((e) => {
|
|
406
406
|
let { escapeVelocity: t = .9 } = e.options ?? {};
|
|
407
|
-
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) => ({
|
|
408
408
|
type: "swipe",
|
|
409
409
|
angle: A(e.event, t.event),
|
|
410
410
|
...t
|
|
411
|
-
})), S(this.failWithActive$.pipe(c((e) => e))))),
|
|
411
|
+
})), S(this.failWithActive$.pipe(c((e) => e))))), v());
|
|
412
412
|
}));
|
|
413
413
|
}
|
|
414
414
|
update(e) {
|
|
415
415
|
super.update(e);
|
|
416
416
|
}
|
|
417
|
-
},
|
|
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 {
|
|
418
418
|
constructor(e) {
|
|
419
|
-
super(e),
|
|
419
|
+
super(e), X(this, "events$", void 0), this.events$ = this.config$.pipe(x((e) => {
|
|
420
420
|
var n, i;
|
|
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:
|
|
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({
|
|
422
422
|
pointerEvent$: this.pointerEvent$,
|
|
423
423
|
trackMove: !0
|
|
424
|
-
}),
|
|
425
|
-
return
|
|
426
|
-
let t =
|
|
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({
|
|
427
427
|
initialPointerEvent: e,
|
|
428
428
|
pointerEvent$: this.pointerEvent$,
|
|
429
|
-
tolerance:
|
|
430
|
-
})), i = t.pipe(
|
|
429
|
+
tolerance: d
|
|
430
|
+
})), i = t.pipe(le({
|
|
431
431
|
pointerEvent$: this.pointerEvent$,
|
|
432
|
-
timeout:
|
|
433
|
-
})), 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) => ({
|
|
434
434
|
type: "tap",
|
|
435
435
|
taps: e.length,
|
|
436
436
|
latestActivePointers: e,
|
|
437
437
|
event: e[0]
|
|
438
|
-
})),
|
|
439
|
-
return s.pipe(
|
|
438
|
+
})), V());
|
|
439
|
+
return s.pipe(G, E(s), p(([e, { type: t, taps: n }]) => ({
|
|
440
440
|
...e,
|
|
441
441
|
type: t,
|
|
442
442
|
taps: n
|
|
443
443
|
})), S(o));
|
|
444
444
|
}));
|
|
445
|
-
}),
|
|
445
|
+
}), v());
|
|
446
446
|
}
|
|
447
447
|
update(e) {
|
|
448
448
|
super.update(e);
|
|
449
449
|
}
|
|
450
450
|
};
|
|
451
451
|
//#endregion
|
|
452
|
-
export {
|
|
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 };
|
|
453
453
|
|
|
454
454
|
//# sourceMappingURL=index.js.map
|