lx-video-player 1.1.6 → 1.1.7
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/hammer-tZeoe76s.js +1189 -0
- package/dist/tcplayer.v4.8.0.min-Cj579j9Z.js +10193 -0
- package/dist/video-player.js +50 -58
- package/dist/video-player.umd.cjs +35 -51
- package/package.json +1 -1
- package/dist/hammer-005503be.js +0 -1188
- package/dist/tcplayer.v4.9.1.min-6251bfc4.js +0 -12800
- /package/dist/{_commonjsHelpers-10dfc225.js → _commonjsHelpers-DaMA6jEr.js} +0 -0
|
@@ -0,0 +1,1189 @@
|
|
|
1
|
+
import { g as be } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
2
|
+
var It = { exports: {} };
|
|
3
|
+
/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
4
|
+
* http://hammerjs.github.io/
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2016 Jorik Tangelder;
|
|
7
|
+
* Licensed under the MIT license */
|
|
8
|
+
var Qt;
|
|
9
|
+
function Fe() {
|
|
10
|
+
return Qt || (Qt = 1, function(yt) {
|
|
11
|
+
(function(u, Pt, Kt, v) {
|
|
12
|
+
var Nt = ["", "webkit", "Moz", "MS", "ms", "o"], $t = Pt.createElement("div"), te = "function", x = Math.round, S = Math.abs, at = Date.now;
|
|
13
|
+
function ot(t, e, i) {
|
|
14
|
+
return setTimeout(ht(t, i), e);
|
|
15
|
+
}
|
|
16
|
+
function L(t, e, i) {
|
|
17
|
+
return Array.isArray(t) ? (P(t, i[e], i), !0) : !1;
|
|
18
|
+
}
|
|
19
|
+
function P(t, e, i) {
|
|
20
|
+
var r;
|
|
21
|
+
if (t)
|
|
22
|
+
if (t.forEach)
|
|
23
|
+
t.forEach(e, i);
|
|
24
|
+
else if (t.length !== v)
|
|
25
|
+
for (r = 0; r < t.length; )
|
|
26
|
+
e.call(i, t[r], r, t), r++;
|
|
27
|
+
else
|
|
28
|
+
for (r in t)
|
|
29
|
+
t.hasOwnProperty(r) && e.call(i, t[r], r, t);
|
|
30
|
+
}
|
|
31
|
+
function Ot(t, e, i) {
|
|
32
|
+
var r = "DEPRECATED METHOD: " + e + `
|
|
33
|
+
` + i + ` AT
|
|
34
|
+
`;
|
|
35
|
+
return function() {
|
|
36
|
+
var n = new Error("get-stack-trace"), s = n && n.stack ? n.stack.replace(/^[^\(]+?[\n$]/gm, "").replace(/^\s+at\s+/gm, "").replace(/^Object.<anonymous>\s*\(/gm, "{anonymous}()@") : "Unknown Stack Trace", a = u.console && (u.console.warn || u.console.log);
|
|
37
|
+
return a && a.call(u.console, r, s), t.apply(this, arguments);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
var g;
|
|
41
|
+
typeof Object.assign != "function" ? g = function(e) {
|
|
42
|
+
if (e === v || e === null)
|
|
43
|
+
throw new TypeError("Cannot convert undefined or null to object");
|
|
44
|
+
for (var i = Object(e), r = 1; r < arguments.length; r++) {
|
|
45
|
+
var n = arguments[r];
|
|
46
|
+
if (n !== v && n !== null)
|
|
47
|
+
for (var s in n)
|
|
48
|
+
n.hasOwnProperty(s) && (i[s] = n[s]);
|
|
49
|
+
}
|
|
50
|
+
return i;
|
|
51
|
+
} : g = Object.assign;
|
|
52
|
+
var At = Ot(function(e, i, r) {
|
|
53
|
+
for (var n = Object.keys(i), s = 0; s < n.length; )
|
|
54
|
+
(!r || r && e[n[s]] === v) && (e[n[s]] = i[n[s]]), s++;
|
|
55
|
+
return e;
|
|
56
|
+
}, "extend", "Use `assign`."), ee = Ot(function(e, i) {
|
|
57
|
+
return At(e, i, !0);
|
|
58
|
+
}, "merge", "Use `assign`.");
|
|
59
|
+
function T(t, e, i) {
|
|
60
|
+
var r = e.prototype, n;
|
|
61
|
+
n = t.prototype = Object.create(r), n.constructor = t, n._super = r, i && g(n, i);
|
|
62
|
+
}
|
|
63
|
+
function ht(t, e) {
|
|
64
|
+
return function() {
|
|
65
|
+
return t.apply(e, arguments);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function lt(t, e) {
|
|
69
|
+
return typeof t == te ? t.apply(e && e[0] || v, e) : t;
|
|
70
|
+
}
|
|
71
|
+
function Ct(t, e) {
|
|
72
|
+
return t === v ? e : t;
|
|
73
|
+
}
|
|
74
|
+
function G(t, e, i) {
|
|
75
|
+
P(Z(e), function(r) {
|
|
76
|
+
t.addEventListener(r, i, !1);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function z(t, e, i) {
|
|
80
|
+
P(Z(e), function(r) {
|
|
81
|
+
t.removeEventListener(r, i, !1);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function St(t, e) {
|
|
85
|
+
for (; t; ) {
|
|
86
|
+
if (t == e)
|
|
87
|
+
return !0;
|
|
88
|
+
t = t.parentNode;
|
|
89
|
+
}
|
|
90
|
+
return !1;
|
|
91
|
+
}
|
|
92
|
+
function D(t, e) {
|
|
93
|
+
return t.indexOf(e) > -1;
|
|
94
|
+
}
|
|
95
|
+
function Z(t) {
|
|
96
|
+
return t.trim().split(/\s+/g);
|
|
97
|
+
}
|
|
98
|
+
function H(t, e, i) {
|
|
99
|
+
if (t.indexOf && !i)
|
|
100
|
+
return t.indexOf(e);
|
|
101
|
+
for (var r = 0; r < t.length; ) {
|
|
102
|
+
if (i && t[r][i] == e || !i && t[r] === e)
|
|
103
|
+
return r;
|
|
104
|
+
r++;
|
|
105
|
+
}
|
|
106
|
+
return -1;
|
|
107
|
+
}
|
|
108
|
+
function B(t) {
|
|
109
|
+
return Array.prototype.slice.call(t, 0);
|
|
110
|
+
}
|
|
111
|
+
function Dt(t, e, i) {
|
|
112
|
+
for (var r = [], n = [], s = 0; s < t.length; ) {
|
|
113
|
+
var a = t[s][e];
|
|
114
|
+
H(n, a) < 0 && r.push(t[s]), n[s] = a, s++;
|
|
115
|
+
}
|
|
116
|
+
return r = r.sort(function(l, f) {
|
|
117
|
+
return l[e] > f[e];
|
|
118
|
+
}), r;
|
|
119
|
+
}
|
|
120
|
+
function j(t, e) {
|
|
121
|
+
for (var i, r, n = e[0].toUpperCase() + e.slice(1), s = 0; s < Nt.length; ) {
|
|
122
|
+
if (i = Nt[s], r = i ? i + n : e, r in t)
|
|
123
|
+
return r;
|
|
124
|
+
s++;
|
|
125
|
+
}
|
|
126
|
+
return v;
|
|
127
|
+
}
|
|
128
|
+
var ie = 1;
|
|
129
|
+
function re() {
|
|
130
|
+
return ie++;
|
|
131
|
+
}
|
|
132
|
+
function Mt(t) {
|
|
133
|
+
var e = t.ownerDocument || t;
|
|
134
|
+
return e.defaultView || e.parentWindow || u;
|
|
135
|
+
}
|
|
136
|
+
var ne = /mobile|tablet|ip(ad|hone|od)|android/i, Ut = "ontouchstart" in u, se = j(u, "PointerEvent") !== v, ae = Ut && ne.test(navigator.userAgent), b = "touch", oe = "pen", ut = "mouse", he = "kinect", le = 25, c = 1, M = 2, o = 4, p = 8, J = 1, F = 2, X = 4, V = 8, W = 16, _ = F | X, U = V | W, Rt = _ | U, xt = ["x", "y"], Q = ["clientX", "clientY"];
|
|
137
|
+
function m(t, e) {
|
|
138
|
+
var i = this;
|
|
139
|
+
this.manager = t, this.callback = e, this.element = t.element, this.target = t.options.inputTarget, this.domHandler = function(r) {
|
|
140
|
+
lt(t.options.enable, [t]) && i.handler(r);
|
|
141
|
+
}, this.init();
|
|
142
|
+
}
|
|
143
|
+
m.prototype = {
|
|
144
|
+
/**
|
|
145
|
+
* should handle the inputEvent data and trigger the callback
|
|
146
|
+
* @virtual
|
|
147
|
+
*/
|
|
148
|
+
handler: function() {
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* bind the events
|
|
152
|
+
*/
|
|
153
|
+
init: function() {
|
|
154
|
+
this.evEl && G(this.element, this.evEl, this.domHandler), this.evTarget && G(this.target, this.evTarget, this.domHandler), this.evWin && G(Mt(this.element), this.evWin, this.domHandler);
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* unbind the events
|
|
158
|
+
*/
|
|
159
|
+
destroy: function() {
|
|
160
|
+
this.evEl && z(this.element, this.evEl, this.domHandler), this.evTarget && z(this.target, this.evTarget, this.domHandler), this.evWin && z(Mt(this.element), this.evWin, this.domHandler);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
function ue(t) {
|
|
164
|
+
var e, i = t.options.inputClass;
|
|
165
|
+
return i ? e = i : se ? e = ft : ae ? e = tt : Ut ? e = vt : e = $, new e(t, ce);
|
|
166
|
+
}
|
|
167
|
+
function ce(t, e, i) {
|
|
168
|
+
var r = i.pointers.length, n = i.changedPointers.length, s = e & c && r - n === 0, a = e & (o | p) && r - n === 0;
|
|
169
|
+
i.isFirst = !!s, i.isFinal = !!a, s && (t.session = {}), i.eventType = e, fe(t, i), t.emit("hammer.input", i), t.recognize(i), t.session.prevInput = i;
|
|
170
|
+
}
|
|
171
|
+
function fe(t, e) {
|
|
172
|
+
var i = t.session, r = e.pointers, n = r.length;
|
|
173
|
+
i.firstInput || (i.firstInput = Lt(e)), n > 1 && !i.firstMultiple ? i.firstMultiple = Lt(e) : n === 1 && (i.firstMultiple = !1);
|
|
174
|
+
var s = i.firstInput, a = i.firstMultiple, h = a ? a.center : s.center, l = e.center = Ht(r);
|
|
175
|
+
e.timeStamp = at(), e.deltaTime = e.timeStamp - s.timeStamp, e.angle = ct(h, l), e.distance = K(h, l), ve(i, e), e.offsetDirection = bt(e.deltaX, e.deltaY);
|
|
176
|
+
var f = Yt(e.deltaTime, e.deltaX, e.deltaY);
|
|
177
|
+
e.overallVelocityX = f.x, e.overallVelocityY = f.y, e.overallVelocity = S(f.x) > S(f.y) ? f.x : f.y, e.scale = a ? me(a.pointers, r) : 1, e.rotation = a ? Te(a.pointers, r) : 0, e.maxPointers = i.prevInput ? e.pointers.length > i.prevInput.maxPointers ? e.pointers.length : i.prevInput.maxPointers : e.pointers.length, pe(i, e);
|
|
178
|
+
var y = t.element;
|
|
179
|
+
St(e.srcEvent.target, y) && (y = e.srcEvent.target), e.target = y;
|
|
180
|
+
}
|
|
181
|
+
function ve(t, e) {
|
|
182
|
+
var i = e.center, r = t.offsetDelta || {}, n = t.prevDelta || {}, s = t.prevInput || {};
|
|
183
|
+
(e.eventType === c || s.eventType === o) && (n = t.prevDelta = {
|
|
184
|
+
x: s.deltaX || 0,
|
|
185
|
+
y: s.deltaY || 0
|
|
186
|
+
}, r = t.offsetDelta = {
|
|
187
|
+
x: i.x,
|
|
188
|
+
y: i.y
|
|
189
|
+
}), e.deltaX = n.x + (i.x - r.x), e.deltaY = n.y + (i.y - r.y);
|
|
190
|
+
}
|
|
191
|
+
function pe(t, e) {
|
|
192
|
+
var i = t.lastInterval || e, r = e.timeStamp - i.timeStamp, n, s, a, h;
|
|
193
|
+
if (e.eventType != p && (r > le || i.velocity === v)) {
|
|
194
|
+
var l = e.deltaX - i.deltaX, f = e.deltaY - i.deltaY, y = Yt(r, l, f);
|
|
195
|
+
s = y.x, a = y.y, n = S(y.x) > S(y.y) ? y.x : y.y, h = bt(l, f), t.lastInterval = e;
|
|
196
|
+
} else
|
|
197
|
+
n = i.velocity, s = i.velocityX, a = i.velocityY, h = i.direction;
|
|
198
|
+
e.velocity = n, e.velocityX = s, e.velocityY = a, e.direction = h;
|
|
199
|
+
}
|
|
200
|
+
function Lt(t) {
|
|
201
|
+
for (var e = [], i = 0; i < t.pointers.length; )
|
|
202
|
+
e[i] = {
|
|
203
|
+
clientX: x(t.pointers[i].clientX),
|
|
204
|
+
clientY: x(t.pointers[i].clientY)
|
|
205
|
+
}, i++;
|
|
206
|
+
return {
|
|
207
|
+
timeStamp: at(),
|
|
208
|
+
pointers: e,
|
|
209
|
+
center: Ht(e),
|
|
210
|
+
deltaX: t.deltaX,
|
|
211
|
+
deltaY: t.deltaY
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function Ht(t) {
|
|
215
|
+
var e = t.length;
|
|
216
|
+
if (e === 1)
|
|
217
|
+
return {
|
|
218
|
+
x: x(t[0].clientX),
|
|
219
|
+
y: x(t[0].clientY)
|
|
220
|
+
};
|
|
221
|
+
for (var i = 0, r = 0, n = 0; n < e; )
|
|
222
|
+
i += t[n].clientX, r += t[n].clientY, n++;
|
|
223
|
+
return {
|
|
224
|
+
x: x(i / e),
|
|
225
|
+
y: x(r / e)
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function Yt(t, e, i) {
|
|
229
|
+
return {
|
|
230
|
+
x: e / t || 0,
|
|
231
|
+
y: i / t || 0
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function bt(t, e) {
|
|
235
|
+
return t === e ? J : S(t) >= S(e) ? t < 0 ? F : X : e < 0 ? V : W;
|
|
236
|
+
}
|
|
237
|
+
function K(t, e, i) {
|
|
238
|
+
i || (i = xt);
|
|
239
|
+
var r = e[i[0]] - t[i[0]], n = e[i[1]] - t[i[1]];
|
|
240
|
+
return Math.sqrt(r * r + n * n);
|
|
241
|
+
}
|
|
242
|
+
function ct(t, e, i) {
|
|
243
|
+
i || (i = xt);
|
|
244
|
+
var r = e[i[0]] - t[i[0]], n = e[i[1]] - t[i[1]];
|
|
245
|
+
return Math.atan2(n, r) * 180 / Math.PI;
|
|
246
|
+
}
|
|
247
|
+
function Te(t, e) {
|
|
248
|
+
return ct(e[1], e[0], Q) + ct(t[1], t[0], Q);
|
|
249
|
+
}
|
|
250
|
+
function me(t, e) {
|
|
251
|
+
return K(e[0], e[1], Q) / K(t[0], t[1], Q);
|
|
252
|
+
}
|
|
253
|
+
var de = {
|
|
254
|
+
mousedown: c,
|
|
255
|
+
mousemove: M,
|
|
256
|
+
mouseup: o
|
|
257
|
+
}, Ee = "mousedown", ge = "mousemove mouseup";
|
|
258
|
+
function $() {
|
|
259
|
+
this.evEl = Ee, this.evWin = ge, this.pressed = !1, m.apply(this, arguments);
|
|
260
|
+
}
|
|
261
|
+
T($, m, {
|
|
262
|
+
/**
|
|
263
|
+
* handle mouse events
|
|
264
|
+
* @param {Object} ev
|
|
265
|
+
*/
|
|
266
|
+
handler: function(e) {
|
|
267
|
+
var i = de[e.type];
|
|
268
|
+
i & c && e.button === 0 && (this.pressed = !0), i & M && e.which !== 1 && (i = o), this.pressed && (i & o && (this.pressed = !1), this.callback(this.manager, i, {
|
|
269
|
+
pointers: [e],
|
|
270
|
+
changedPointers: [e],
|
|
271
|
+
pointerType: ut,
|
|
272
|
+
srcEvent: e
|
|
273
|
+
}));
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
var _e = {
|
|
277
|
+
pointerdown: c,
|
|
278
|
+
pointermove: M,
|
|
279
|
+
pointerup: o,
|
|
280
|
+
pointercancel: p,
|
|
281
|
+
pointerout: p
|
|
282
|
+
}, Ie = {
|
|
283
|
+
2: b,
|
|
284
|
+
3: oe,
|
|
285
|
+
4: ut,
|
|
286
|
+
5: he
|
|
287
|
+
// see https://twitter.com/jacobrossi/status/480596438489890816
|
|
288
|
+
}, Ft = "pointerdown", Xt = "pointermove pointerup pointercancel";
|
|
289
|
+
u.MSPointerEvent && !u.PointerEvent && (Ft = "MSPointerDown", Xt = "MSPointerMove MSPointerUp MSPointerCancel");
|
|
290
|
+
function ft() {
|
|
291
|
+
this.evEl = Ft, this.evWin = Xt, m.apply(this, arguments), this.store = this.manager.session.pointerEvents = [];
|
|
292
|
+
}
|
|
293
|
+
T(ft, m, {
|
|
294
|
+
/**
|
|
295
|
+
* handle mouse events
|
|
296
|
+
* @param {Object} ev
|
|
297
|
+
*/
|
|
298
|
+
handler: function(e) {
|
|
299
|
+
var i = this.store, r = !1, n = e.type.toLowerCase().replace("ms", ""), s = _e[n], a = Ie[e.pointerType] || e.pointerType, h = a == b, l = H(i, e.pointerId, "pointerId");
|
|
300
|
+
s & c && (e.button === 0 || h) ? l < 0 && (i.push(e), l = i.length - 1) : s & (o | p) && (r = !0), !(l < 0) && (i[l] = e, this.callback(this.manager, s, {
|
|
301
|
+
pointers: i,
|
|
302
|
+
changedPointers: [e],
|
|
303
|
+
pointerType: a,
|
|
304
|
+
srcEvent: e
|
|
305
|
+
}), r && i.splice(l, 1));
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
var ye = {
|
|
309
|
+
touchstart: c,
|
|
310
|
+
touchmove: M,
|
|
311
|
+
touchend: o,
|
|
312
|
+
touchcancel: p
|
|
313
|
+
}, Pe = "touchstart", Ne = "touchstart touchmove touchend touchcancel";
|
|
314
|
+
function Vt() {
|
|
315
|
+
this.evTarget = Pe, this.evWin = Ne, this.started = !1, m.apply(this, arguments);
|
|
316
|
+
}
|
|
317
|
+
T(Vt, m, {
|
|
318
|
+
handler: function(e) {
|
|
319
|
+
var i = ye[e.type];
|
|
320
|
+
if (i === c && (this.started = !0), !!this.started) {
|
|
321
|
+
var r = Oe.call(this, e, i);
|
|
322
|
+
i & (o | p) && r[0].length - r[1].length === 0 && (this.started = !1), this.callback(this.manager, i, {
|
|
323
|
+
pointers: r[0],
|
|
324
|
+
changedPointers: r[1],
|
|
325
|
+
pointerType: b,
|
|
326
|
+
srcEvent: e
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
function Oe(t, e) {
|
|
332
|
+
var i = B(t.touches), r = B(t.changedTouches);
|
|
333
|
+
return e & (o | p) && (i = Dt(i.concat(r), "identifier")), [i, r];
|
|
334
|
+
}
|
|
335
|
+
var Ae = {
|
|
336
|
+
touchstart: c,
|
|
337
|
+
touchmove: M,
|
|
338
|
+
touchend: o,
|
|
339
|
+
touchcancel: p
|
|
340
|
+
}, Ce = "touchstart touchmove touchend touchcancel";
|
|
341
|
+
function tt() {
|
|
342
|
+
this.evTarget = Ce, this.targetIds = {}, m.apply(this, arguments);
|
|
343
|
+
}
|
|
344
|
+
T(tt, m, {
|
|
345
|
+
handler: function(e) {
|
|
346
|
+
var i = Ae[e.type], r = Se.call(this, e, i);
|
|
347
|
+
r && this.callback(this.manager, i, {
|
|
348
|
+
pointers: r[0],
|
|
349
|
+
changedPointers: r[1],
|
|
350
|
+
pointerType: b,
|
|
351
|
+
srcEvent: e
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
function Se(t, e) {
|
|
356
|
+
var i = B(t.touches), r = this.targetIds;
|
|
357
|
+
if (e & (c | M) && i.length === 1)
|
|
358
|
+
return r[i[0].identifier] = !0, [i, i];
|
|
359
|
+
var n, s, a = B(t.changedTouches), h = [], l = this.target;
|
|
360
|
+
if (s = i.filter(function(f) {
|
|
361
|
+
return St(f.target, l);
|
|
362
|
+
}), e === c)
|
|
363
|
+
for (n = 0; n < s.length; )
|
|
364
|
+
r[s[n].identifier] = !0, n++;
|
|
365
|
+
for (n = 0; n < a.length; )
|
|
366
|
+
r[a[n].identifier] && h.push(a[n]), e & (o | p) && delete r[a[n].identifier], n++;
|
|
367
|
+
if (h.length)
|
|
368
|
+
return [
|
|
369
|
+
// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
|
|
370
|
+
Dt(s.concat(h), "identifier"),
|
|
371
|
+
h
|
|
372
|
+
];
|
|
373
|
+
}
|
|
374
|
+
var De = 2500, Wt = 25;
|
|
375
|
+
function vt() {
|
|
376
|
+
m.apply(this, arguments);
|
|
377
|
+
var t = ht(this.handler, this);
|
|
378
|
+
this.touch = new tt(this.manager, t), this.mouse = new $(this.manager, t), this.primaryTouch = null, this.lastTouches = [];
|
|
379
|
+
}
|
|
380
|
+
T(vt, m, {
|
|
381
|
+
/**
|
|
382
|
+
* handle mouse and touch events
|
|
383
|
+
* @param {Hammer} manager
|
|
384
|
+
* @param {String} inputEvent
|
|
385
|
+
* @param {Object} inputData
|
|
386
|
+
*/
|
|
387
|
+
handler: function(e, i, r) {
|
|
388
|
+
var n = r.pointerType == b, s = r.pointerType == ut;
|
|
389
|
+
if (!(s && r.sourceCapabilities && r.sourceCapabilities.firesTouchEvents)) {
|
|
390
|
+
if (n)
|
|
391
|
+
Me.call(this, i, r);
|
|
392
|
+
else if (s && Ue.call(this, r))
|
|
393
|
+
return;
|
|
394
|
+
this.callback(e, i, r);
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
/**
|
|
398
|
+
* remove the event listeners
|
|
399
|
+
*/
|
|
400
|
+
destroy: function() {
|
|
401
|
+
this.touch.destroy(), this.mouse.destroy();
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
function Me(t, e) {
|
|
405
|
+
t & c ? (this.primaryTouch = e.changedPointers[0].identifier, qt.call(this, e)) : t & (o | p) && qt.call(this, e);
|
|
406
|
+
}
|
|
407
|
+
function qt(t) {
|
|
408
|
+
var e = t.changedPointers[0];
|
|
409
|
+
if (e.identifier === this.primaryTouch) {
|
|
410
|
+
var i = { x: e.clientX, y: e.clientY };
|
|
411
|
+
this.lastTouches.push(i);
|
|
412
|
+
var r = this.lastTouches, n = function() {
|
|
413
|
+
var s = r.indexOf(i);
|
|
414
|
+
s > -1 && r.splice(s, 1);
|
|
415
|
+
};
|
|
416
|
+
setTimeout(n, De);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function Ue(t) {
|
|
420
|
+
for (var e = t.srcEvent.clientX, i = t.srcEvent.clientY, r = 0; r < this.lastTouches.length; r++) {
|
|
421
|
+
var n = this.lastTouches[r], s = Math.abs(e - n.x), a = Math.abs(i - n.y);
|
|
422
|
+
if (s <= Wt && a <= Wt)
|
|
423
|
+
return !0;
|
|
424
|
+
}
|
|
425
|
+
return !1;
|
|
426
|
+
}
|
|
427
|
+
var wt = j($t.style, "touchAction"), kt = wt !== v, Gt = "compute", zt = "auto", pt = "manipulation", R = "none", q = "pan-x", w = "pan-y", et = xe();
|
|
428
|
+
function Tt(t, e) {
|
|
429
|
+
this.manager = t, this.set(e);
|
|
430
|
+
}
|
|
431
|
+
Tt.prototype = {
|
|
432
|
+
/**
|
|
433
|
+
* set the touchAction value on the element or enable the polyfill
|
|
434
|
+
* @param {String} value
|
|
435
|
+
*/
|
|
436
|
+
set: function(t) {
|
|
437
|
+
t == Gt && (t = this.compute()), kt && this.manager.element.style && et[t] && (this.manager.element.style[wt] = t), this.actions = t.toLowerCase().trim();
|
|
438
|
+
},
|
|
439
|
+
/**
|
|
440
|
+
* just re-set the touchAction value
|
|
441
|
+
*/
|
|
442
|
+
update: function() {
|
|
443
|
+
this.set(this.manager.options.touchAction);
|
|
444
|
+
},
|
|
445
|
+
/**
|
|
446
|
+
* compute the value for the touchAction property based on the recognizer's settings
|
|
447
|
+
* @returns {String} value
|
|
448
|
+
*/
|
|
449
|
+
compute: function() {
|
|
450
|
+
var t = [];
|
|
451
|
+
return P(this.manager.recognizers, function(e) {
|
|
452
|
+
lt(e.options.enable, [e]) && (t = t.concat(e.getTouchAction()));
|
|
453
|
+
}), Re(t.join(" "));
|
|
454
|
+
},
|
|
455
|
+
/**
|
|
456
|
+
* this method is called on each input cycle and provides the preventing of the browser behavior
|
|
457
|
+
* @param {Object} input
|
|
458
|
+
*/
|
|
459
|
+
preventDefaults: function(t) {
|
|
460
|
+
var e = t.srcEvent, i = t.offsetDirection;
|
|
461
|
+
if (this.manager.session.prevented) {
|
|
462
|
+
e.preventDefault();
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
var r = this.actions, n = D(r, R) && !et[R], s = D(r, w) && !et[w], a = D(r, q) && !et[q];
|
|
466
|
+
if (n) {
|
|
467
|
+
var h = t.pointers.length === 1, l = t.distance < 2, f = t.deltaTime < 250;
|
|
468
|
+
if (h && l && f)
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
if (!(a && s) && (n || s && i & _ || a && i & U))
|
|
472
|
+
return this.preventSrc(e);
|
|
473
|
+
},
|
|
474
|
+
/**
|
|
475
|
+
* call preventDefault to prevent the browser's default behavior (scrolling in most cases)
|
|
476
|
+
* @param {Object} srcEvent
|
|
477
|
+
*/
|
|
478
|
+
preventSrc: function(t) {
|
|
479
|
+
this.manager.session.prevented = !0, t.preventDefault();
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
function Re(t) {
|
|
483
|
+
if (D(t, R))
|
|
484
|
+
return R;
|
|
485
|
+
var e = D(t, q), i = D(t, w);
|
|
486
|
+
return e && i ? R : e || i ? e ? q : w : D(t, pt) ? pt : zt;
|
|
487
|
+
}
|
|
488
|
+
function xe() {
|
|
489
|
+
if (!kt)
|
|
490
|
+
return !1;
|
|
491
|
+
var t = {}, e = u.CSS && u.CSS.supports;
|
|
492
|
+
return ["auto", "manipulation", "pan-y", "pan-x", "pan-x pan-y", "none"].forEach(function(i) {
|
|
493
|
+
t[i] = e ? u.CSS.supports("touch-action", i) : !0;
|
|
494
|
+
}), t;
|
|
495
|
+
}
|
|
496
|
+
var it = 1, d = 2, Y = 4, A = 8, N = A, k = 16, I = 32;
|
|
497
|
+
function O(t) {
|
|
498
|
+
this.options = g({}, this.defaults, t || {}), this.id = re(), this.manager = null, this.options.enable = Ct(this.options.enable, !0), this.state = it, this.simultaneous = {}, this.requireFail = [];
|
|
499
|
+
}
|
|
500
|
+
O.prototype = {
|
|
501
|
+
/**
|
|
502
|
+
* @virtual
|
|
503
|
+
* @type {Object}
|
|
504
|
+
*/
|
|
505
|
+
defaults: {},
|
|
506
|
+
/**
|
|
507
|
+
* set options
|
|
508
|
+
* @param {Object} options
|
|
509
|
+
* @return {Recognizer}
|
|
510
|
+
*/
|
|
511
|
+
set: function(t) {
|
|
512
|
+
return g(this.options, t), this.manager && this.manager.touchAction.update(), this;
|
|
513
|
+
},
|
|
514
|
+
/**
|
|
515
|
+
* recognize simultaneous with an other recognizer.
|
|
516
|
+
* @param {Recognizer} otherRecognizer
|
|
517
|
+
* @returns {Recognizer} this
|
|
518
|
+
*/
|
|
519
|
+
recognizeWith: function(t) {
|
|
520
|
+
if (L(t, "recognizeWith", this))
|
|
521
|
+
return this;
|
|
522
|
+
var e = this.simultaneous;
|
|
523
|
+
return t = rt(t, this), e[t.id] || (e[t.id] = t, t.recognizeWith(this)), this;
|
|
524
|
+
},
|
|
525
|
+
/**
|
|
526
|
+
* drop the simultaneous link. it doesnt remove the link on the other recognizer.
|
|
527
|
+
* @param {Recognizer} otherRecognizer
|
|
528
|
+
* @returns {Recognizer} this
|
|
529
|
+
*/
|
|
530
|
+
dropRecognizeWith: function(t) {
|
|
531
|
+
return L(t, "dropRecognizeWith", this) ? this : (t = rt(t, this), delete this.simultaneous[t.id], this);
|
|
532
|
+
},
|
|
533
|
+
/**
|
|
534
|
+
* recognizer can only run when an other is failing
|
|
535
|
+
* @param {Recognizer} otherRecognizer
|
|
536
|
+
* @returns {Recognizer} this
|
|
537
|
+
*/
|
|
538
|
+
requireFailure: function(t) {
|
|
539
|
+
if (L(t, "requireFailure", this))
|
|
540
|
+
return this;
|
|
541
|
+
var e = this.requireFail;
|
|
542
|
+
return t = rt(t, this), H(e, t) === -1 && (e.push(t), t.requireFailure(this)), this;
|
|
543
|
+
},
|
|
544
|
+
/**
|
|
545
|
+
* drop the requireFailure link. it does not remove the link on the other recognizer.
|
|
546
|
+
* @param {Recognizer} otherRecognizer
|
|
547
|
+
* @returns {Recognizer} this
|
|
548
|
+
*/
|
|
549
|
+
dropRequireFailure: function(t) {
|
|
550
|
+
if (L(t, "dropRequireFailure", this))
|
|
551
|
+
return this;
|
|
552
|
+
t = rt(t, this);
|
|
553
|
+
var e = H(this.requireFail, t);
|
|
554
|
+
return e > -1 && this.requireFail.splice(e, 1), this;
|
|
555
|
+
},
|
|
556
|
+
/**
|
|
557
|
+
* has require failures boolean
|
|
558
|
+
* @returns {boolean}
|
|
559
|
+
*/
|
|
560
|
+
hasRequireFailures: function() {
|
|
561
|
+
return this.requireFail.length > 0;
|
|
562
|
+
},
|
|
563
|
+
/**
|
|
564
|
+
* if the recognizer can recognize simultaneous with an other recognizer
|
|
565
|
+
* @param {Recognizer} otherRecognizer
|
|
566
|
+
* @returns {Boolean}
|
|
567
|
+
*/
|
|
568
|
+
canRecognizeWith: function(t) {
|
|
569
|
+
return !!this.simultaneous[t.id];
|
|
570
|
+
},
|
|
571
|
+
/**
|
|
572
|
+
* You should use `tryEmit` instead of `emit` directly to check
|
|
573
|
+
* that all the needed recognizers has failed before emitting.
|
|
574
|
+
* @param {Object} input
|
|
575
|
+
*/
|
|
576
|
+
emit: function(t) {
|
|
577
|
+
var e = this, i = this.state;
|
|
578
|
+
function r(n) {
|
|
579
|
+
e.manager.emit(n, t);
|
|
580
|
+
}
|
|
581
|
+
i < A && r(e.options.event + Zt(i)), r(e.options.event), t.additionalEvent && r(t.additionalEvent), i >= A && r(e.options.event + Zt(i));
|
|
582
|
+
},
|
|
583
|
+
/**
|
|
584
|
+
* Check that all the require failure recognizers has failed,
|
|
585
|
+
* if true, it emits a gesture event,
|
|
586
|
+
* otherwise, setup the state to FAILED.
|
|
587
|
+
* @param {Object} input
|
|
588
|
+
*/
|
|
589
|
+
tryEmit: function(t) {
|
|
590
|
+
if (this.canEmit())
|
|
591
|
+
return this.emit(t);
|
|
592
|
+
this.state = I;
|
|
593
|
+
},
|
|
594
|
+
/**
|
|
595
|
+
* can we emit?
|
|
596
|
+
* @returns {boolean}
|
|
597
|
+
*/
|
|
598
|
+
canEmit: function() {
|
|
599
|
+
for (var t = 0; t < this.requireFail.length; ) {
|
|
600
|
+
if (!(this.requireFail[t].state & (I | it)))
|
|
601
|
+
return !1;
|
|
602
|
+
t++;
|
|
603
|
+
}
|
|
604
|
+
return !0;
|
|
605
|
+
},
|
|
606
|
+
/**
|
|
607
|
+
* update the recognizer
|
|
608
|
+
* @param {Object} inputData
|
|
609
|
+
*/
|
|
610
|
+
recognize: function(t) {
|
|
611
|
+
var e = g({}, t);
|
|
612
|
+
if (!lt(this.options.enable, [this, e])) {
|
|
613
|
+
this.reset(), this.state = I;
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
this.state & (N | k | I) && (this.state = it), this.state = this.process(e), this.state & (d | Y | A | k) && this.tryEmit(e);
|
|
617
|
+
},
|
|
618
|
+
/**
|
|
619
|
+
* return the state of the recognizer
|
|
620
|
+
* the actual recognizing happens in this method
|
|
621
|
+
* @virtual
|
|
622
|
+
* @param {Object} inputData
|
|
623
|
+
* @returns {Const} STATE
|
|
624
|
+
*/
|
|
625
|
+
process: function(t) {
|
|
626
|
+
},
|
|
627
|
+
// jshint ignore:line
|
|
628
|
+
/**
|
|
629
|
+
* return the preferred touch-action
|
|
630
|
+
* @virtual
|
|
631
|
+
* @returns {Array}
|
|
632
|
+
*/
|
|
633
|
+
getTouchAction: function() {
|
|
634
|
+
},
|
|
635
|
+
/**
|
|
636
|
+
* called when the gesture isn't allowed to recognize
|
|
637
|
+
* like when another is being recognized or it is disabled
|
|
638
|
+
* @virtual
|
|
639
|
+
*/
|
|
640
|
+
reset: function() {
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
function Zt(t) {
|
|
644
|
+
return t & k ? "cancel" : t & A ? "end" : t & Y ? "move" : t & d ? "start" : "";
|
|
645
|
+
}
|
|
646
|
+
function Bt(t) {
|
|
647
|
+
return t == W ? "down" : t == V ? "up" : t == F ? "left" : t == X ? "right" : "";
|
|
648
|
+
}
|
|
649
|
+
function rt(t, e) {
|
|
650
|
+
var i = e.manager;
|
|
651
|
+
return i ? i.get(t) : t;
|
|
652
|
+
}
|
|
653
|
+
function E() {
|
|
654
|
+
O.apply(this, arguments);
|
|
655
|
+
}
|
|
656
|
+
T(E, O, {
|
|
657
|
+
/**
|
|
658
|
+
* @namespace
|
|
659
|
+
* @memberof AttrRecognizer
|
|
660
|
+
*/
|
|
661
|
+
defaults: {
|
|
662
|
+
/**
|
|
663
|
+
* @type {Number}
|
|
664
|
+
* @default 1
|
|
665
|
+
*/
|
|
666
|
+
pointers: 1
|
|
667
|
+
},
|
|
668
|
+
/**
|
|
669
|
+
* Used to check if it the recognizer receives valid input, like input.distance > 10.
|
|
670
|
+
* @memberof AttrRecognizer
|
|
671
|
+
* @param {Object} input
|
|
672
|
+
* @returns {Boolean} recognized
|
|
673
|
+
*/
|
|
674
|
+
attrTest: function(t) {
|
|
675
|
+
var e = this.options.pointers;
|
|
676
|
+
return e === 0 || t.pointers.length === e;
|
|
677
|
+
},
|
|
678
|
+
/**
|
|
679
|
+
* Process the input and return the state for the recognizer
|
|
680
|
+
* @memberof AttrRecognizer
|
|
681
|
+
* @param {Object} input
|
|
682
|
+
* @returns {*} State
|
|
683
|
+
*/
|
|
684
|
+
process: function(t) {
|
|
685
|
+
var e = this.state, i = t.eventType, r = e & (d | Y), n = this.attrTest(t);
|
|
686
|
+
return r && (i & p || !n) ? e | k : r || n ? i & o ? e | A : e & d ? e | Y : d : I;
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
function nt() {
|
|
690
|
+
E.apply(this, arguments), this.pX = null, this.pY = null;
|
|
691
|
+
}
|
|
692
|
+
T(nt, E, {
|
|
693
|
+
/**
|
|
694
|
+
* @namespace
|
|
695
|
+
* @memberof PanRecognizer
|
|
696
|
+
*/
|
|
697
|
+
defaults: {
|
|
698
|
+
event: "pan",
|
|
699
|
+
threshold: 10,
|
|
700
|
+
pointers: 1,
|
|
701
|
+
direction: Rt
|
|
702
|
+
},
|
|
703
|
+
getTouchAction: function() {
|
|
704
|
+
var t = this.options.direction, e = [];
|
|
705
|
+
return t & _ && e.push(w), t & U && e.push(q), e;
|
|
706
|
+
},
|
|
707
|
+
directionTest: function(t) {
|
|
708
|
+
var e = this.options, i = !0, r = t.distance, n = t.direction, s = t.deltaX, a = t.deltaY;
|
|
709
|
+
return n & e.direction || (e.direction & _ ? (n = s === 0 ? J : s < 0 ? F : X, i = s != this.pX, r = Math.abs(t.deltaX)) : (n = a === 0 ? J : a < 0 ? V : W, i = a != this.pY, r = Math.abs(t.deltaY))), t.direction = n, i && r > e.threshold && n & e.direction;
|
|
710
|
+
},
|
|
711
|
+
attrTest: function(t) {
|
|
712
|
+
return E.prototype.attrTest.call(this, t) && (this.state & d || !(this.state & d) && this.directionTest(t));
|
|
713
|
+
},
|
|
714
|
+
emit: function(t) {
|
|
715
|
+
this.pX = t.deltaX, this.pY = t.deltaY;
|
|
716
|
+
var e = Bt(t.direction);
|
|
717
|
+
e && (t.additionalEvent = this.options.event + e), this._super.emit.call(this, t);
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
function mt() {
|
|
721
|
+
E.apply(this, arguments);
|
|
722
|
+
}
|
|
723
|
+
T(mt, E, {
|
|
724
|
+
/**
|
|
725
|
+
* @namespace
|
|
726
|
+
* @memberof PinchRecognizer
|
|
727
|
+
*/
|
|
728
|
+
defaults: {
|
|
729
|
+
event: "pinch",
|
|
730
|
+
threshold: 0,
|
|
731
|
+
pointers: 2
|
|
732
|
+
},
|
|
733
|
+
getTouchAction: function() {
|
|
734
|
+
return [R];
|
|
735
|
+
},
|
|
736
|
+
attrTest: function(t) {
|
|
737
|
+
return this._super.attrTest.call(this, t) && (Math.abs(t.scale - 1) > this.options.threshold || this.state & d);
|
|
738
|
+
},
|
|
739
|
+
emit: function(t) {
|
|
740
|
+
if (t.scale !== 1) {
|
|
741
|
+
var e = t.scale < 1 ? "in" : "out";
|
|
742
|
+
t.additionalEvent = this.options.event + e;
|
|
743
|
+
}
|
|
744
|
+
this._super.emit.call(this, t);
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
function dt() {
|
|
748
|
+
O.apply(this, arguments), this._timer = null, this._input = null;
|
|
749
|
+
}
|
|
750
|
+
T(dt, O, {
|
|
751
|
+
/**
|
|
752
|
+
* @namespace
|
|
753
|
+
* @memberof PressRecognizer
|
|
754
|
+
*/
|
|
755
|
+
defaults: {
|
|
756
|
+
event: "press",
|
|
757
|
+
pointers: 1,
|
|
758
|
+
time: 251,
|
|
759
|
+
// minimal time of the pointer to be pressed
|
|
760
|
+
threshold: 9
|
|
761
|
+
// a minimal movement is ok, but keep it low
|
|
762
|
+
},
|
|
763
|
+
getTouchAction: function() {
|
|
764
|
+
return [zt];
|
|
765
|
+
},
|
|
766
|
+
process: function(t) {
|
|
767
|
+
var e = this.options, i = t.pointers.length === e.pointers, r = t.distance < e.threshold, n = t.deltaTime > e.time;
|
|
768
|
+
if (this._input = t, !r || !i || t.eventType & (o | p) && !n)
|
|
769
|
+
this.reset();
|
|
770
|
+
else if (t.eventType & c)
|
|
771
|
+
this.reset(), this._timer = ot(function() {
|
|
772
|
+
this.state = N, this.tryEmit();
|
|
773
|
+
}, e.time, this);
|
|
774
|
+
else if (t.eventType & o)
|
|
775
|
+
return N;
|
|
776
|
+
return I;
|
|
777
|
+
},
|
|
778
|
+
reset: function() {
|
|
779
|
+
clearTimeout(this._timer);
|
|
780
|
+
},
|
|
781
|
+
emit: function(t) {
|
|
782
|
+
this.state === N && (t && t.eventType & o ? this.manager.emit(this.options.event + "up", t) : (this._input.timeStamp = at(), this.manager.emit(this.options.event, this._input)));
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
function Et() {
|
|
786
|
+
E.apply(this, arguments);
|
|
787
|
+
}
|
|
788
|
+
T(Et, E, {
|
|
789
|
+
/**
|
|
790
|
+
* @namespace
|
|
791
|
+
* @memberof RotateRecognizer
|
|
792
|
+
*/
|
|
793
|
+
defaults: {
|
|
794
|
+
event: "rotate",
|
|
795
|
+
threshold: 0,
|
|
796
|
+
pointers: 2
|
|
797
|
+
},
|
|
798
|
+
getTouchAction: function() {
|
|
799
|
+
return [R];
|
|
800
|
+
},
|
|
801
|
+
attrTest: function(t) {
|
|
802
|
+
return this._super.attrTest.call(this, t) && (Math.abs(t.rotation) > this.options.threshold || this.state & d);
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
function gt() {
|
|
806
|
+
E.apply(this, arguments);
|
|
807
|
+
}
|
|
808
|
+
T(gt, E, {
|
|
809
|
+
/**
|
|
810
|
+
* @namespace
|
|
811
|
+
* @memberof SwipeRecognizer
|
|
812
|
+
*/
|
|
813
|
+
defaults: {
|
|
814
|
+
event: "swipe",
|
|
815
|
+
threshold: 10,
|
|
816
|
+
velocity: 0.3,
|
|
817
|
+
direction: _ | U,
|
|
818
|
+
pointers: 1
|
|
819
|
+
},
|
|
820
|
+
getTouchAction: function() {
|
|
821
|
+
return nt.prototype.getTouchAction.call(this);
|
|
822
|
+
},
|
|
823
|
+
attrTest: function(t) {
|
|
824
|
+
var e = this.options.direction, i;
|
|
825
|
+
return e & (_ | U) ? i = t.overallVelocity : e & _ ? i = t.overallVelocityX : e & U && (i = t.overallVelocityY), this._super.attrTest.call(this, t) && e & t.offsetDirection && t.distance > this.options.threshold && t.maxPointers == this.options.pointers && S(i) > this.options.velocity && t.eventType & o;
|
|
826
|
+
},
|
|
827
|
+
emit: function(t) {
|
|
828
|
+
var e = Bt(t.offsetDirection);
|
|
829
|
+
e && this.manager.emit(this.options.event + e, t), this.manager.emit(this.options.event, t);
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
function st() {
|
|
833
|
+
O.apply(this, arguments), this.pTime = !1, this.pCenter = !1, this._timer = null, this._input = null, this.count = 0;
|
|
834
|
+
}
|
|
835
|
+
T(st, O, {
|
|
836
|
+
/**
|
|
837
|
+
* @namespace
|
|
838
|
+
* @memberof PinchRecognizer
|
|
839
|
+
*/
|
|
840
|
+
defaults: {
|
|
841
|
+
event: "tap",
|
|
842
|
+
pointers: 1,
|
|
843
|
+
taps: 1,
|
|
844
|
+
interval: 300,
|
|
845
|
+
// max time between the multi-tap taps
|
|
846
|
+
time: 250,
|
|
847
|
+
// max time of the pointer to be down (like finger on the screen)
|
|
848
|
+
threshold: 9,
|
|
849
|
+
// a minimal movement is ok, but keep it low
|
|
850
|
+
posThreshold: 10
|
|
851
|
+
// a multi-tap can be a bit off the initial position
|
|
852
|
+
},
|
|
853
|
+
getTouchAction: function() {
|
|
854
|
+
return [pt];
|
|
855
|
+
},
|
|
856
|
+
process: function(t) {
|
|
857
|
+
var e = this.options, i = t.pointers.length === e.pointers, r = t.distance < e.threshold, n = t.deltaTime < e.time;
|
|
858
|
+
if (this.reset(), t.eventType & c && this.count === 0)
|
|
859
|
+
return this.failTimeout();
|
|
860
|
+
if (r && n && i) {
|
|
861
|
+
if (t.eventType != o)
|
|
862
|
+
return this.failTimeout();
|
|
863
|
+
var s = this.pTime ? t.timeStamp - this.pTime < e.interval : !0, a = !this.pCenter || K(this.pCenter, t.center) < e.posThreshold;
|
|
864
|
+
this.pTime = t.timeStamp, this.pCenter = t.center, !a || !s ? this.count = 1 : this.count += 1, this._input = t;
|
|
865
|
+
var h = this.count % e.taps;
|
|
866
|
+
if (h === 0)
|
|
867
|
+
return this.hasRequireFailures() ? (this._timer = ot(function() {
|
|
868
|
+
this.state = N, this.tryEmit();
|
|
869
|
+
}, e.interval, this), d) : N;
|
|
870
|
+
}
|
|
871
|
+
return I;
|
|
872
|
+
},
|
|
873
|
+
failTimeout: function() {
|
|
874
|
+
return this._timer = ot(function() {
|
|
875
|
+
this.state = I;
|
|
876
|
+
}, this.options.interval, this), I;
|
|
877
|
+
},
|
|
878
|
+
reset: function() {
|
|
879
|
+
clearTimeout(this._timer);
|
|
880
|
+
},
|
|
881
|
+
emit: function() {
|
|
882
|
+
this.state == N && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input));
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
function C(t, e) {
|
|
886
|
+
return e = e || {}, e.recognizers = Ct(e.recognizers, C.defaults.preset), new _t(t, e);
|
|
887
|
+
}
|
|
888
|
+
C.VERSION = "2.0.7", C.defaults = {
|
|
889
|
+
/**
|
|
890
|
+
* set if DOM events are being triggered.
|
|
891
|
+
* But this is slower and unused by simple implementations, so disabled by default.
|
|
892
|
+
* @type {Boolean}
|
|
893
|
+
* @default false
|
|
894
|
+
*/
|
|
895
|
+
domEvents: !1,
|
|
896
|
+
/**
|
|
897
|
+
* The value for the touchAction property/fallback.
|
|
898
|
+
* When set to `compute` it will magically set the correct value based on the added recognizers.
|
|
899
|
+
* @type {String}
|
|
900
|
+
* @default compute
|
|
901
|
+
*/
|
|
902
|
+
touchAction: Gt,
|
|
903
|
+
/**
|
|
904
|
+
* @type {Boolean}
|
|
905
|
+
* @default true
|
|
906
|
+
*/
|
|
907
|
+
enable: !0,
|
|
908
|
+
/**
|
|
909
|
+
* EXPERIMENTAL FEATURE -- can be removed/changed
|
|
910
|
+
* Change the parent input target element.
|
|
911
|
+
* If Null, then it is being set the to main element.
|
|
912
|
+
* @type {Null|EventTarget}
|
|
913
|
+
* @default null
|
|
914
|
+
*/
|
|
915
|
+
inputTarget: null,
|
|
916
|
+
/**
|
|
917
|
+
* force an input class
|
|
918
|
+
* @type {Null|Function}
|
|
919
|
+
* @default null
|
|
920
|
+
*/
|
|
921
|
+
inputClass: null,
|
|
922
|
+
/**
|
|
923
|
+
* Default recognizer setup when calling `Hammer()`
|
|
924
|
+
* When creating a new Manager these will be skipped.
|
|
925
|
+
* @type {Array}
|
|
926
|
+
*/
|
|
927
|
+
preset: [
|
|
928
|
+
// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
|
|
929
|
+
[Et, { enable: !1 }],
|
|
930
|
+
[mt, { enable: !1 }, ["rotate"]],
|
|
931
|
+
[gt, { direction: _ }],
|
|
932
|
+
[nt, { direction: _ }, ["swipe"]],
|
|
933
|
+
[st],
|
|
934
|
+
[st, { event: "doubletap", taps: 2 }, ["tap"]],
|
|
935
|
+
[dt]
|
|
936
|
+
],
|
|
937
|
+
/**
|
|
938
|
+
* Some CSS properties can be used to improve the working of Hammer.
|
|
939
|
+
* Add them to this method and they will be set when creating a new Manager.
|
|
940
|
+
* @namespace
|
|
941
|
+
*/
|
|
942
|
+
cssProps: {
|
|
943
|
+
/**
|
|
944
|
+
* Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
|
|
945
|
+
* @type {String}
|
|
946
|
+
* @default 'none'
|
|
947
|
+
*/
|
|
948
|
+
userSelect: "none",
|
|
949
|
+
/**
|
|
950
|
+
* Disable the Windows Phone grippers when pressing an element.
|
|
951
|
+
* @type {String}
|
|
952
|
+
* @default 'none'
|
|
953
|
+
*/
|
|
954
|
+
touchSelect: "none",
|
|
955
|
+
/**
|
|
956
|
+
* Disables the default callout shown when you touch and hold a touch target.
|
|
957
|
+
* On iOS, when you touch and hold a touch target such as a link, Safari displays
|
|
958
|
+
* a callout containing information about the link. This property allows you to disable that callout.
|
|
959
|
+
* @type {String}
|
|
960
|
+
* @default 'none'
|
|
961
|
+
*/
|
|
962
|
+
touchCallout: "none",
|
|
963
|
+
/**
|
|
964
|
+
* Specifies whether zooming is enabled. Used by IE10>
|
|
965
|
+
* @type {String}
|
|
966
|
+
* @default 'none'
|
|
967
|
+
*/
|
|
968
|
+
contentZooming: "none",
|
|
969
|
+
/**
|
|
970
|
+
* Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
|
|
971
|
+
* @type {String}
|
|
972
|
+
* @default 'none'
|
|
973
|
+
*/
|
|
974
|
+
userDrag: "none",
|
|
975
|
+
/**
|
|
976
|
+
* Overrides the highlight color shown when the user taps a link or a JavaScript
|
|
977
|
+
* clickable element in iOS. This property obeys the alpha value, if specified.
|
|
978
|
+
* @type {String}
|
|
979
|
+
* @default 'rgba(0,0,0,0)'
|
|
980
|
+
*/
|
|
981
|
+
tapHighlightColor: "rgba(0,0,0,0)"
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
var Le = 1, jt = 2;
|
|
985
|
+
function _t(t, e) {
|
|
986
|
+
this.options = g({}, C.defaults, e || {}), this.options.inputTarget = this.options.inputTarget || t, this.handlers = {}, this.session = {}, this.recognizers = [], this.oldCssProps = {}, this.element = t, this.input = ue(this), this.touchAction = new Tt(this, this.options.touchAction), Jt(this, !0), P(this.options.recognizers, function(i) {
|
|
987
|
+
var r = this.add(new i[0](i[1]));
|
|
988
|
+
i[2] && r.recognizeWith(i[2]), i[3] && r.requireFailure(i[3]);
|
|
989
|
+
}, this);
|
|
990
|
+
}
|
|
991
|
+
_t.prototype = {
|
|
992
|
+
/**
|
|
993
|
+
* set options
|
|
994
|
+
* @param {Object} options
|
|
995
|
+
* @returns {Manager}
|
|
996
|
+
*/
|
|
997
|
+
set: function(t) {
|
|
998
|
+
return g(this.options, t), t.touchAction && this.touchAction.update(), t.inputTarget && (this.input.destroy(), this.input.target = t.inputTarget, this.input.init()), this;
|
|
999
|
+
},
|
|
1000
|
+
/**
|
|
1001
|
+
* stop recognizing for this session.
|
|
1002
|
+
* This session will be discarded, when a new [input]start event is fired.
|
|
1003
|
+
* When forced, the recognizer cycle is stopped immediately.
|
|
1004
|
+
* @param {Boolean} [force]
|
|
1005
|
+
*/
|
|
1006
|
+
stop: function(t) {
|
|
1007
|
+
this.session.stopped = t ? jt : Le;
|
|
1008
|
+
},
|
|
1009
|
+
/**
|
|
1010
|
+
* run the recognizers!
|
|
1011
|
+
* called by the inputHandler function on every movement of the pointers (touches)
|
|
1012
|
+
* it walks through all the recognizers and tries to detect the gesture that is being made
|
|
1013
|
+
* @param {Object} inputData
|
|
1014
|
+
*/
|
|
1015
|
+
recognize: function(t) {
|
|
1016
|
+
var e = this.session;
|
|
1017
|
+
if (!e.stopped) {
|
|
1018
|
+
this.touchAction.preventDefaults(t);
|
|
1019
|
+
var i, r = this.recognizers, n = e.curRecognizer;
|
|
1020
|
+
(!n || n && n.state & N) && (n = e.curRecognizer = null);
|
|
1021
|
+
for (var s = 0; s < r.length; )
|
|
1022
|
+
i = r[s], e.stopped !== jt && // 1
|
|
1023
|
+
(!n || i == n || // 2
|
|
1024
|
+
i.canRecognizeWith(n)) ? i.recognize(t) : i.reset(), !n && i.state & (d | Y | A) && (n = e.curRecognizer = i), s++;
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
/**
|
|
1028
|
+
* get a recognizer by its event name.
|
|
1029
|
+
* @param {Recognizer|String} recognizer
|
|
1030
|
+
* @returns {Recognizer|Null}
|
|
1031
|
+
*/
|
|
1032
|
+
get: function(t) {
|
|
1033
|
+
if (t instanceof O)
|
|
1034
|
+
return t;
|
|
1035
|
+
for (var e = this.recognizers, i = 0; i < e.length; i++)
|
|
1036
|
+
if (e[i].options.event == t)
|
|
1037
|
+
return e[i];
|
|
1038
|
+
return null;
|
|
1039
|
+
},
|
|
1040
|
+
/**
|
|
1041
|
+
* add a recognizer to the manager
|
|
1042
|
+
* existing recognizers with the same event name will be removed
|
|
1043
|
+
* @param {Recognizer} recognizer
|
|
1044
|
+
* @returns {Recognizer|Manager}
|
|
1045
|
+
*/
|
|
1046
|
+
add: function(t) {
|
|
1047
|
+
if (L(t, "add", this))
|
|
1048
|
+
return this;
|
|
1049
|
+
var e = this.get(t.options.event);
|
|
1050
|
+
return e && this.remove(e), this.recognizers.push(t), t.manager = this, this.touchAction.update(), t;
|
|
1051
|
+
},
|
|
1052
|
+
/**
|
|
1053
|
+
* remove a recognizer by name or instance
|
|
1054
|
+
* @param {Recognizer|String} recognizer
|
|
1055
|
+
* @returns {Manager}
|
|
1056
|
+
*/
|
|
1057
|
+
remove: function(t) {
|
|
1058
|
+
if (L(t, "remove", this))
|
|
1059
|
+
return this;
|
|
1060
|
+
if (t = this.get(t), t) {
|
|
1061
|
+
var e = this.recognizers, i = H(e, t);
|
|
1062
|
+
i !== -1 && (e.splice(i, 1), this.touchAction.update());
|
|
1063
|
+
}
|
|
1064
|
+
return this;
|
|
1065
|
+
},
|
|
1066
|
+
/**
|
|
1067
|
+
* bind event
|
|
1068
|
+
* @param {String} events
|
|
1069
|
+
* @param {Function} handler
|
|
1070
|
+
* @returns {EventEmitter} this
|
|
1071
|
+
*/
|
|
1072
|
+
on: function(t, e) {
|
|
1073
|
+
if (t !== v && e !== v) {
|
|
1074
|
+
var i = this.handlers;
|
|
1075
|
+
return P(Z(t), function(r) {
|
|
1076
|
+
i[r] = i[r] || [], i[r].push(e);
|
|
1077
|
+
}), this;
|
|
1078
|
+
}
|
|
1079
|
+
},
|
|
1080
|
+
/**
|
|
1081
|
+
* unbind event, leave emit blank to remove all handlers
|
|
1082
|
+
* @param {String} events
|
|
1083
|
+
* @param {Function} [handler]
|
|
1084
|
+
* @returns {EventEmitter} this
|
|
1085
|
+
*/
|
|
1086
|
+
off: function(t, e) {
|
|
1087
|
+
if (t !== v) {
|
|
1088
|
+
var i = this.handlers;
|
|
1089
|
+
return P(Z(t), function(r) {
|
|
1090
|
+
e ? i[r] && i[r].splice(H(i[r], e), 1) : delete i[r];
|
|
1091
|
+
}), this;
|
|
1092
|
+
}
|
|
1093
|
+
},
|
|
1094
|
+
/**
|
|
1095
|
+
* emit event to the listeners
|
|
1096
|
+
* @param {String} event
|
|
1097
|
+
* @param {Object} data
|
|
1098
|
+
*/
|
|
1099
|
+
emit: function(t, e) {
|
|
1100
|
+
this.options.domEvents && He(t, e);
|
|
1101
|
+
var i = this.handlers[t] && this.handlers[t].slice();
|
|
1102
|
+
if (!(!i || !i.length)) {
|
|
1103
|
+
e.type = t, e.preventDefault = function() {
|
|
1104
|
+
e.srcEvent.preventDefault();
|
|
1105
|
+
};
|
|
1106
|
+
for (var r = 0; r < i.length; )
|
|
1107
|
+
i[r](e), r++;
|
|
1108
|
+
}
|
|
1109
|
+
},
|
|
1110
|
+
/**
|
|
1111
|
+
* destroy the manager and unbinds all events
|
|
1112
|
+
* it doesn't unbind dom events, that is the user own responsibility
|
|
1113
|
+
*/
|
|
1114
|
+
destroy: function() {
|
|
1115
|
+
this.element && Jt(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null;
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
function Jt(t, e) {
|
|
1119
|
+
var i = t.element;
|
|
1120
|
+
if (i.style) {
|
|
1121
|
+
var r;
|
|
1122
|
+
P(t.options.cssProps, function(n, s) {
|
|
1123
|
+
r = j(i.style, s), e ? (t.oldCssProps[r] = i.style[r], i.style[r] = n) : i.style[r] = t.oldCssProps[r] || "";
|
|
1124
|
+
}), e || (t.oldCssProps = {});
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
function He(t, e) {
|
|
1128
|
+
var i = Pt.createEvent("Event");
|
|
1129
|
+
i.initEvent(t, !0, !0), i.gesture = e, e.target.dispatchEvent(i);
|
|
1130
|
+
}
|
|
1131
|
+
g(C, {
|
|
1132
|
+
INPUT_START: c,
|
|
1133
|
+
INPUT_MOVE: M,
|
|
1134
|
+
INPUT_END: o,
|
|
1135
|
+
INPUT_CANCEL: p,
|
|
1136
|
+
STATE_POSSIBLE: it,
|
|
1137
|
+
STATE_BEGAN: d,
|
|
1138
|
+
STATE_CHANGED: Y,
|
|
1139
|
+
STATE_ENDED: A,
|
|
1140
|
+
STATE_RECOGNIZED: N,
|
|
1141
|
+
STATE_CANCELLED: k,
|
|
1142
|
+
STATE_FAILED: I,
|
|
1143
|
+
DIRECTION_NONE: J,
|
|
1144
|
+
DIRECTION_LEFT: F,
|
|
1145
|
+
DIRECTION_RIGHT: X,
|
|
1146
|
+
DIRECTION_UP: V,
|
|
1147
|
+
DIRECTION_DOWN: W,
|
|
1148
|
+
DIRECTION_HORIZONTAL: _,
|
|
1149
|
+
DIRECTION_VERTICAL: U,
|
|
1150
|
+
DIRECTION_ALL: Rt,
|
|
1151
|
+
Manager: _t,
|
|
1152
|
+
Input: m,
|
|
1153
|
+
TouchAction: Tt,
|
|
1154
|
+
TouchInput: tt,
|
|
1155
|
+
MouseInput: $,
|
|
1156
|
+
PointerEventInput: ft,
|
|
1157
|
+
TouchMouseInput: vt,
|
|
1158
|
+
SingleTouchInput: Vt,
|
|
1159
|
+
Recognizer: O,
|
|
1160
|
+
AttrRecognizer: E,
|
|
1161
|
+
Tap: st,
|
|
1162
|
+
Pan: nt,
|
|
1163
|
+
Swipe: gt,
|
|
1164
|
+
Pinch: mt,
|
|
1165
|
+
Rotate: Et,
|
|
1166
|
+
Press: dt,
|
|
1167
|
+
on: G,
|
|
1168
|
+
off: z,
|
|
1169
|
+
each: P,
|
|
1170
|
+
merge: ee,
|
|
1171
|
+
extend: At,
|
|
1172
|
+
assign: g,
|
|
1173
|
+
inherit: T,
|
|
1174
|
+
bindFn: ht,
|
|
1175
|
+
prefixed: j
|
|
1176
|
+
});
|
|
1177
|
+
var Ye = typeof u < "u" ? u : typeof self < "u" ? self : {};
|
|
1178
|
+
Ye.Hammer = C, yt.exports ? yt.exports = C : u[Kt] = C;
|
|
1179
|
+
})(window, document, "Hammer");
|
|
1180
|
+
}(It)), It.exports;
|
|
1181
|
+
}
|
|
1182
|
+
var Xe = Fe();
|
|
1183
|
+
const Ve = /* @__PURE__ */ be(Xe), qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1184
|
+
__proto__: null,
|
|
1185
|
+
default: Ve
|
|
1186
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1187
|
+
export {
|
|
1188
|
+
qe as h
|
|
1189
|
+
};
|