@realsee/five 6.7.1 → 6.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/gltf-loader.DDSLoader.html +1 -1
- package/docs/classes/gltf-loader.DRACOLoader.html +1 -1
- package/docs/classes/gltf-loader.GLTFObject.html +1 -1
- package/docs/classes/gltf-loader.THREEGLTFLoader.html +1 -1
- package/docs/classes/line.LineGeometry.html +1 -1
- package/docs/classes/line.LineMaterial.html +1 -1
- package/docs/classes/line.LineSegmentsGeometry.html +1 -1
- package/docs/classes/line.THREE_Line2.html +1 -1
- package/docs/classes/line.THREE_LineSegments2.html +1 -1
- package/docs/classes/vfx.Airflow.html +1 -1
- package/docs/classes/vfx.Flame.html +1 -1
- package/docs/classes/vfx.Particle.html +1 -1
- package/docs/classes/vfx.ParticleGPU.html +1 -1
- package/docs/classes/vfx.SpotLight.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginController.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginType.State.html +1 -1
- package/docs/interfaces/plugins.PanoAnimeController.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.State.html +1 -1
- package/docs/interfaces/plugins.TrajectoryController.html +25 -8
- package/docs/interfaces/react.FiveInjectionTypes.html +1 -1
- package/five/index.js +3 -3
- package/five/index.mjs +4 -4
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -3
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/plugins/index.d.ts +26 -0
- package/plugins/index.js +17 -17
- package/plugins/index.mjs +1518 -1370
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/shader-lib/index.js +2 -2
- package/shader-lib/index.mjs +2 -2
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +3 -3
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +16 -16
- package/umd/five-react.js +2 -2
- package/umd/five-shader-lib.js +2 -2
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five-vue.js +2 -2
- package/umd/five.js +3 -3
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/vue/index.js +2 -2
- package/vue/index.mjs +2 -2
- package/work-downloader/index.js +2 -2
- package/work-downloader/index.mjs +2 -2
package/plugins/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated: 2026/1/
|
|
5
|
-
* Version: 6.7.
|
|
4
|
+
* Generated: 2026/1/12
|
|
5
|
+
* Version: 6.7.2
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,101 +252,101 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/import { Subscribe as
|
|
255
|
+
*/import { Subscribe as Pn, AnimationFrameLoop as Ie, Camera as Mn, PanoCircleMesh as Sn } from "@realsee/five";
|
|
256
256
|
import * as p from "three";
|
|
257
|
-
import { EventDispatcher as Jt, Vector3 as ye, MOUSE as
|
|
258
|
-
import { BasePlugin as
|
|
259
|
-
function
|
|
260
|
-
return /^https?:\/\/|^\/\//.test(
|
|
257
|
+
import { EventDispatcher as Jt, Vector3 as ye, MOUSE as xe, TOUCH as Ce, Spherical as Ht, Quaternion as Kt, Vector2 as Te, Object3D as $t, Matrix4 as xn } from "three";
|
|
258
|
+
import { BasePlugin as _t } from "@realsee/five/plugins";
|
|
259
|
+
function Cn(d) {
|
|
260
|
+
return /^https?:\/\/|^\/\//.test(d) || /^data:/.test(d);
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
return
|
|
262
|
+
function _n(d, l) {
|
|
263
|
+
return Cn(l) ? l : "".concat(d).concat(l);
|
|
264
264
|
}
|
|
265
|
-
var
|
|
266
|
-
(function(
|
|
267
|
-
var
|
|
265
|
+
var Xe;
|
|
266
|
+
(function(d) {
|
|
267
|
+
var l = (
|
|
268
268
|
/** @class */
|
|
269
269
|
(function() {
|
|
270
270
|
function e(n, t) {
|
|
271
|
-
this.hooks = new
|
|
271
|
+
this.hooks = new Pn(), this.staticPrefix = "//vr-image-4.realsee-cdn.cn", this.five = n, t != null && t.staticPrefix && (this.staticPrefix = t.staticPrefix);
|
|
272
272
|
}
|
|
273
273
|
return e.prototype.getCurrentState = function() {
|
|
274
274
|
return this.state;
|
|
275
275
|
}, e.prototype.absoluteUrl = function(n) {
|
|
276
|
-
return
|
|
276
|
+
return _n(this.staticPrefix, n);
|
|
277
277
|
}, e;
|
|
278
278
|
})()
|
|
279
279
|
);
|
|
280
|
-
|
|
281
|
-
})(
|
|
282
|
-
var
|
|
283
|
-
return
|
|
280
|
+
d.Controller = l;
|
|
281
|
+
})(Xe || (Xe = {}));
|
|
282
|
+
var xt = function(d, l) {
|
|
283
|
+
return xt = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, n) {
|
|
284
284
|
e.__proto__ = n;
|
|
285
285
|
} || function(e, n) {
|
|
286
286
|
for (var t in n) Object.prototype.hasOwnProperty.call(n, t) && (e[t] = n[t]);
|
|
287
|
-
},
|
|
287
|
+
}, xt(d, l);
|
|
288
288
|
};
|
|
289
|
-
function he(
|
|
290
|
-
if (typeof
|
|
291
|
-
throw new TypeError("Class extends value " + String(
|
|
292
|
-
|
|
289
|
+
function he(d, l) {
|
|
290
|
+
if (typeof l != "function" && l !== null)
|
|
291
|
+
throw new TypeError("Class extends value " + String(l) + " is not a constructor or null");
|
|
292
|
+
xt(d, l);
|
|
293
293
|
function e() {
|
|
294
|
-
this.constructor =
|
|
294
|
+
this.constructor = d;
|
|
295
295
|
}
|
|
296
|
-
|
|
296
|
+
d.prototype = l === null ? Object.create(l) : (e.prototype = l.prototype, new e());
|
|
297
297
|
}
|
|
298
|
-
var
|
|
299
|
-
return
|
|
298
|
+
var N = function() {
|
|
299
|
+
return N = Object.assign || function(l) {
|
|
300
300
|
for (var e, n = 1, t = arguments.length; n < t; n++) {
|
|
301
301
|
e = arguments[n];
|
|
302
|
-
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (
|
|
302
|
+
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (l[r] = e[r]);
|
|
303
303
|
}
|
|
304
|
-
return
|
|
305
|
-
},
|
|
304
|
+
return l;
|
|
305
|
+
}, N.apply(this, arguments);
|
|
306
306
|
};
|
|
307
|
-
function De(
|
|
307
|
+
function De(d, l, e, n) {
|
|
308
308
|
function t(r) {
|
|
309
|
-
return r instanceof e ? r : new e(function(
|
|
310
|
-
|
|
309
|
+
return r instanceof e ? r : new e(function(s) {
|
|
310
|
+
s(r);
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
|
-
return new (e || (e = Promise))(function(r,
|
|
314
|
-
function
|
|
313
|
+
return new (e || (e = Promise))(function(r, s) {
|
|
314
|
+
function i(v) {
|
|
315
315
|
try {
|
|
316
|
-
c(n.next(
|
|
316
|
+
c(n.next(v));
|
|
317
317
|
} catch (y) {
|
|
318
|
-
|
|
318
|
+
s(y);
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function h(v) {
|
|
322
322
|
try {
|
|
323
|
-
c(n.throw(
|
|
323
|
+
c(n.throw(v));
|
|
324
324
|
} catch (y) {
|
|
325
|
-
|
|
325
|
+
s(y);
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
function c(
|
|
329
|
-
|
|
328
|
+
function c(v) {
|
|
329
|
+
v.done ? r(v.value) : t(v.value).then(i, h);
|
|
330
330
|
}
|
|
331
|
-
c((n = n.apply(
|
|
331
|
+
c((n = n.apply(d, l || [])).next());
|
|
332
332
|
});
|
|
333
333
|
}
|
|
334
|
-
function Ne(
|
|
334
|
+
function Ne(d, l) {
|
|
335
335
|
var e = { label: 0, sent: function() {
|
|
336
336
|
if (r[0] & 1) throw r[1];
|
|
337
337
|
return r[1];
|
|
338
|
-
}, trys: [], ops: [] }, n, t, r,
|
|
339
|
-
return
|
|
338
|
+
}, trys: [], ops: [] }, n, t, r, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
339
|
+
return s.next = i(0), s.throw = i(1), s.return = i(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
|
|
340
340
|
return this;
|
|
341
|
-
}),
|
|
342
|
-
function
|
|
343
|
-
return function(
|
|
344
|
-
return
|
|
341
|
+
}), s;
|
|
342
|
+
function i(c) {
|
|
343
|
+
return function(v) {
|
|
344
|
+
return h([c, v]);
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function h(c) {
|
|
348
348
|
if (n) throw new TypeError("Generator is already executing.");
|
|
349
|
-
for (;
|
|
349
|
+
for (; s && (s = 0, c[0] && (e = 0)), e; ) try {
|
|
350
350
|
if (n = 1, t && (r = c[0] & 2 ? t.return : c[0] ? t.throw || ((r = t.return) && r.call(t), 0) : t.next) && !(r = r.call(t, c[1])).done) return r;
|
|
351
351
|
switch (t = 0, r && (c = [c[0] & 2, r.value]), c[0]) {
|
|
352
352
|
case 0:
|
|
@@ -381,9 +381,9 @@ function Ne(h, s) {
|
|
|
381
381
|
r[2] && e.ops.pop(), e.trys.pop();
|
|
382
382
|
continue;
|
|
383
383
|
}
|
|
384
|
-
c =
|
|
385
|
-
} catch (
|
|
386
|
-
c = [6,
|
|
384
|
+
c = l.call(d, e);
|
|
385
|
+
} catch (v) {
|
|
386
|
+
c = [6, v], t = 0;
|
|
387
387
|
} finally {
|
|
388
388
|
n = r = 0;
|
|
389
389
|
}
|
|
@@ -391,113 +391,113 @@ function Ne(h, s) {
|
|
|
391
391
|
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
if (e || arguments.length === 2) for (var n = 0, t =
|
|
396
|
-
(r || !(n in
|
|
397
|
-
return
|
|
394
|
+
function Xt(d, l, e) {
|
|
395
|
+
if (e || arguments.length === 2) for (var n = 0, t = l.length, r; n < t; n++)
|
|
396
|
+
(r || !(n in l)) && (r || (r = Array.prototype.slice.call(l, 0, n)), r[n] = l[n]);
|
|
397
|
+
return d.concat(r || Array.prototype.slice.call(l));
|
|
398
398
|
}
|
|
399
|
-
function
|
|
400
|
-
return new Promise(function(
|
|
399
|
+
function On(d) {
|
|
400
|
+
return new Promise(function(l, e) {
|
|
401
401
|
var n = new Image();
|
|
402
402
|
n.onload = function() {
|
|
403
403
|
n.onload = n.onerror = function() {
|
|
404
|
-
},
|
|
404
|
+
}, l(n);
|
|
405
405
|
}, n.onerror = function(t) {
|
|
406
406
|
n.onload = n.onerror = function() {
|
|
407
407
|
}, e(t);
|
|
408
|
-
}, n.crossOrigin = "", n.src =
|
|
408
|
+
}, n.crossOrigin = "", n.src = d;
|
|
409
409
|
});
|
|
410
410
|
}
|
|
411
|
-
var
|
|
412
|
-
return
|
|
411
|
+
var kn = typeof performance != "undefined" && typeof performance.timing != "undefined" ? performance.timing.navigationStart : Date.now(), Et = typeof performance != "undefined" ? (function() {
|
|
412
|
+
return kn + performance.now();
|
|
413
413
|
}) : (function() {
|
|
414
414
|
return Date.now();
|
|
415
415
|
});
|
|
416
|
-
function lt(
|
|
417
|
-
return
|
|
416
|
+
function lt(d, l, e) {
|
|
417
|
+
return d + (l - d) * e;
|
|
418
418
|
}
|
|
419
|
-
function Fn(
|
|
420
|
-
var t = (
|
|
421
|
-
return t * Math.pow(n, 3) + r * Math.pow(n, 2) +
|
|
419
|
+
function Fn(d, l, e, n) {
|
|
420
|
+
var t = (l * e + 2 * d) / Math.pow(e, 3), r = -(2 * l * e + 3 * d) / Math.pow(e, 2), s = l, i = d;
|
|
421
|
+
return t * Math.pow(n, 3) + r * Math.pow(n, 2) + s * n + i;
|
|
422
422
|
}
|
|
423
|
-
function
|
|
424
|
-
var t = (
|
|
425
|
-
return 3 * t * Math.pow(n, 2) + 2 * r * n +
|
|
423
|
+
function Ln(d, l, e, n) {
|
|
424
|
+
var t = (l * e + 2 * d) / Math.pow(e, 3), r = -(2 * l * e + 3 * d) / Math.pow(e, 2), s = l;
|
|
425
|
+
return 3 * t * Math.pow(n, 2) + 2 * r * n + s;
|
|
426
426
|
}
|
|
427
|
-
function
|
|
427
|
+
function In(d, l, e, n) {
|
|
428
428
|
var t = n[1] - n[0];
|
|
429
|
-
return
|
|
429
|
+
return d = ut(d, n), l = ut(l, n), l - d > t / 2 ? lt(d + t, l, e) : d - l > t / 2 ? lt(d - t, l, e) : lt(d, l, e);
|
|
430
430
|
}
|
|
431
|
-
function ut(
|
|
432
|
-
var e =
|
|
433
|
-
return
|
|
431
|
+
function ut(d, l) {
|
|
432
|
+
var e = l[1] - l[0];
|
|
433
|
+
return d < l[0] ? ut(d + e, l) : d >= l[1] ? ut(d - e, l) : d;
|
|
434
434
|
}
|
|
435
|
-
function
|
|
436
|
-
return n ?
|
|
435
|
+
function Dn(d, l, e, n) {
|
|
436
|
+
return n ? In(d, l, e, n) : lt(d, l, e);
|
|
437
437
|
}
|
|
438
|
-
var
|
|
438
|
+
var qt = (
|
|
439
439
|
/** @class */
|
|
440
440
|
(function() {
|
|
441
|
-
function
|
|
441
|
+
function d(l) {
|
|
442
442
|
this.config = {}, this.progress = 1, this.ended = !0, this.value = {}, this.startTime = Et(), this.startVelocity = 0, this.duration = 0, this.keyframes = [];
|
|
443
|
-
for (var e in
|
|
444
|
-
var n =
|
|
443
|
+
for (var e in l) {
|
|
444
|
+
var n = l[e];
|
|
445
445
|
typeof n == "number" ? (this.value[e] = n, this.config[e] = { circle: !1 }) : (this.value[e] = n.value, this.config[e] = { circle: n.circle });
|
|
446
446
|
}
|
|
447
447
|
this.keyframes = [
|
|
448
|
-
{ progress: 0, value:
|
|
449
|
-
{ progress: 1, value:
|
|
448
|
+
{ progress: 0, value: N({}, this.value) },
|
|
449
|
+
{ progress: 1, value: N({}, this.value) }
|
|
450
450
|
];
|
|
451
451
|
}
|
|
452
|
-
return
|
|
453
|
-
var e =
|
|
452
|
+
return d.prototype.getProgress = function(l) {
|
|
453
|
+
var e = l - this.startTime;
|
|
454
454
|
return e < 0 ? 0 : e >= this.duration ? 1 : 1 - Fn(1, this.startVelocity, this.duration, e);
|
|
455
|
-
},
|
|
455
|
+
}, d.prototype.getValue = function(l) {
|
|
456
456
|
for (var e = 1; e < this.keyframes.length; e++)
|
|
457
|
-
if (this.keyframes[e].progress >
|
|
457
|
+
if (this.keyframes[e].progress > l) {
|
|
458
458
|
var n = this.keyframes[e - 1], t = this.keyframes[e], r = {};
|
|
459
|
-
for (var
|
|
460
|
-
var
|
|
461
|
-
r[
|
|
459
|
+
for (var s in this.config) {
|
|
460
|
+
var i = (l - n.progress) / (t.progress - n.progress);
|
|
461
|
+
r[s] = Dn(n.value[s], t.value[s], i, this.config[s].circle);
|
|
462
462
|
}
|
|
463
463
|
return r;
|
|
464
464
|
}
|
|
465
|
-
return
|
|
466
|
-
},
|
|
467
|
-
var e =
|
|
468
|
-
return e >= this.duration ? 0 :
|
|
469
|
-
},
|
|
470
|
-
return this.ended ? !0 : (this.progress = Math.min(1, Math.max(0, this.progress, this.getProgress(
|
|
471
|
-
},
|
|
472
|
-
for (var e = this.getProgress(
|
|
465
|
+
return N({}, this.keyframes[this.keyframes.length - 1].value);
|
|
466
|
+
}, d.prototype.getProgressVelocity = function(l) {
|
|
467
|
+
var e = l - this.startTime;
|
|
468
|
+
return e >= this.duration ? 0 : Ln(1, this.startVelocity, this.duration, e);
|
|
469
|
+
}, d.prototype.update = function(l) {
|
|
470
|
+
return this.ended ? !0 : (this.progress = Math.min(1, Math.max(0, this.progress, this.getProgress(l))), this.value = this.getValue(this.progress), this.ended = this.progress >= 1, this.ended && this.callbacks && (this.callbacks[0](), this.callbacks = void 0), this.ended);
|
|
471
|
+
}, d.prototype.getKeyFrameSegment = function(l) {
|
|
472
|
+
for (var e = this.getProgress(l), n = 1; n < this.keyframes.length; n++)
|
|
473
473
|
if (this.keyframes[n].progress > e)
|
|
474
474
|
return [this.keyframes[n - 1], this.keyframes[n]];
|
|
475
475
|
return [this.keyframes[this.keyframes.length - 2], this.keyframes[this.keyframes.length - 1]];
|
|
476
|
-
},
|
|
476
|
+
}, d.prototype.getTargetKeyframe = function() {
|
|
477
477
|
return this.keyframes[this.keyframes.length - 1];
|
|
478
|
-
},
|
|
478
|
+
}, d.prototype.set = function(l, e, n, t) {
|
|
479
479
|
var r;
|
|
480
480
|
n === void 0 && (n = 0), isNaN(e) && (e = 0), isNaN(n) && (n = 0), t = t != null ? t : Et();
|
|
481
|
-
var
|
|
481
|
+
var s = this.getProgress(t), i = this.getValue(s), h = {};
|
|
482
482
|
for (var c in this.config)
|
|
483
|
-
|
|
484
|
-
var
|
|
485
|
-
{ progress: 0, value:
|
|
486
|
-
{ progress: 1, value:
|
|
483
|
+
h[c] = (r = l[c]) !== null && r !== void 0 ? r : i[c];
|
|
484
|
+
var v = [
|
|
485
|
+
{ progress: 0, value: i },
|
|
486
|
+
{ progress: 1, value: h }
|
|
487
487
|
];
|
|
488
|
-
return this.setKeyframes(
|
|
489
|
-
},
|
|
488
|
+
return this.setKeyframes(v, e, n, t);
|
|
489
|
+
}, d.prototype.setKeyframes = function(l, e, n, t) {
|
|
490
490
|
var r = this;
|
|
491
|
-
if (n === void 0 && (n = 0),
|
|
491
|
+
if (n === void 0 && (n = 0), l.length < 2)
|
|
492
492
|
throw new Error("keyframes invalid.");
|
|
493
|
-
return isNaN(e) && (e = 0), isNaN(n) && (n = 0), this.callbacks && (this.callbacks[1](new Error("motion aborted.")), this.callbacks = void 0), new Promise(function(
|
|
494
|
-
t = t != null ? t : Et(), r.progress = 0, r.ended = !1, r.startTime = t, r.startVelocity = n, r.keyframes =
|
|
493
|
+
return isNaN(e) && (e = 0), isNaN(n) && (n = 0), this.callbacks && (this.callbacks[1](new Error("motion aborted.")), this.callbacks = void 0), new Promise(function(s, i) {
|
|
494
|
+
t = t != null ? t : Et(), r.progress = 0, r.ended = !1, r.startTime = t, r.startVelocity = n, r.keyframes = l, r.duration = e, e === 0 ? (r.progress = 1, r.value = N({}, l[l.length - 1].value)) : r.value = N({}, l[0].value), r.callbacks = [s, i];
|
|
495
495
|
});
|
|
496
|
-
},
|
|
496
|
+
}, d.prototype.dispose = function() {
|
|
497
497
|
this.callbacks && (this.callbacks[1](new Error("motion dispose.")), this.callbacks = void 0);
|
|
498
|
-
},
|
|
498
|
+
}, d;
|
|
499
499
|
})()
|
|
500
|
-
),
|
|
500
|
+
), Nn = [
|
|
501
501
|
{ progress: 0, value: { scale: 0, opacity: 0, shadow: 2 } },
|
|
502
502
|
{ progress: 0.2, value: { scale: 0.5, opacity: 1, shadow: 1 } },
|
|
503
503
|
{ progress: 0.8, value: { scale: 2, opacity: 0, shadow: 0.5 } },
|
|
@@ -559,14 +559,14 @@ void main() {
|
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
|
-
`,
|
|
562
|
+
`, zn = (
|
|
563
563
|
/** @class */
|
|
564
|
-
(function(
|
|
565
|
-
he(
|
|
566
|
-
function
|
|
567
|
-
var t =
|
|
564
|
+
(function(d) {
|
|
565
|
+
he(l, d);
|
|
566
|
+
function l(e, n) {
|
|
567
|
+
var t = d.call(this, e) || this;
|
|
568
568
|
t.canvas = document.createElement("canvas"), t.group = new p.Group(), t.wrapper = document.createElement("div"), t.style = document.createElement("style"), t.itemMaskMesh = (function() {
|
|
569
|
-
var
|
|
569
|
+
var i = new p.Mesh(new p.SphereBufferGeometry(1, 60, 40), new p.ShaderMaterial({
|
|
570
570
|
vertexShader: Un,
|
|
571
571
|
fragmentShader: Rn,
|
|
572
572
|
uniforms: {
|
|
@@ -581,71 +581,71 @@ void main() {
|
|
|
581
581
|
depthTest: !1,
|
|
582
582
|
transparent: !0
|
|
583
583
|
}));
|
|
584
|
-
return
|
|
585
|
-
})(), t.onFivePanoArrived = function(
|
|
586
|
-
t.state.mode === "mask" && t.loadPanoMask(
|
|
587
|
-
}, t.onFiveWantsMoveToPano = function(
|
|
584
|
+
return i.renderOrder = -3, i.geometry.rotateY(-Math.PI / 2), i.geometry.scale(-1, 1, 1), i;
|
|
585
|
+
})(), t.onFivePanoArrived = function(i) {
|
|
586
|
+
t.state.mode === "mask" && t.loadPanoMask(i);
|
|
587
|
+
}, t.onFiveWantsMoveToPano = function(i) {
|
|
588
588
|
t.state.mode === "box" && t.select();
|
|
589
|
-
}, t.loadPanoMask = function(
|
|
589
|
+
}, t.loadPanoMask = function(i) {
|
|
590
590
|
return De(t, void 0, void 0, function() {
|
|
591
|
-
var
|
|
591
|
+
var h, c, v, y, M, w, P, S, _, E;
|
|
592
592
|
return Ne(this, function(b) {
|
|
593
593
|
switch (b.label) {
|
|
594
594
|
case 0:
|
|
595
|
-
return
|
|
596
|
-
return T.derived_id === String(
|
|
597
|
-
})) === null || E === void 0 ? void 0 : E.object_mask_url,
|
|
595
|
+
return h = this, c = h.five, v = h.canvas, y = h.itemMaskMesh, M = h.data, w = v.getContext("2d"), P = c.observers[i], S = (E = M == null ? void 0 : M.object_mask_list.find(function(T) {
|
|
596
|
+
return T.derived_id === String(P.derivedId);
|
|
597
|
+
})) === null || E === void 0 ? void 0 : E.object_mask_url, S ? [4, On(S)] : [
|
|
598
598
|
2
|
|
599
599
|
/*return*/
|
|
600
600
|
];
|
|
601
601
|
case 1:
|
|
602
|
-
return
|
|
602
|
+
return _ = b.sent(), v.width = _.width, v.height = _.height, w == null || w.drawImage(_, 0, 0, _.width, _.height), y.material.uniforms.map.value.image = _, y.material.uniforms.map.value.minFilter = p.LinearFilter, y.material.uniforms.map.value.needsUpdate = !0, y.position.copy(P.position), y.quaternion.copy(P.quaternion), c.scene.add(y), c.needsRender = !0, [
|
|
603
603
|
2
|
|
604
604
|
/*return*/
|
|
605
605
|
];
|
|
606
606
|
}
|
|
607
607
|
});
|
|
608
608
|
});
|
|
609
|
-
}, t.onFiveMouseMove = function(
|
|
610
|
-
var
|
|
609
|
+
}, t.onFiveMouseMove = function(i) {
|
|
610
|
+
var h;
|
|
611
611
|
if (t.state.mode === "mask" && t.five.state.mode === "Panorama") {
|
|
612
|
-
var c = t,
|
|
612
|
+
var c = t, v = c.five, y = c.itemMaskMesh, M = v.observers[v.state.panoIndex], w = (h = i.pointers[0]) === null || h === void 0 ? void 0 : h.raycaster;
|
|
613
613
|
if (w) {
|
|
614
|
-
var
|
|
615
|
-
return
|
|
614
|
+
var P = w.intersectObjects(t.group.children.filter(function(S) {
|
|
615
|
+
return S.userData.visible_viewpoint.includes(String(M.derivedId));
|
|
616
616
|
}), !0)[0];
|
|
617
|
-
|
|
617
|
+
P ? y.material.uniforms.color.value = P.object.userData.color : y.material.uniforms.color.value = new p.Vector4(0, 0, 0, 1);
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
|
-
}, t.onFiveTapGesture = function(
|
|
621
|
-
var
|
|
622
|
-
if (
|
|
623
|
-
var
|
|
620
|
+
}, t.onFiveTapGesture = function(i) {
|
|
621
|
+
var h = t.five, c = h.observers[h.state.panoIndex];
|
|
622
|
+
if (i) {
|
|
623
|
+
var v = i.intersectObjects(t.group.children.filter(function(w) {
|
|
624
624
|
return w.userData.visible_viewpoint.includes(String(c.derivedId));
|
|
625
625
|
}), !0)[0];
|
|
626
|
-
if (
|
|
627
|
-
t.select(
|
|
628
|
-
var y = new
|
|
626
|
+
if (v) {
|
|
627
|
+
t.select(v.object.name), t.stopAnimation && t.stopAnimation(), t.tapPosition = v.point, t.changeTapScreenPosition();
|
|
628
|
+
var y = new qt({
|
|
629
629
|
opacity: 0,
|
|
630
630
|
scale: 0,
|
|
631
631
|
shadow: 2
|
|
632
|
-
}), M = new
|
|
632
|
+
}), M = new qt({
|
|
633
633
|
opacity: 0,
|
|
634
634
|
scale: 0,
|
|
635
635
|
shadow: 2
|
|
636
636
|
});
|
|
637
|
-
return y.setKeyframes(
|
|
638
|
-
var
|
|
639
|
-
t.wrapper.firstChild.style.opacity = "".concat(y.value.opacity), t.wrapper.firstChild.style.transform = "scale(".concat(y.value.scale, ")"), t.wrapper.firstChild.style.boxShadow = "0 0 0 ".concat(y.value.shadow, "px #fff"), t.wrapper.lastChild.style.opacity = "".concat(M.value.opacity), t.wrapper.lastChild.style.transform = "scale(".concat(M.value.scale, ")"), t.wrapper.lastChild.style.boxShadow = "0 0 0 ".concat(M.value.shadow, "px #fff"),
|
|
640
|
-
}, !1, 0, 10),
|
|
637
|
+
return y.setKeyframes(Nn, 1e3), M.setKeyframes(Bn, 1e3), t.stopAnimation = Ie.shared.add(function(w, P) {
|
|
638
|
+
var S, _ = y.update(w), E = M.update(w);
|
|
639
|
+
t.wrapper.firstChild.style.opacity = "".concat(y.value.opacity), t.wrapper.firstChild.style.transform = "scale(".concat(y.value.scale, ")"), t.wrapper.firstChild.style.boxShadow = "0 0 0 ".concat(y.value.shadow, "px #fff"), t.wrapper.lastChild.style.opacity = "".concat(M.value.opacity), t.wrapper.lastChild.style.transform = "scale(".concat(M.value.scale, ")"), t.wrapper.lastChild.style.boxShadow = "0 0 0 ".concat(M.value.shadow, "px #fff"), _ && E && ((S = t.stopAnimation) === null || S === void 0 || S.call(t), t.stopAnimation = void 0, h.getElement().parentElement.removeChild(t.wrapper));
|
|
640
|
+
}, !1, 0, 10), h.getElement().parentElement.appendChild(t.wrapper), !1;
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
643
|
}, t.changeTapScreenPosition = function() {
|
|
644
644
|
if (t.tapPosition) {
|
|
645
|
-
var
|
|
646
|
-
t.wrapper.style.opacity =
|
|
645
|
+
var i = t.tapPosition.clone().project(t.five.camera), h = (i.x + 1) / 2, c = -(i.y - 1) / 2;
|
|
646
|
+
t.wrapper.style.opacity = i.z > 0 && i.z < 1 ? "1" : "0", t.wrapper.style.transform = "translate(".concat(h * 100, "%, ").concat(c * 100, "%)");
|
|
647
647
|
}
|
|
648
|
-
}, t.onFiveCameraUpdate = function(
|
|
648
|
+
}, t.onFiveCameraUpdate = function(i) {
|
|
649
649
|
t.changeTapScreenPosition();
|
|
650
650
|
}, t.dispose = function() {
|
|
651
651
|
t.disable();
|
|
@@ -658,8 +658,8 @@ void main() {
|
|
|
658
658
|
selectAll: !1
|
|
659
659
|
};
|
|
660
660
|
t.state = Object.assign(r, n == null ? void 0 : n.initialState);
|
|
661
|
-
var
|
|
662
|
-
return t._config =
|
|
661
|
+
var s = N({}, n == null ? void 0 : n.config);
|
|
662
|
+
return t._config = s, t.group.rotateX(Math.PI), t.wrapper.className = "ItemMaskPlugin", t.wrapper.innerHTML = '<span class="ItemMaskPluginCircle"></span><span class="ItemMaskPluginCircle"></span>', t.style.innerHTML = `
|
|
663
663
|
.ItemMaskPlugin {
|
|
664
664
|
position: absolute;
|
|
665
665
|
top: 0;
|
|
@@ -679,25 +679,25 @@ void main() {
|
|
|
679
679
|
}
|
|
680
680
|
`, t.state.enabled && t._enable({ userAction: !1 }), t;
|
|
681
681
|
}
|
|
682
|
-
return Object.defineProperty(
|
|
682
|
+
return Object.defineProperty(l.prototype, "config", {
|
|
683
683
|
get: function() {
|
|
684
|
-
return
|
|
684
|
+
return N({}, this._config);
|
|
685
685
|
},
|
|
686
686
|
enumerable: !1,
|
|
687
687
|
configurable: !0
|
|
688
|
-
}),
|
|
688
|
+
}), l.prototype.updateState = function(e, n) {
|
|
689
689
|
var t = this.state;
|
|
690
|
-
this.state =
|
|
691
|
-
},
|
|
690
|
+
this.state = N(N({}, this.state), e), this.hooks.emit("stateChange", { state: this.state, prevState: t, userAction: n });
|
|
691
|
+
}, l.prototype.load = function(e) {
|
|
692
692
|
return De(this, void 0, void 0, function() {
|
|
693
693
|
var n, t, r = this;
|
|
694
|
-
return Ne(this, function(
|
|
695
|
-
return this.data = e, n = e.data_list.map(function(
|
|
696
|
-
var
|
|
697
|
-
return Number(
|
|
698
|
-
}),
|
|
699
|
-
return Number(
|
|
700
|
-
}), y = Math.abs(c[0] -
|
|
694
|
+
return Ne(this, function(s) {
|
|
695
|
+
return this.data = e, n = e.data_list.map(function(i) {
|
|
696
|
+
var h, c = i.position.end.map(function(C) {
|
|
697
|
+
return Number(C);
|
|
698
|
+
}), v = i.position.start.map(function(C) {
|
|
699
|
+
return Number(C);
|
|
700
|
+
}), y = Math.abs(c[0] - v[0]), M = Math.abs(c[1] - v[1]), w = Math.abs(c[2] - v[2]), P = c[0] / 2 + v[0] / 2, S = c[1] / 2 + v[1] / 2, _ = c[2] / 2 + v[2] / 2, E = new p.Vector3(P, S, _), b = new p.BoxBufferGeometry(y, M, w), T = new p.ShaderMaterial({
|
|
701
701
|
vertexShader: `
|
|
702
702
|
varying vec2 vUv;
|
|
703
703
|
void main() {
|
|
@@ -726,7 +726,7 @@ void main() {
|
|
|
726
726
|
}
|
|
727
727
|
`,
|
|
728
728
|
side: p.DoubleSide,
|
|
729
|
-
visible: r.state.selectedId === "".concat(
|
|
729
|
+
visible: r.state.selectedId === "".concat(i.category_name).concat(i.index),
|
|
730
730
|
uniforms: {
|
|
731
731
|
opacity: { value: r.state.mode === "box" ? 1 : 0 }
|
|
732
732
|
},
|
|
@@ -734,190 +734,190 @@ void main() {
|
|
|
734
734
|
depthTest: !1,
|
|
735
735
|
transparent: !0
|
|
736
736
|
}), f = new p.Mesh(b, T);
|
|
737
|
-
return f.position.copy(E), f.name = "".concat(
|
|
738
|
-
return
|
|
739
|
-
}).reverse(), !1), [1], !1)))(), f.userData.visible_viewpoint = Object.keys(
|
|
737
|
+
return f.position.copy(E), f.name = "".concat(i.category_name).concat(i.index), f.userData.color = new ((h = p.Vector4).bind.apply(h, Xt(Xt([void 0], i.mask_color.map(function(C) {
|
|
738
|
+
return C / 255;
|
|
739
|
+
}).reverse(), !1), [1], !1)))(), f.userData.visible_viewpoint = Object.keys(i.visible_viewpoint), f;
|
|
740
740
|
}), (t = this.group).add.apply(t, n), [
|
|
741
741
|
2
|
|
742
742
|
/*return*/
|
|
743
743
|
];
|
|
744
744
|
});
|
|
745
745
|
});
|
|
746
|
-
},
|
|
746
|
+
}, l.prototype.setState = function(e, n) {
|
|
747
747
|
n === void 0 && (n = {});
|
|
748
748
|
var t = this.state, r = n.userAction !== void 0 ? n.userAction : !0;
|
|
749
749
|
if (this.updateState(e, r), e.enabled !== void 0 && t.enabled !== e.enabled) {
|
|
750
|
-
var
|
|
751
|
-
e.enabled ? this._enable(
|
|
750
|
+
var s = { userAction: r };
|
|
751
|
+
e.enabled ? this._enable(s) : this._disable(s);
|
|
752
752
|
}
|
|
753
|
-
},
|
|
753
|
+
}, l.prototype.setMode = function(e) {
|
|
754
754
|
this.updateState({ mode: e }, !1), e === "mask" ? (this.group.children.forEach(function(n) {
|
|
755
755
|
n.material.uniforms.opacity.value = 0;
|
|
756
756
|
}), this.loadPanoMask(this.five.state.panoIndex)) : e === "box" && (this.itemMaskMesh.material.uniforms.color.value = new p.Vector4(0, 0, 0, 1), this.group.children.forEach(function(n) {
|
|
757
757
|
n.material.uniforms.opacity.value = 1;
|
|
758
758
|
}), this.five.needsRender = !0);
|
|
759
|
-
},
|
|
759
|
+
}, l.prototype.select = function(e, n) {
|
|
760
760
|
var t = this, r;
|
|
761
|
-
this.updateState({ selectedId: e != null ? e : null }, (r = n == null ? void 0 : n.userAction) !== null && r !== void 0 ? r : !1), this.group.children.forEach(function(
|
|
762
|
-
|
|
761
|
+
this.updateState({ selectedId: e != null ? e : null }, (r = n == null ? void 0 : n.userAction) !== null && r !== void 0 ? r : !1), this.group.children.forEach(function(s) {
|
|
762
|
+
s.material.visible = t.state.selectAll || s.name === e;
|
|
763
763
|
}), this.five.needsRender = !0;
|
|
764
|
-
},
|
|
764
|
+
}, l.prototype.selectAll = function(e) {
|
|
765
765
|
e === void 0 && (e = !0), this.updateState({ selectAll: !!e }, !1), this.select();
|
|
766
|
-
},
|
|
766
|
+
}, l.prototype._enable = function(e) {
|
|
767
767
|
this.five.on("panoArrived", this.onFivePanoArrived), this.five.on("wantsMoveToPano", this.onFiveWantsMoveToPano), this.five.on("gesture.mousemove", this.onFiveMouseMove), this.five.on("wantsTapGesture", this.onFiveTapGesture), this.five.on("cameraUpdate", this.onFiveCameraUpdate), this.five.scene.add(this.group), document.head.appendChild(this.style);
|
|
768
|
-
},
|
|
768
|
+
}, l.prototype._disable = function(e) {
|
|
769
769
|
this.five.off("panoArrived", this.onFivePanoArrived), this.five.off("wantsMoveToPano", this.onFiveWantsMoveToPano), this.five.off("gesture.mousemove", this.onFiveMouseMove), this.five.off("wantsTapGesture", this.onFiveTapGesture), this.five.off("cameraUpdate", this.onFiveCameraUpdate), this.five.scene.remove(this.group), document.head.removeChild(this.style);
|
|
770
|
-
},
|
|
770
|
+
}, l.prototype.enable = function(e) {
|
|
771
771
|
var n;
|
|
772
772
|
if (!this.state.enabled) {
|
|
773
773
|
var t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
774
774
|
this.updateState({ enabled: !0 }, t), this._enable({ userAction: t });
|
|
775
775
|
}
|
|
776
|
-
},
|
|
776
|
+
}, l.prototype.disable = function(e) {
|
|
777
777
|
var n;
|
|
778
778
|
if (this.state.enabled !== !1) {
|
|
779
779
|
var t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
780
780
|
this.updateState({ enabled: !1 }, t), this._disable({ userAction: t });
|
|
781
781
|
}
|
|
782
|
-
},
|
|
783
|
-
})(
|
|
784
|
-
), tr = function(
|
|
785
|
-
return new
|
|
782
|
+
}, l;
|
|
783
|
+
})(Xe.Controller)
|
|
784
|
+
), tr = function(d, l) {
|
|
785
|
+
return new zn(d, l);
|
|
786
786
|
};
|
|
787
787
|
/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
788
788
|
* http://hammerjs.github.io/
|
|
789
789
|
*
|
|
790
790
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
791
791
|
* Licensed under the MIT license */
|
|
792
|
-
var Tt = (function(
|
|
793
|
-
var t = ["", "webkit", "Moz", "MS", "ms", "o"], r =
|
|
794
|
-
function
|
|
795
|
-
return setTimeout(b(a, u),
|
|
792
|
+
var Tt = (function(d, l, e, n) {
|
|
793
|
+
var t = ["", "webkit", "Moz", "MS", "ms", "o"], r = l.createElement ? l.createElement("div") : n, s = "function", i = Math.round, h = Math.abs, c = Date.now;
|
|
794
|
+
function v(a, o, u) {
|
|
795
|
+
return setTimeout(b(a, u), o);
|
|
796
796
|
}
|
|
797
|
-
function y(a,
|
|
798
|
-
return Array.isArray(a) ? (M(a, u[
|
|
797
|
+
function y(a, o, u) {
|
|
798
|
+
return Array.isArray(a) ? (M(a, u[o], u), !0) : !1;
|
|
799
799
|
}
|
|
800
|
-
function M(a,
|
|
800
|
+
function M(a, o, u) {
|
|
801
801
|
var g;
|
|
802
802
|
if (a)
|
|
803
803
|
if (a.forEach)
|
|
804
|
-
a.forEach(
|
|
804
|
+
a.forEach(o, u);
|
|
805
805
|
else if (a.length !== n)
|
|
806
806
|
for (g = 0; g < a.length; )
|
|
807
|
-
|
|
807
|
+
o.call(u, a[g], g, a), g++;
|
|
808
808
|
else
|
|
809
809
|
for (g in a)
|
|
810
|
-
a.hasOwnProperty(g) &&
|
|
810
|
+
a.hasOwnProperty(g) && o.call(u, a[g], g, a);
|
|
811
811
|
}
|
|
812
|
-
function w(a,
|
|
813
|
-
var g = "DEPRECATED METHOD: " +
|
|
812
|
+
function w(a, o, u) {
|
|
813
|
+
var g = "DEPRECATED METHOD: " + o + `
|
|
814
814
|
` + u + ` AT
|
|
815
815
|
`;
|
|
816
816
|
return function() {
|
|
817
|
-
var
|
|
818
|
-
return
|
|
817
|
+
var A = new Error("get-stack-trace"), O = A && A.stack ? A.stack.replace(/^[^\(]+?[\n$]/gm, "").replace(/^\s+at\s+/gm, "").replace(/^Object.<anonymous>\s*\(/gm, "{anonymous}()@") : "Unknown Stack Trace", U = d.console && (d.console.warn || d.console.log);
|
|
818
|
+
return U && U.call(d.console, g, O), a.apply(this, arguments);
|
|
819
819
|
};
|
|
820
820
|
}
|
|
821
|
-
var
|
|
822
|
-
typeof Object.assign != "function" ?
|
|
823
|
-
if (
|
|
821
|
+
var P;
|
|
822
|
+
typeof Object.assign != "function" ? P = function(o) {
|
|
823
|
+
if (o === n || o === null)
|
|
824
824
|
throw new TypeError("Cannot convert undefined or null to object");
|
|
825
|
-
for (var u = Object(
|
|
826
|
-
var
|
|
827
|
-
if (
|
|
828
|
-
for (var
|
|
829
|
-
|
|
825
|
+
for (var u = Object(o), g = 1; g < arguments.length; g++) {
|
|
826
|
+
var A = arguments[g];
|
|
827
|
+
if (A !== n && A !== null)
|
|
828
|
+
for (var O in A)
|
|
829
|
+
A.hasOwnProperty(O) && (u[O] = A[O]);
|
|
830
830
|
}
|
|
831
831
|
return u;
|
|
832
|
-
} :
|
|
833
|
-
var
|
|
834
|
-
for (var
|
|
835
|
-
(!g || g &&
|
|
836
|
-
return
|
|
837
|
-
}, "extend", "Use `assign`."),
|
|
838
|
-
return
|
|
832
|
+
} : P = Object.assign;
|
|
833
|
+
var S = w(function(o, u, g) {
|
|
834
|
+
for (var A = Object.keys(u), O = 0; O < A.length; )
|
|
835
|
+
(!g || g && o[A[O]] === n) && (o[A[O]] = u[A[O]]), O++;
|
|
836
|
+
return o;
|
|
837
|
+
}, "extend", "Use `assign`."), _ = w(function(o, u) {
|
|
838
|
+
return S(o, u, !0);
|
|
839
839
|
}, "merge", "Use `assign`.");
|
|
840
|
-
function E(a,
|
|
841
|
-
var g =
|
|
842
|
-
|
|
840
|
+
function E(a, o, u) {
|
|
841
|
+
var g = o.prototype, A;
|
|
842
|
+
A = a.prototype = Object.create(g), A.constructor = a, A._super = g, u && P(A, u);
|
|
843
843
|
}
|
|
844
|
-
function b(a,
|
|
844
|
+
function b(a, o) {
|
|
845
845
|
return function() {
|
|
846
|
-
return a.apply(
|
|
846
|
+
return a.apply(o, arguments);
|
|
847
847
|
};
|
|
848
848
|
}
|
|
849
|
-
function T(a,
|
|
850
|
-
return typeof a ==
|
|
849
|
+
function T(a, o) {
|
|
850
|
+
return typeof a == s ? a.apply(o && o[0] || n, o) : a;
|
|
851
851
|
}
|
|
852
|
-
function f(a,
|
|
853
|
-
return a === n ?
|
|
852
|
+
function f(a, o) {
|
|
853
|
+
return a === n ? o : a;
|
|
854
854
|
}
|
|
855
|
-
function
|
|
856
|
-
M(
|
|
855
|
+
function C(a, o, u) {
|
|
856
|
+
M(Y(o), function(g) {
|
|
857
857
|
a.addEventListener(g, u, !1);
|
|
858
858
|
});
|
|
859
859
|
}
|
|
860
|
-
function
|
|
861
|
-
M(
|
|
860
|
+
function x(a, o, u) {
|
|
861
|
+
M(Y(o), function(g) {
|
|
862
862
|
a.removeEventListener(g, u, !1);
|
|
863
863
|
});
|
|
864
864
|
}
|
|
865
|
-
function
|
|
865
|
+
function F(a, o) {
|
|
866
866
|
for (; a; ) {
|
|
867
|
-
if (a ==
|
|
867
|
+
if (a == o)
|
|
868
868
|
return !0;
|
|
869
869
|
a = a.parentNode;
|
|
870
870
|
}
|
|
871
871
|
return !1;
|
|
872
872
|
}
|
|
873
|
-
function
|
|
874
|
-
return a.indexOf(
|
|
873
|
+
function V(a, o) {
|
|
874
|
+
return a.indexOf(o) > -1;
|
|
875
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function Y(a) {
|
|
877
877
|
return a.trim().split(/\s+/g);
|
|
878
878
|
}
|
|
879
|
-
function
|
|
879
|
+
function G(a, o, u) {
|
|
880
880
|
if (a.indexOf && !u)
|
|
881
|
-
return a.indexOf(
|
|
881
|
+
return a.indexOf(o);
|
|
882
882
|
for (var g = 0; g < a.length; ) {
|
|
883
|
-
if (u && a[g][u] ==
|
|
883
|
+
if (u && a[g][u] == o || !u && a[g] === o)
|
|
884
884
|
return g;
|
|
885
885
|
g++;
|
|
886
886
|
}
|
|
887
887
|
return -1;
|
|
888
888
|
}
|
|
889
|
-
function
|
|
889
|
+
function q(a) {
|
|
890
890
|
return Array.prototype.slice.call(a, 0);
|
|
891
891
|
}
|
|
892
|
-
function
|
|
893
|
-
for (var g = [],
|
|
894
|
-
var
|
|
895
|
-
|
|
892
|
+
function Q(a, o, u) {
|
|
893
|
+
for (var g = [], A = [], O = 0; O < a.length; ) {
|
|
894
|
+
var U = a[O][o];
|
|
895
|
+
G(A, U) < 0 && g.push(a[O]), A[O] = U, O++;
|
|
896
896
|
}
|
|
897
|
-
return g = g.sort(function(ce,
|
|
898
|
-
return ce[
|
|
897
|
+
return g = g.sort(function(ce, re) {
|
|
898
|
+
return ce[o] > re[o];
|
|
899
899
|
}), g;
|
|
900
900
|
}
|
|
901
|
-
function
|
|
902
|
-
for (var u, g,
|
|
903
|
-
if (u = t[
|
|
901
|
+
function R(a, o) {
|
|
902
|
+
for (var u, g, A = o[0].toUpperCase() + o.slice(1), O = 0; O < t.length; ) {
|
|
903
|
+
if (u = t[O], g = u ? u + A : o, g in a)
|
|
904
904
|
return g;
|
|
905
|
-
|
|
905
|
+
O++;
|
|
906
906
|
}
|
|
907
907
|
return n;
|
|
908
908
|
}
|
|
909
|
-
var
|
|
910
|
-
function
|
|
911
|
-
return
|
|
909
|
+
var H = 1;
|
|
910
|
+
function L() {
|
|
911
|
+
return H++;
|
|
912
912
|
}
|
|
913
|
-
function
|
|
914
|
-
var
|
|
915
|
-
return
|
|
913
|
+
function k(a) {
|
|
914
|
+
var o = a.ownerDocument || a;
|
|
915
|
+
return o.defaultView || o.parentWindow || d;
|
|
916
916
|
}
|
|
917
|
-
var
|
|
918
|
-
function le(a,
|
|
917
|
+
var I = /mobile|tablet|ip(ad|hone|od)|android/i, D = "ontouchstart" in d, W = R(d, "PointerEvent") !== n, $ = D && I.test(navigator.userAgent), Z = "touch", B = "pen", ne = "mouse", X = "kinect", K = 25, z = 1, se = 2, J = 4, ee = 8, _e = 1, Pe = 2, Oe = 4, ke = 8, Me = 16, ue = Pe | Oe, ve = ke | Me, Re = ue | ve, ze = ["x", "y"], Fe = ["clientX", "clientY"];
|
|
918
|
+
function le(a, o) {
|
|
919
919
|
var u = this;
|
|
920
|
-
this.manager = a, this.callback =
|
|
920
|
+
this.manager = a, this.callback = o, this.element = a.element, this.target = a.options.inputTarget, this.domHandler = function(g) {
|
|
921
921
|
T(a.options.enable, [a]) && u.handler(g);
|
|
922
922
|
}, this.init();
|
|
923
923
|
}
|
|
@@ -932,109 +932,109 @@ var Tt = (function(h, s, e, n) {
|
|
|
932
932
|
* bind the events
|
|
933
933
|
*/
|
|
934
934
|
init: function() {
|
|
935
|
-
this.evEl &&
|
|
935
|
+
this.evEl && C(this.element, this.evEl, this.domHandler), this.evTarget && C(this.target, this.evTarget, this.domHandler), this.evWin && C(k(this.element), this.evWin, this.domHandler);
|
|
936
936
|
},
|
|
937
937
|
/**
|
|
938
938
|
* unbind the events
|
|
939
939
|
*/
|
|
940
940
|
destroy: function() {
|
|
941
|
-
this.evEl &&
|
|
941
|
+
this.evEl && x(this.element, this.evEl, this.domHandler), this.evTarget && x(this.target, this.evTarget, this.domHandler), this.evWin && x(k(this.element), this.evWin, this.domHandler);
|
|
942
942
|
}
|
|
943
943
|
};
|
|
944
944
|
function Ze(a) {
|
|
945
|
-
var
|
|
946
|
-
return u ?
|
|
945
|
+
var o, u = a.options.inputClass;
|
|
946
|
+
return u ? o = u : W ? o = ht : $ ? o = et : D ? o = vt : o = $e, new o(a, Qe);
|
|
947
947
|
}
|
|
948
|
-
function Qe(a,
|
|
949
|
-
var g = u.pointers.length,
|
|
950
|
-
u.isFirst = !!
|
|
948
|
+
function Qe(a, o, u) {
|
|
949
|
+
var g = u.pointers.length, A = u.changedPointers.length, O = o & z && g - A === 0, U = o & (J | ee) && g - A === 0;
|
|
950
|
+
u.isFirst = !!O, u.isFinal = !!U, O && (a.session = {}), u.eventType = o, m(a, u), a.emit("hammer.input", u), a.recognize(u), a.session.prevInput = u;
|
|
951
951
|
}
|
|
952
|
-
function
|
|
953
|
-
var u = a.session, g =
|
|
954
|
-
u.firstInput || (u.firstInput =
|
|
955
|
-
var
|
|
956
|
-
|
|
957
|
-
var
|
|
958
|
-
|
|
952
|
+
function m(a, o) {
|
|
953
|
+
var u = a.session, g = o.pointers, A = g.length;
|
|
954
|
+
u.firstInput || (u.firstInput = ae(o)), A > 1 && !u.firstMultiple ? u.firstMultiple = ae(o) : A === 1 && (u.firstMultiple = !1);
|
|
955
|
+
var O = u.firstInput, U = u.firstMultiple, ie = U ? U.center : O.center, ce = o.center = pe(g);
|
|
956
|
+
o.timeStamp = c(), o.deltaTime = o.timeStamp - O.timeStamp, o.angle = ft(ie, ce), o.distance = Je(ie, ce), j(u, o), o.offsetDirection = be(o.deltaX, o.deltaY);
|
|
957
|
+
var re = Ve(o.deltaTime, o.deltaX, o.deltaY);
|
|
958
|
+
o.overallVelocityX = re.x, o.overallVelocityY = re.y, o.overallVelocity = h(re.x) > h(re.y) ? re.x : re.y, o.scale = U ? an(U.pointers, g) : 1, o.rotation = U ? rn(U.pointers, g) : 0, o.maxPointers = u.prevInput ? o.pointers.length > u.prevInput.maxPointers ? o.pointers.length : u.prevInput.maxPointers : o.pointers.length, te(u, o);
|
|
959
959
|
var ge = a.element;
|
|
960
|
-
|
|
960
|
+
F(o.srcEvent.target, ge) && (ge = o.srcEvent.target), o.target = ge;
|
|
961
961
|
}
|
|
962
|
-
function
|
|
963
|
-
var u =
|
|
964
|
-
(
|
|
965
|
-
x:
|
|
966
|
-
y:
|
|
962
|
+
function j(a, o) {
|
|
963
|
+
var u = o.center, g = a.offsetDelta || {}, A = a.prevDelta || {}, O = a.prevInput || {};
|
|
964
|
+
(o.eventType === z || O.eventType === J) && (A = a.prevDelta = {
|
|
965
|
+
x: O.deltaX || 0,
|
|
966
|
+
y: O.deltaY || 0
|
|
967
967
|
}, g = a.offsetDelta = {
|
|
968
968
|
x: u.x,
|
|
969
969
|
y: u.y
|
|
970
|
-
}),
|
|
970
|
+
}), o.deltaX = A.x + (u.x - g.x), o.deltaY = A.y + (u.y - g.y);
|
|
971
971
|
}
|
|
972
|
-
function
|
|
973
|
-
var u = a.lastInterval ||
|
|
974
|
-
if (
|
|
975
|
-
var ce =
|
|
976
|
-
|
|
972
|
+
function te(a, o) {
|
|
973
|
+
var u = a.lastInterval || o, g = o.timeStamp - u.timeStamp, A, O, U, ie;
|
|
974
|
+
if (o.eventType != ee && (g > K || u.velocity === n)) {
|
|
975
|
+
var ce = o.deltaX - u.deltaX, re = o.deltaY - u.deltaY, ge = Ve(g, ce, re);
|
|
976
|
+
O = ge.x, U = ge.y, A = h(ge.x) > h(ge.y) ? ge.x : ge.y, ie = be(ce, re), a.lastInterval = o;
|
|
977
977
|
} else
|
|
978
|
-
|
|
979
|
-
|
|
978
|
+
A = u.velocity, O = u.velocityX, U = u.velocityY, ie = u.direction;
|
|
979
|
+
o.velocity = A, o.velocityX = O, o.velocityY = U, o.direction = ie;
|
|
980
980
|
}
|
|
981
|
-
function
|
|
982
|
-
for (var
|
|
983
|
-
|
|
984
|
-
clientX:
|
|
985
|
-
clientY:
|
|
981
|
+
function ae(a) {
|
|
982
|
+
for (var o = [], u = 0; u < a.pointers.length; )
|
|
983
|
+
o[u] = {
|
|
984
|
+
clientX: i(a.pointers[u].clientX),
|
|
985
|
+
clientY: i(a.pointers[u].clientY)
|
|
986
986
|
}, u++;
|
|
987
987
|
return {
|
|
988
988
|
timeStamp: c(),
|
|
989
|
-
pointers:
|
|
990
|
-
center: pe(
|
|
989
|
+
pointers: o,
|
|
990
|
+
center: pe(o),
|
|
991
991
|
deltaX: a.deltaX,
|
|
992
992
|
deltaY: a.deltaY
|
|
993
993
|
};
|
|
994
994
|
}
|
|
995
995
|
function pe(a) {
|
|
996
|
-
var
|
|
997
|
-
if (
|
|
996
|
+
var o = a.length;
|
|
997
|
+
if (o === 1)
|
|
998
998
|
return {
|
|
999
|
-
x:
|
|
1000
|
-
y:
|
|
999
|
+
x: i(a[0].clientX),
|
|
1000
|
+
y: i(a[0].clientY)
|
|
1001
1001
|
};
|
|
1002
|
-
for (var u = 0, g = 0,
|
|
1003
|
-
u += a[
|
|
1002
|
+
for (var u = 0, g = 0, A = 0; A < o; )
|
|
1003
|
+
u += a[A].clientX, g += a[A].clientY, A++;
|
|
1004
1004
|
return {
|
|
1005
|
-
x:
|
|
1006
|
-
y:
|
|
1005
|
+
x: i(u / o),
|
|
1006
|
+
y: i(g / o)
|
|
1007
1007
|
};
|
|
1008
1008
|
}
|
|
1009
|
-
function Ve(a,
|
|
1009
|
+
function Ve(a, o, u) {
|
|
1010
1010
|
return {
|
|
1011
|
-
x:
|
|
1011
|
+
x: o / a || 0,
|
|
1012
1012
|
y: u / a || 0
|
|
1013
1013
|
};
|
|
1014
1014
|
}
|
|
1015
|
-
function be(a,
|
|
1016
|
-
return a ===
|
|
1015
|
+
function be(a, o) {
|
|
1016
|
+
return a === o ? _e : h(a) >= h(o) ? a < 0 ? Pe : Oe : o < 0 ? ke : Me;
|
|
1017
1017
|
}
|
|
1018
|
-
function Je(a,
|
|
1019
|
-
u || (u =
|
|
1020
|
-
var g =
|
|
1021
|
-
return Math.sqrt(g * g +
|
|
1018
|
+
function Je(a, o, u) {
|
|
1019
|
+
u || (u = ze);
|
|
1020
|
+
var g = o[u[0]] - a[u[0]], A = o[u[1]] - a[u[1]];
|
|
1021
|
+
return Math.sqrt(g * g + A * A);
|
|
1022
1022
|
}
|
|
1023
|
-
function ft(a,
|
|
1024
|
-
u || (u =
|
|
1025
|
-
var g =
|
|
1026
|
-
return Math.atan2(
|
|
1023
|
+
function ft(a, o, u) {
|
|
1024
|
+
u || (u = ze);
|
|
1025
|
+
var g = o[u[0]] - a[u[0]], A = o[u[1]] - a[u[1]];
|
|
1026
|
+
return Math.atan2(A, g) * 180 / Math.PI;
|
|
1027
1027
|
}
|
|
1028
|
-
function rn(a,
|
|
1029
|
-
return ft(
|
|
1028
|
+
function rn(a, o) {
|
|
1029
|
+
return ft(o[1], o[0], Fe) + ft(a[1], a[0], Fe);
|
|
1030
1030
|
}
|
|
1031
|
-
function an(a,
|
|
1032
|
-
return Je(
|
|
1031
|
+
function an(a, o) {
|
|
1032
|
+
return Je(o[0], o[1], Fe) / Je(a[0], a[1], Fe);
|
|
1033
1033
|
}
|
|
1034
1034
|
var on = {
|
|
1035
|
-
mousedown:
|
|
1035
|
+
mousedown: z,
|
|
1036
1036
|
mousemove: se,
|
|
1037
|
-
mouseup:
|
|
1037
|
+
mouseup: J
|
|
1038
1038
|
}, sn = "mousedown", ln = "mousemove mouseup";
|
|
1039
1039
|
function $e() {
|
|
1040
1040
|
this.evEl = sn, this.evWin = ln, this.pressed = !1, le.apply(this, arguments);
|
|
@@ -1044,135 +1044,135 @@ var Tt = (function(h, s, e, n) {
|
|
|
1044
1044
|
* handle mouse events
|
|
1045
1045
|
* @param {Object} ev
|
|
1046
1046
|
*/
|
|
1047
|
-
handler: function(
|
|
1048
|
-
var u = on[
|
|
1049
|
-
u &
|
|
1050
|
-
pointers: [
|
|
1051
|
-
changedPointers: [
|
|
1052
|
-
pointerType:
|
|
1053
|
-
srcEvent:
|
|
1047
|
+
handler: function(o) {
|
|
1048
|
+
var u = on[o.type];
|
|
1049
|
+
u & z && (o.button === 0 || o.button === 2) && (this.pressed = !0), u & se && o.which !== 1 && (u = J), this.pressed && (u & J && (this.pressed = !1), this.callback(this.manager, u, {
|
|
1050
|
+
pointers: [o],
|
|
1051
|
+
changedPointers: [o],
|
|
1052
|
+
pointerType: ne,
|
|
1053
|
+
srcEvent: o
|
|
1054
1054
|
}));
|
|
1055
1055
|
}
|
|
1056
1056
|
});
|
|
1057
1057
|
var Ft = {
|
|
1058
|
-
pointerdown:
|
|
1058
|
+
pointerdown: z,
|
|
1059
1059
|
pointermove: se,
|
|
1060
|
-
pointerup:
|
|
1061
|
-
pointercancel:
|
|
1062
|
-
pointerout:
|
|
1060
|
+
pointerup: J,
|
|
1061
|
+
pointercancel: ee,
|
|
1062
|
+
pointerout: ee
|
|
1063
1063
|
}, un = {
|
|
1064
|
-
2:
|
|
1065
|
-
3:
|
|
1066
|
-
4:
|
|
1067
|
-
5:
|
|
1064
|
+
2: Z,
|
|
1065
|
+
3: B,
|
|
1066
|
+
4: ne,
|
|
1067
|
+
5: X
|
|
1068
1068
|
// see https://twitter.com/jacobrossi/status/480596438489890816
|
|
1069
|
-
},
|
|
1070
|
-
|
|
1069
|
+
}, Lt = "pointerdown", It = "pointermove pointerup pointercancel";
|
|
1070
|
+
d.MSPointerEvent && !d.PointerEvent && (Lt = "MSPointerDown", It = "MSPointerMove MSPointerUp MSPointerCancel");
|
|
1071
1071
|
function ht() {
|
|
1072
|
-
this.evEl =
|
|
1072
|
+
this.evEl = Lt, this.evWin = It, le.apply(this, arguments), this.store = this.manager.session.pointerEvents = [];
|
|
1073
1073
|
}
|
|
1074
1074
|
E(ht, le, {
|
|
1075
1075
|
/**
|
|
1076
1076
|
* handle mouse events
|
|
1077
1077
|
* @param {Object} ev
|
|
1078
1078
|
*/
|
|
1079
|
-
handler: function(
|
|
1080
|
-
var u = this.store, g = !1,
|
|
1081
|
-
|
|
1079
|
+
handler: function(o) {
|
|
1080
|
+
var u = this.store, g = !1, A = !1, O = o.type.toLowerCase().replace("ms", ""), U = Ft[O], ie = un[o.pointerType] || o.pointerType, ce = ie == Z, re = G(u, o.pointerId, "pointerId");
|
|
1081
|
+
U & z && (o.button === 0 || o.button === 2 || ce) ? re < 0 && (u.push(o), re = u.length - 1) : U & (J | ee) ? g = !0 : !ce && o.buttons === 0 && (g = !0, A = !0, U = Ft.pointerup), !(re < 0) && (A || (u[re] = o), this.callback(this.manager, U, {
|
|
1082
1082
|
pointers: u,
|
|
1083
|
-
changedPointers: [
|
|
1083
|
+
changedPointers: [o],
|
|
1084
1084
|
pointerType: ie,
|
|
1085
|
-
srcEvent: u[
|
|
1086
|
-
}), g && u.splice(
|
|
1085
|
+
srcEvent: u[re]
|
|
1086
|
+
}), g && u.splice(re, 1));
|
|
1087
1087
|
}
|
|
1088
1088
|
});
|
|
1089
1089
|
var cn = {
|
|
1090
|
-
touchstart:
|
|
1090
|
+
touchstart: z,
|
|
1091
1091
|
touchmove: se,
|
|
1092
|
-
touchend:
|
|
1093
|
-
touchcancel:
|
|
1092
|
+
touchend: J,
|
|
1093
|
+
touchcancel: ee
|
|
1094
1094
|
}, fn = "touchstart", hn = "touchstart touchmove touchend touchcancel";
|
|
1095
|
-
function
|
|
1095
|
+
function Dt() {
|
|
1096
1096
|
this.evTarget = fn, this.evWin = hn, this.started = !1, le.apply(this, arguments);
|
|
1097
1097
|
}
|
|
1098
|
-
E(
|
|
1099
|
-
handler: function(
|
|
1100
|
-
var u = cn[
|
|
1101
|
-
if (u ===
|
|
1102
|
-
var g =
|
|
1103
|
-
u & (
|
|
1098
|
+
E(Dt, le, {
|
|
1099
|
+
handler: function(o) {
|
|
1100
|
+
var u = cn[o.type];
|
|
1101
|
+
if (u === z && (this.started = !0), !!this.started) {
|
|
1102
|
+
var g = vn.call(this, o, u);
|
|
1103
|
+
u & (J | ee) && g[0].length - g[1].length === 0 && (this.started = !1), this.callback(this.manager, u, {
|
|
1104
1104
|
pointers: g[0],
|
|
1105
1105
|
changedPointers: g[1],
|
|
1106
|
-
pointerType:
|
|
1107
|
-
srcEvent:
|
|
1106
|
+
pointerType: Z,
|
|
1107
|
+
srcEvent: o
|
|
1108
1108
|
});
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
1111
|
});
|
|
1112
|
-
function
|
|
1113
|
-
var u =
|
|
1114
|
-
return
|
|
1112
|
+
function vn(a, o) {
|
|
1113
|
+
var u = q(a.touches), g = q(a.changedTouches);
|
|
1114
|
+
return o & (J | ee) && (u = Q(u.concat(g), "identifier")), [u, g];
|
|
1115
1115
|
}
|
|
1116
|
-
var
|
|
1117
|
-
touchstart:
|
|
1116
|
+
var dn = {
|
|
1117
|
+
touchstart: z,
|
|
1118
1118
|
touchmove: se,
|
|
1119
|
-
touchend:
|
|
1120
|
-
touchcancel:
|
|
1119
|
+
touchend: J,
|
|
1120
|
+
touchcancel: ee
|
|
1121
1121
|
}, pn = "touchstart touchmove touchend touchcancel";
|
|
1122
1122
|
function et() {
|
|
1123
1123
|
this.evTarget = pn, this.targetIds = {}, le.apply(this, arguments);
|
|
1124
1124
|
}
|
|
1125
1125
|
E(et, le, {
|
|
1126
|
-
handler: function(
|
|
1127
|
-
var u =
|
|
1126
|
+
handler: function(o) {
|
|
1127
|
+
var u = dn[o.type], g = mn.call(this, o, u);
|
|
1128
1128
|
g && this.callback(this.manager, u, {
|
|
1129
1129
|
pointers: g[0],
|
|
1130
1130
|
changedPointers: g[1],
|
|
1131
|
-
pointerType:
|
|
1132
|
-
srcEvent:
|
|
1131
|
+
pointerType: Z,
|
|
1132
|
+
srcEvent: o
|
|
1133
1133
|
});
|
|
1134
1134
|
}
|
|
1135
1135
|
});
|
|
1136
|
-
function mn(a,
|
|
1137
|
-
var u =
|
|
1138
|
-
if (
|
|
1136
|
+
function mn(a, o) {
|
|
1137
|
+
var u = q(a.touches), g = this.targetIds;
|
|
1138
|
+
if (o & (z | se) && u.length === 1)
|
|
1139
1139
|
return g[u[0].identifier] = !0, [u, u];
|
|
1140
|
-
var
|
|
1141
|
-
if (
|
|
1142
|
-
return
|
|
1143
|
-
}),
|
|
1144
|
-
for (
|
|
1145
|
-
g[
|
|
1146
|
-
for (
|
|
1147
|
-
g[
|
|
1140
|
+
var A, O, U = q(a.changedTouches), ie = [], ce = this.target;
|
|
1141
|
+
if (O = u.filter(function(re) {
|
|
1142
|
+
return F(re.target, ce);
|
|
1143
|
+
}), o === z)
|
|
1144
|
+
for (A = 0; A < O.length; )
|
|
1145
|
+
g[O[A].identifier] = !0, A++;
|
|
1146
|
+
for (A = 0; A < U.length; )
|
|
1147
|
+
g[U[A].identifier] && ie.push(U[A]), o & (J | ee) && delete g[U[A].identifier], A++;
|
|
1148
1148
|
if (ie.length)
|
|
1149
1149
|
return [
|
|
1150
1150
|
// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
|
|
1151
|
-
|
|
1151
|
+
Q(O.concat(ie), "identifier"),
|
|
1152
1152
|
ie
|
|
1153
1153
|
];
|
|
1154
1154
|
}
|
|
1155
|
-
var gn = 2500,
|
|
1156
|
-
function
|
|
1155
|
+
var gn = 2500, Nt = 25;
|
|
1156
|
+
function vt() {
|
|
1157
1157
|
le.apply(this, arguments);
|
|
1158
1158
|
var a = b(this.handler, this);
|
|
1159
1159
|
this.touch = new et(this.manager, a), this.mouse = new $e(this.manager, a), this.primaryTouch = null, this.lastTouches = [];
|
|
1160
1160
|
}
|
|
1161
|
-
E(
|
|
1161
|
+
E(vt, le, {
|
|
1162
1162
|
/**
|
|
1163
1163
|
* handle mouse and touch events
|
|
1164
1164
|
* @param {Hammer} manager
|
|
1165
1165
|
* @param {String} inputEvent
|
|
1166
1166
|
* @param {Object} inputData
|
|
1167
1167
|
*/
|
|
1168
|
-
handler: function(
|
|
1169
|
-
var
|
|
1170
|
-
if (!(
|
|
1171
|
-
if (
|
|
1168
|
+
handler: function(o, u, g) {
|
|
1169
|
+
var A = g.pointerType == Z, O = g.pointerType == ne;
|
|
1170
|
+
if (!(O && g.sourceCapabilities && g.sourceCapabilities.firesTouchEvents)) {
|
|
1171
|
+
if (A)
|
|
1172
1172
|
yn.call(this, u, g);
|
|
1173
|
-
else if (
|
|
1173
|
+
else if (O && bn.call(this, g))
|
|
1174
1174
|
return;
|
|
1175
|
-
this.callback(
|
|
1175
|
+
this.callback(o, u, g);
|
|
1176
1176
|
}
|
|
1177
1177
|
},
|
|
1178
1178
|
/**
|
|
@@ -1182,32 +1182,32 @@ var Tt = (function(h, s, e, n) {
|
|
|
1182
1182
|
this.touch.destroy(), this.mouse.destroy();
|
|
1183
1183
|
}
|
|
1184
1184
|
});
|
|
1185
|
-
function yn(a,
|
|
1186
|
-
a &
|
|
1185
|
+
function yn(a, o) {
|
|
1186
|
+
a & z ? (this.primaryTouch = o.changedPointers[0].identifier, Bt.call(this, o)) : a & (J | ee) && Bt.call(this, o);
|
|
1187
1187
|
}
|
|
1188
1188
|
function Bt(a) {
|
|
1189
|
-
var
|
|
1190
|
-
if (
|
|
1191
|
-
var u = { x:
|
|
1189
|
+
var o = a.changedPointers[0];
|
|
1190
|
+
if (o.identifier === this.primaryTouch) {
|
|
1191
|
+
var u = { x: o.clientX, y: o.clientY };
|
|
1192
1192
|
this.lastTouches.push(u);
|
|
1193
|
-
var g = this.lastTouches,
|
|
1194
|
-
var
|
|
1195
|
-
|
|
1193
|
+
var g = this.lastTouches, A = function() {
|
|
1194
|
+
var O = g.indexOf(u);
|
|
1195
|
+
O > -1 && g.splice(O, 1);
|
|
1196
1196
|
};
|
|
1197
|
-
setTimeout(
|
|
1197
|
+
setTimeout(A, gn);
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
1200
|
function bn(a) {
|
|
1201
|
-
for (var
|
|
1202
|
-
var
|
|
1203
|
-
if (
|
|
1201
|
+
for (var o = a.srcEvent.clientX, u = a.srcEvent.clientY, g = 0; g < this.lastTouches.length; g++) {
|
|
1202
|
+
var A = this.lastTouches[g], O = Math.abs(o - A.x), U = Math.abs(u - A.y);
|
|
1203
|
+
if (O <= Nt && U <= Nt)
|
|
1204
1204
|
return !0;
|
|
1205
1205
|
}
|
|
1206
1206
|
return !1;
|
|
1207
1207
|
}
|
|
1208
|
-
var Ut = r ?
|
|
1209
|
-
function pt(a,
|
|
1210
|
-
this.manager = a, this.set(
|
|
1208
|
+
var Ut = r ? R(r.style, "touchAction") : n, Rt = Ut !== n, zt = "compute", Vt = "auto", dt = "manipulation", Le = "none", je = "pan-x", Ge = "pan-y", tt = En();
|
|
1209
|
+
function pt(a, o) {
|
|
1210
|
+
this.manager = a, this.set(o);
|
|
1211
1211
|
}
|
|
1212
1212
|
pt.prototype = {
|
|
1213
1213
|
/**
|
|
@@ -1215,7 +1215,7 @@ var Tt = (function(h, s, e, n) {
|
|
|
1215
1215
|
* @param {String} value
|
|
1216
1216
|
*/
|
|
1217
1217
|
set: function(a) {
|
|
1218
|
-
a ==
|
|
1218
|
+
a == zt && (a = this.compute()), Rt && this.manager.element.style && tt[a] && (this.manager.element.style[Ut] = a), this.actions = a.toLowerCase().trim();
|
|
1219
1219
|
},
|
|
1220
1220
|
/**
|
|
1221
1221
|
* just re-set the touchAction value
|
|
@@ -1229,8 +1229,8 @@ var Tt = (function(h, s, e, n) {
|
|
|
1229
1229
|
*/
|
|
1230
1230
|
compute: function() {
|
|
1231
1231
|
var a = [];
|
|
1232
|
-
return M(this.manager.recognizers, function(
|
|
1233
|
-
T(
|
|
1232
|
+
return M(this.manager.recognizers, function(o) {
|
|
1233
|
+
T(o.options.enable, [o]) && (a = a.concat(o.getTouchAction()));
|
|
1234
1234
|
}), wn(a.join(" "));
|
|
1235
1235
|
},
|
|
1236
1236
|
/**
|
|
@@ -1238,19 +1238,19 @@ var Tt = (function(h, s, e, n) {
|
|
|
1238
1238
|
* @param {Object} input
|
|
1239
1239
|
*/
|
|
1240
1240
|
preventDefaults: function(a) {
|
|
1241
|
-
var
|
|
1241
|
+
var o = a.srcEvent, u = a.offsetDirection;
|
|
1242
1242
|
if (this.manager.session.prevented) {
|
|
1243
|
-
|
|
1243
|
+
o.preventDefault();
|
|
1244
1244
|
return;
|
|
1245
1245
|
}
|
|
1246
|
-
var g = this.actions,
|
|
1247
|
-
if (
|
|
1248
|
-
var ie = a.pointers.length === 1, ce = a.distance < 2,
|
|
1249
|
-
if (ie && ce &&
|
|
1246
|
+
var g = this.actions, A = V(g, Le) && !tt[Le], O = V(g, Ge) && !tt[Ge], U = V(g, je) && !tt[je];
|
|
1247
|
+
if (A) {
|
|
1248
|
+
var ie = a.pointers.length === 1, ce = a.distance < 2, re = a.deltaTime < 250;
|
|
1249
|
+
if (ie && ce && re)
|
|
1250
1250
|
return;
|
|
1251
1251
|
}
|
|
1252
|
-
if (!(
|
|
1253
|
-
return this.preventSrc(
|
|
1252
|
+
if (!(U && O) && (A || O && u & ue || U && u & ve))
|
|
1253
|
+
return this.preventSrc(o);
|
|
1254
1254
|
},
|
|
1255
1255
|
/**
|
|
1256
1256
|
* call preventDefault to prevent the browser's default behavior (scrolling in most cases)
|
|
@@ -1261,22 +1261,22 @@ var Tt = (function(h, s, e, n) {
|
|
|
1261
1261
|
}
|
|
1262
1262
|
};
|
|
1263
1263
|
function wn(a) {
|
|
1264
|
-
if (
|
|
1265
|
-
return
|
|
1266
|
-
var
|
|
1267
|
-
return
|
|
1264
|
+
if (V(a, Le))
|
|
1265
|
+
return Le;
|
|
1266
|
+
var o = V(a, je), u = V(a, Ge);
|
|
1267
|
+
return o && u ? Le : o || u ? o ? je : Ge : V(a, dt) ? dt : Vt;
|
|
1268
1268
|
}
|
|
1269
1269
|
function En() {
|
|
1270
1270
|
if (!Rt)
|
|
1271
1271
|
return !1;
|
|
1272
|
-
var a = {},
|
|
1272
|
+
var a = {}, o = d.CSS && d.CSS.supports;
|
|
1273
1273
|
return ["auto", "manipulation", "pan-y", "pan-x", "pan-x pan-y", "none"].forEach(function(u) {
|
|
1274
|
-
a[u] =
|
|
1274
|
+
a[u] = o ? d.CSS.supports("touch-action", u) : !0;
|
|
1275
1275
|
}), a;
|
|
1276
1276
|
}
|
|
1277
|
-
var nt = 1, fe = 2,
|
|
1277
|
+
var nt = 1, fe = 2, Be = 4, Se = 8, we = Se, Ye = 16, me = 32;
|
|
1278
1278
|
function Ee(a) {
|
|
1279
|
-
this.options =
|
|
1279
|
+
this.options = P({}, this.defaults, a || {}), this.id = L(), this.manager = null, this.options.enable = f(this.options.enable, !0), this.state = nt, this.simultaneous = {}, this.requireFail = [];
|
|
1280
1280
|
}
|
|
1281
1281
|
Ee.prototype = {
|
|
1282
1282
|
/**
|
|
@@ -1290,7 +1290,7 @@ var Tt = (function(h, s, e, n) {
|
|
|
1290
1290
|
* @return {Recognizer}
|
|
1291
1291
|
*/
|
|
1292
1292
|
set: function(a) {
|
|
1293
|
-
return
|
|
1293
|
+
return P(this.options, a), this.manager && this.manager.touchAction.update(), this;
|
|
1294
1294
|
},
|
|
1295
1295
|
/**
|
|
1296
1296
|
* recognize simultaneous with an other recognizer.
|
|
@@ -1300,8 +1300,8 @@ var Tt = (function(h, s, e, n) {
|
|
|
1300
1300
|
recognizeWith: function(a) {
|
|
1301
1301
|
if (y(a, "recognizeWith", this))
|
|
1302
1302
|
return this;
|
|
1303
|
-
var
|
|
1304
|
-
return a = rt(a, this),
|
|
1303
|
+
var o = this.simultaneous;
|
|
1304
|
+
return a = rt(a, this), o[a.id] || (o[a.id] = a, a.recognizeWith(this)), this;
|
|
1305
1305
|
},
|
|
1306
1306
|
/**
|
|
1307
1307
|
* drop the simultaneous link. it doesnt remove the link on the other recognizer.
|
|
@@ -1319,8 +1319,8 @@ var Tt = (function(h, s, e, n) {
|
|
|
1319
1319
|
requireFailure: function(a) {
|
|
1320
1320
|
if (y(a, "requireFailure", this))
|
|
1321
1321
|
return this;
|
|
1322
|
-
var
|
|
1323
|
-
return a = rt(a, this),
|
|
1322
|
+
var o = this.requireFail;
|
|
1323
|
+
return a = rt(a, this), G(o, a) === -1 && (o.push(a), a.requireFailure(this)), this;
|
|
1324
1324
|
},
|
|
1325
1325
|
/**
|
|
1326
1326
|
* drop the requireFailure link. it does not remove the link on the other recognizer.
|
|
@@ -1331,8 +1331,8 @@ var Tt = (function(h, s, e, n) {
|
|
|
1331
1331
|
if (y(a, "dropRequireFailure", this))
|
|
1332
1332
|
return this;
|
|
1333
1333
|
a = rt(a, this);
|
|
1334
|
-
var
|
|
1335
|
-
return
|
|
1334
|
+
var o = G(this.requireFail, a);
|
|
1335
|
+
return o > -1 && this.requireFail.splice(o, 1), this;
|
|
1336
1336
|
},
|
|
1337
1337
|
/**
|
|
1338
1338
|
* has require failures boolean
|
|
@@ -1355,11 +1355,11 @@ var Tt = (function(h, s, e, n) {
|
|
|
1355
1355
|
* @param {Object} input
|
|
1356
1356
|
*/
|
|
1357
1357
|
emit: function(a) {
|
|
1358
|
-
var
|
|
1359
|
-
function g(
|
|
1360
|
-
|
|
1358
|
+
var o = this, u = this.state;
|
|
1359
|
+
function g(A) {
|
|
1360
|
+
o.manager.emit(A, a);
|
|
1361
1361
|
}
|
|
1362
|
-
u <
|
|
1362
|
+
u < Se && g(o.options.event + jt(u)), g(o.options.event), a.additionalEvent && g(a.additionalEvent), u >= Se && g(o.options.event + jt(u));
|
|
1363
1363
|
},
|
|
1364
1364
|
/**
|
|
1365
1365
|
* Check that all the require failure recognizers has failed,
|
|
@@ -1389,12 +1389,12 @@ var Tt = (function(h, s, e, n) {
|
|
|
1389
1389
|
* @param {Object} inputData
|
|
1390
1390
|
*/
|
|
1391
1391
|
recognize: function(a) {
|
|
1392
|
-
var
|
|
1393
|
-
if (!T(this.options.enable, [this,
|
|
1392
|
+
var o = P({}, a);
|
|
1393
|
+
if (!T(this.options.enable, [this, o])) {
|
|
1394
1394
|
this.reset(), this.state = me;
|
|
1395
1395
|
return;
|
|
1396
1396
|
}
|
|
1397
|
-
this.state & (we |
|
|
1397
|
+
this.state & (we | Ye | me) && (this.state = nt), this.state = this.process(o), this.state & (fe | Be | Se | Ye) && this.tryEmit(o);
|
|
1398
1398
|
},
|
|
1399
1399
|
/**
|
|
1400
1400
|
* return the state of the recognizer
|
|
@@ -1422,19 +1422,19 @@ var Tt = (function(h, s, e, n) {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
};
|
|
1424
1424
|
function jt(a) {
|
|
1425
|
-
return a &
|
|
1425
|
+
return a & Ye ? "cancel" : a & Se ? "end" : a & Be ? "move" : a & fe ? "start" : "";
|
|
1426
1426
|
}
|
|
1427
1427
|
function Gt(a) {
|
|
1428
|
-
return a ==
|
|
1428
|
+
return a == Me ? "down" : a == ke ? "up" : a == Pe ? "left" : a == Oe ? "right" : "";
|
|
1429
1429
|
}
|
|
1430
|
-
function rt(a,
|
|
1431
|
-
var u =
|
|
1430
|
+
function rt(a, o) {
|
|
1431
|
+
var u = o.manager;
|
|
1432
1432
|
return u ? u.get(a) : a;
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1434
|
+
function de() {
|
|
1435
1435
|
Ee.apply(this, arguments);
|
|
1436
1436
|
}
|
|
1437
|
-
E(
|
|
1437
|
+
E(de, Ee, {
|
|
1438
1438
|
/**
|
|
1439
1439
|
* @namespace
|
|
1440
1440
|
* @memberof AttrRecognizer
|
|
@@ -1453,8 +1453,8 @@ var Tt = (function(h, s, e, n) {
|
|
|
1453
1453
|
* @returns {Boolean} recognized
|
|
1454
1454
|
*/
|
|
1455
1455
|
attrTest: function(a) {
|
|
1456
|
-
var
|
|
1457
|
-
return
|
|
1456
|
+
var o = this.options.pointers;
|
|
1457
|
+
return o === 0 || a.pointers.length === o;
|
|
1458
1458
|
},
|
|
1459
1459
|
/**
|
|
1460
1460
|
* Process the input and return the state for the recognizer
|
|
@@ -1463,14 +1463,14 @@ var Tt = (function(h, s, e, n) {
|
|
|
1463
1463
|
* @returns {*} State
|
|
1464
1464
|
*/
|
|
1465
1465
|
process: function(a) {
|
|
1466
|
-
var
|
|
1467
|
-
return g && (u &
|
|
1466
|
+
var o = this.state, u = a.eventType, g = o & (fe | Be), A = this.attrTest(a);
|
|
1467
|
+
return g && (u & ee || !A) ? o | Ye : g || A ? u & J ? o | Se : o & fe ? o | Be : fe : me;
|
|
1468
1468
|
}
|
|
1469
1469
|
});
|
|
1470
1470
|
function at() {
|
|
1471
|
-
|
|
1471
|
+
de.apply(this, arguments), this.pX = null, this.pY = null;
|
|
1472
1472
|
}
|
|
1473
|
-
E(at,
|
|
1473
|
+
E(at, de, {
|
|
1474
1474
|
/**
|
|
1475
1475
|
* @namespace
|
|
1476
1476
|
* @memberof PanRecognizer
|
|
@@ -1479,29 +1479,29 @@ var Tt = (function(h, s, e, n) {
|
|
|
1479
1479
|
event: "pan",
|
|
1480
1480
|
threshold: 10,
|
|
1481
1481
|
pointers: 1,
|
|
1482
|
-
direction:
|
|
1482
|
+
direction: Re
|
|
1483
1483
|
},
|
|
1484
1484
|
getTouchAction: function() {
|
|
1485
|
-
var a = this.options.direction,
|
|
1486
|
-
return a & ue &&
|
|
1485
|
+
var a = this.options.direction, o = [];
|
|
1486
|
+
return a & ue && o.push(Ge), a & ve && o.push(je), o;
|
|
1487
1487
|
},
|
|
1488
1488
|
directionTest: function(a) {
|
|
1489
|
-
var
|
|
1490
|
-
return
|
|
1489
|
+
var o = this.options, u = !0, g = a.distance, A = a.direction, O = a.deltaX, U = a.deltaY;
|
|
1490
|
+
return A & o.direction || (o.direction & ue ? (A = O === 0 ? _e : O < 0 ? Pe : Oe, u = O != this.pX, g = Math.abs(a.deltaX)) : (A = U === 0 ? _e : U < 0 ? ke : Me, u = U != this.pY, g = Math.abs(a.deltaY))), a.direction = A, u && g > o.threshold && A & o.direction;
|
|
1491
1491
|
},
|
|
1492
1492
|
attrTest: function(a) {
|
|
1493
|
-
return
|
|
1493
|
+
return de.prototype.attrTest.call(this, a) && (this.state & fe || !(this.state & fe) && this.directionTest(a));
|
|
1494
1494
|
},
|
|
1495
1495
|
emit: function(a) {
|
|
1496
1496
|
this.pX = a.deltaX, this.pY = a.deltaY;
|
|
1497
|
-
var
|
|
1498
|
-
|
|
1497
|
+
var o = Gt(a.direction);
|
|
1498
|
+
o && (a.additionalEvent = this.options.event + o), this._super.emit.call(this, a);
|
|
1499
1499
|
}
|
|
1500
1500
|
});
|
|
1501
1501
|
function mt() {
|
|
1502
|
-
|
|
1502
|
+
de.apply(this, arguments);
|
|
1503
1503
|
}
|
|
1504
|
-
E(mt,
|
|
1504
|
+
E(mt, de, {
|
|
1505
1505
|
/**
|
|
1506
1506
|
* @namespace
|
|
1507
1507
|
* @memberof PinchRecognizer
|
|
@@ -1512,15 +1512,15 @@ var Tt = (function(h, s, e, n) {
|
|
|
1512
1512
|
pointers: 2
|
|
1513
1513
|
},
|
|
1514
1514
|
getTouchAction: function() {
|
|
1515
|
-
return [
|
|
1515
|
+
return [Le];
|
|
1516
1516
|
},
|
|
1517
1517
|
attrTest: function(a) {
|
|
1518
1518
|
return this._super.attrTest.call(this, a) && (Math.abs(a.scale - 1) > this.options.threshold || this.state & fe);
|
|
1519
1519
|
},
|
|
1520
1520
|
emit: function(a) {
|
|
1521
1521
|
if (a.scale !== 1) {
|
|
1522
|
-
var
|
|
1523
|
-
a.additionalEvent = this.options.event +
|
|
1522
|
+
var o = a.scale < 1 ? "in" : "out";
|
|
1523
|
+
a.additionalEvent = this.options.event + o;
|
|
1524
1524
|
}
|
|
1525
1525
|
this._super.emit.call(this, a);
|
|
1526
1526
|
}
|
|
@@ -1542,17 +1542,17 @@ var Tt = (function(h, s, e, n) {
|
|
|
1542
1542
|
// a minimal movement is ok, but keep it low
|
|
1543
1543
|
},
|
|
1544
1544
|
getTouchAction: function() {
|
|
1545
|
-
return [
|
|
1545
|
+
return [Vt];
|
|
1546
1546
|
},
|
|
1547
1547
|
process: function(a) {
|
|
1548
|
-
var
|
|
1549
|
-
if (this._input = a, !g || !u || a.eventType & (
|
|
1548
|
+
var o = this.options, u = a.pointers.length === o.pointers, g = a.distance < o.threshold, A = a.deltaTime > o.time;
|
|
1549
|
+
if (this._input = a, !g || !u || a.eventType & (J | ee) && !A)
|
|
1550
1550
|
this.reset();
|
|
1551
|
-
else if (a.eventType &
|
|
1552
|
-
this.reset(), this._timer =
|
|
1551
|
+
else if (a.eventType & z)
|
|
1552
|
+
this.reset(), this._timer = v(function() {
|
|
1553
1553
|
this.state = we, this.tryEmit();
|
|
1554
|
-
},
|
|
1555
|
-
else if (a.eventType &
|
|
1554
|
+
}, o.time, this);
|
|
1555
|
+
else if (a.eventType & J)
|
|
1556
1556
|
return we;
|
|
1557
1557
|
return me;
|
|
1558
1558
|
},
|
|
@@ -1560,13 +1560,13 @@ var Tt = (function(h, s, e, n) {
|
|
|
1560
1560
|
clearTimeout(this._timer);
|
|
1561
1561
|
},
|
|
1562
1562
|
emit: function(a) {
|
|
1563
|
-
this.state === we && (a && a.eventType &
|
|
1563
|
+
this.state === we && (a && a.eventType & J ? this.manager.emit(this.options.event + "up", a) : (this._input.timeStamp = c(), this.manager.emit(this.options.event, this._input)));
|
|
1564
1564
|
}
|
|
1565
1565
|
});
|
|
1566
1566
|
function yt() {
|
|
1567
|
-
|
|
1567
|
+
de.apply(this, arguments);
|
|
1568
1568
|
}
|
|
1569
|
-
E(yt,
|
|
1569
|
+
E(yt, de, {
|
|
1570
1570
|
/**
|
|
1571
1571
|
* @namespace
|
|
1572
1572
|
* @memberof RotateRecognizer
|
|
@@ -1577,16 +1577,16 @@ var Tt = (function(h, s, e, n) {
|
|
|
1577
1577
|
pointers: 2
|
|
1578
1578
|
},
|
|
1579
1579
|
getTouchAction: function() {
|
|
1580
|
-
return [
|
|
1580
|
+
return [Le];
|
|
1581
1581
|
},
|
|
1582
1582
|
attrTest: function(a) {
|
|
1583
1583
|
return this._super.attrTest.call(this, a) && (Math.abs(a.rotation) > this.options.threshold || this.state & fe);
|
|
1584
1584
|
}
|
|
1585
1585
|
});
|
|
1586
1586
|
function bt() {
|
|
1587
|
-
|
|
1587
|
+
de.apply(this, arguments);
|
|
1588
1588
|
}
|
|
1589
|
-
E(bt,
|
|
1589
|
+
E(bt, de, {
|
|
1590
1590
|
/**
|
|
1591
1591
|
* @namespace
|
|
1592
1592
|
* @memberof SwipeRecognizer
|
|
@@ -1595,19 +1595,19 @@ var Tt = (function(h, s, e, n) {
|
|
|
1595
1595
|
event: "swipe",
|
|
1596
1596
|
threshold: 10,
|
|
1597
1597
|
velocity: 0.3,
|
|
1598
|
-
direction: ue |
|
|
1598
|
+
direction: ue | ve,
|
|
1599
1599
|
pointers: 1
|
|
1600
1600
|
},
|
|
1601
1601
|
getTouchAction: function() {
|
|
1602
1602
|
return at.prototype.getTouchAction.call(this);
|
|
1603
1603
|
},
|
|
1604
1604
|
attrTest: function(a) {
|
|
1605
|
-
var
|
|
1606
|
-
return
|
|
1605
|
+
var o = this.options.direction, u;
|
|
1606
|
+
return o & (ue | ve) ? u = a.overallVelocity : o & ue ? u = a.overallVelocityX : o & ve && (u = a.overallVelocityY), this._super.attrTest.call(this, a) && o & a.offsetDirection && a.distance > this.options.threshold && a.maxPointers == this.options.pointers && h(u) > this.options.velocity && a.eventType & J;
|
|
1607
1607
|
},
|
|
1608
1608
|
emit: function(a) {
|
|
1609
|
-
var
|
|
1610
|
-
|
|
1609
|
+
var o = Gt(a.offsetDirection);
|
|
1610
|
+
o && this.manager.emit(this.options.event + o, a), this.manager.emit(this.options.event, a);
|
|
1611
1611
|
}
|
|
1612
1612
|
});
|
|
1613
1613
|
function it() {
|
|
@@ -1632,27 +1632,27 @@ var Tt = (function(h, s, e, n) {
|
|
|
1632
1632
|
// a multi-tap can be a bit off the initial position
|
|
1633
1633
|
},
|
|
1634
1634
|
getTouchAction: function() {
|
|
1635
|
-
return [
|
|
1635
|
+
return [dt];
|
|
1636
1636
|
},
|
|
1637
1637
|
process: function(a) {
|
|
1638
|
-
var
|
|
1639
|
-
if (this.reset(), a.eventType &
|
|
1638
|
+
var o = this.options, u = a.pointers.length === o.pointers, g = a.distance < o.threshold, A = a.deltaTime < o.time;
|
|
1639
|
+
if (this.reset(), a.eventType & z && this.count === 0)
|
|
1640
1640
|
return this.failTimeout();
|
|
1641
|
-
if (g &&
|
|
1642
|
-
if (a.eventType !=
|
|
1641
|
+
if (g && A && u) {
|
|
1642
|
+
if (a.eventType != J)
|
|
1643
1643
|
return this.failTimeout();
|
|
1644
|
-
var
|
|
1645
|
-
this.pTime = a.timeStamp, this.pCenter = a.center, !
|
|
1646
|
-
var ie = this.count %
|
|
1644
|
+
var O = this.pTime ? a.timeStamp - this.pTime < o.interval : !0, U = !this.pCenter || Je(this.pCenter, a.center) < o.posThreshold;
|
|
1645
|
+
this.pTime = a.timeStamp, this.pCenter = a.center, !U || !O ? this.count = 1 : this.count += 1, this._input = a;
|
|
1646
|
+
var ie = this.count % o.taps;
|
|
1647
1647
|
if (ie === 0)
|
|
1648
|
-
return this.hasRequireFailures() ? (this._timer =
|
|
1648
|
+
return this.hasRequireFailures() ? (this._timer = v(function() {
|
|
1649
1649
|
this.state = we, this.tryEmit();
|
|
1650
|
-
},
|
|
1650
|
+
}, o.interval, this), fe) : we;
|
|
1651
1651
|
}
|
|
1652
1652
|
return me;
|
|
1653
1653
|
},
|
|
1654
1654
|
failTimeout: function() {
|
|
1655
|
-
return this._timer =
|
|
1655
|
+
return this._timer = v(function() {
|
|
1656
1656
|
this.state = me;
|
|
1657
1657
|
}, this.options.interval, this), me;
|
|
1658
1658
|
},
|
|
@@ -1663,10 +1663,10 @@ var Tt = (function(h, s, e, n) {
|
|
|
1663
1663
|
this.state == we && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input));
|
|
1664
1664
|
}
|
|
1665
1665
|
});
|
|
1666
|
-
function
|
|
1667
|
-
return
|
|
1666
|
+
function Ue(a, o) {
|
|
1667
|
+
return o = o || {}, o.recognizers = f(o.recognizers, Ue.defaults.preset), new wt(a, o);
|
|
1668
1668
|
}
|
|
1669
|
-
|
|
1669
|
+
Ue.VERSION = "2.0.7", Ue.defaults = {
|
|
1670
1670
|
/**
|
|
1671
1671
|
* set if DOM events are being triggered.
|
|
1672
1672
|
* But this is slower and unused by simple implementations, so disabled by default.
|
|
@@ -1680,7 +1680,7 @@ var Tt = (function(h, s, e, n) {
|
|
|
1680
1680
|
* @type {String}
|
|
1681
1681
|
* @default compute
|
|
1682
1682
|
*/
|
|
1683
|
-
touchAction:
|
|
1683
|
+
touchAction: zt,
|
|
1684
1684
|
/**
|
|
1685
1685
|
* @type {Boolean}
|
|
1686
1686
|
* @default true
|
|
@@ -1763,8 +1763,8 @@ var Tt = (function(h, s, e, n) {
|
|
|
1763
1763
|
}
|
|
1764
1764
|
};
|
|
1765
1765
|
var Tn = 1, Yt = 2;
|
|
1766
|
-
function wt(a,
|
|
1767
|
-
this.options =
|
|
1766
|
+
function wt(a, o) {
|
|
1767
|
+
this.options = P({}, Ue.defaults, o || {}), this.options.inputTarget = this.options.inputTarget || a, this.handlers = {}, this.session = {}, this.recognizers = [], this.oldCssProps = {}, this.element = a, this.input = Ze(this), this.touchAction = new pt(this, this.options.touchAction), Wt(this, !0), M(this.options.recognizers, function(u) {
|
|
1768
1768
|
var g = this.add(new u[0](u[1]));
|
|
1769
1769
|
u[2] && g.recognizeWith(u[2]), u[3] && g.requireFailure(u[3]);
|
|
1770
1770
|
}, this);
|
|
@@ -1776,7 +1776,7 @@ var Tt = (function(h, s, e, n) {
|
|
|
1776
1776
|
* @returns {Manager}
|
|
1777
1777
|
*/
|
|
1778
1778
|
set: function(a) {
|
|
1779
|
-
return
|
|
1779
|
+
return P(this.options, a), a.touchAction && this.touchAction.update(), a.inputTarget && (this.input.destroy(), this.input.target = a.inputTarget, this.input.init()), this;
|
|
1780
1780
|
},
|
|
1781
1781
|
/**
|
|
1782
1782
|
* stop recognizing for this session.
|
|
@@ -1794,15 +1794,15 @@ var Tt = (function(h, s, e, n) {
|
|
|
1794
1794
|
* @param {Object} inputData
|
|
1795
1795
|
*/
|
|
1796
1796
|
recognize: function(a) {
|
|
1797
|
-
var
|
|
1798
|
-
if (!
|
|
1797
|
+
var o = this.session;
|
|
1798
|
+
if (!o.stopped) {
|
|
1799
1799
|
this.touchAction.preventDefaults(a);
|
|
1800
|
-
var u, g = this.recognizers,
|
|
1801
|
-
(!
|
|
1802
|
-
for (var
|
|
1803
|
-
u = g[
|
|
1804
|
-
(!
|
|
1805
|
-
u.canRecognizeWith(
|
|
1800
|
+
var u, g = this.recognizers, A = o.curRecognizer;
|
|
1801
|
+
(!A || A && A.state & we) && (A = o.curRecognizer = null);
|
|
1802
|
+
for (var O = 0; O < g.length; )
|
|
1803
|
+
u = g[O], o.stopped !== Yt && // 1
|
|
1804
|
+
(!A || u == A || // 2
|
|
1805
|
+
u.canRecognizeWith(A)) ? u.recognize(a) : u.reset(), !A && u.state & (fe | Be | Se) && (A = o.curRecognizer = u), O++;
|
|
1806
1806
|
}
|
|
1807
1807
|
},
|
|
1808
1808
|
/**
|
|
@@ -1813,9 +1813,9 @@ var Tt = (function(h, s, e, n) {
|
|
|
1813
1813
|
get: function(a) {
|
|
1814
1814
|
if (a instanceof Ee)
|
|
1815
1815
|
return a;
|
|
1816
|
-
for (var
|
|
1817
|
-
if (
|
|
1818
|
-
return
|
|
1816
|
+
for (var o = this.recognizers, u = 0; u < o.length; u++)
|
|
1817
|
+
if (o[u].options.event == a)
|
|
1818
|
+
return o[u];
|
|
1819
1819
|
return null;
|
|
1820
1820
|
},
|
|
1821
1821
|
/**
|
|
@@ -1827,8 +1827,8 @@ var Tt = (function(h, s, e, n) {
|
|
|
1827
1827
|
add: function(a) {
|
|
1828
1828
|
if (y(a, "add", this))
|
|
1829
1829
|
return this;
|
|
1830
|
-
var
|
|
1831
|
-
return
|
|
1830
|
+
var o = this.get(a.options.event);
|
|
1831
|
+
return o && this.remove(o), this.recognizers.push(a), a.manager = this, this.touchAction.update(), a;
|
|
1832
1832
|
},
|
|
1833
1833
|
/**
|
|
1834
1834
|
* remove a recognizer by name or instance
|
|
@@ -1839,8 +1839,8 @@ var Tt = (function(h, s, e, n) {
|
|
|
1839
1839
|
if (y(a, "remove", this))
|
|
1840
1840
|
return this;
|
|
1841
1841
|
if (a = this.get(a), a) {
|
|
1842
|
-
var
|
|
1843
|
-
u !== -1 && (
|
|
1842
|
+
var o = this.recognizers, u = G(o, a);
|
|
1843
|
+
u !== -1 && (o.splice(u, 1), this.touchAction.update());
|
|
1844
1844
|
}
|
|
1845
1845
|
return this;
|
|
1846
1846
|
},
|
|
@@ -1850,11 +1850,11 @@ var Tt = (function(h, s, e, n) {
|
|
|
1850
1850
|
* @param {Function} handler
|
|
1851
1851
|
* @returns {EventEmitter} this
|
|
1852
1852
|
*/
|
|
1853
|
-
on: function(a,
|
|
1854
|
-
if (a !== n &&
|
|
1853
|
+
on: function(a, o) {
|
|
1854
|
+
if (a !== n && o !== n) {
|
|
1855
1855
|
var u = this.handlers;
|
|
1856
|
-
return M(
|
|
1857
|
-
u[g] = u[g] || [], u[g].push(
|
|
1856
|
+
return M(Y(a), function(g) {
|
|
1857
|
+
u[g] = u[g] || [], u[g].push(o);
|
|
1858
1858
|
}), this;
|
|
1859
1859
|
}
|
|
1860
1860
|
},
|
|
@@ -1864,11 +1864,11 @@ var Tt = (function(h, s, e, n) {
|
|
|
1864
1864
|
* @param {Function} [handler]
|
|
1865
1865
|
* @returns {EventEmitter} this
|
|
1866
1866
|
*/
|
|
1867
|
-
off: function(a,
|
|
1867
|
+
off: function(a, o) {
|
|
1868
1868
|
if (a !== n) {
|
|
1869
1869
|
var u = this.handlers;
|
|
1870
|
-
return M(
|
|
1871
|
-
|
|
1870
|
+
return M(Y(a), function(g) {
|
|
1871
|
+
o ? u[g] && u[g].splice(G(u[g], o), 1) : delete u[g];
|
|
1872
1872
|
}), this;
|
|
1873
1873
|
}
|
|
1874
1874
|
},
|
|
@@ -1877,15 +1877,15 @@ var Tt = (function(h, s, e, n) {
|
|
|
1877
1877
|
* @param {String} event
|
|
1878
1878
|
* @param {Object} data
|
|
1879
1879
|
*/
|
|
1880
|
-
emit: function(a,
|
|
1881
|
-
this.options.domEvents &&
|
|
1880
|
+
emit: function(a, o) {
|
|
1881
|
+
this.options.domEvents && An(a, o);
|
|
1882
1882
|
var u = this.handlers[a] && this.handlers[a].slice();
|
|
1883
1883
|
if (!(!u || !u.length)) {
|
|
1884
|
-
|
|
1885
|
-
|
|
1884
|
+
o.type = a, o.preventDefault = function() {
|
|
1885
|
+
o.srcEvent.preventDefault();
|
|
1886
1886
|
};
|
|
1887
1887
|
for (var g = 0; g < u.length; )
|
|
1888
|
-
u[g](
|
|
1888
|
+
u[g](o), g++;
|
|
1889
1889
|
}
|
|
1890
1890
|
},
|
|
1891
1891
|
/**
|
|
@@ -1893,87 +1893,87 @@ var Tt = (function(h, s, e, n) {
|
|
|
1893
1893
|
* it doesn't unbind dom events, that is the user own responsibility
|
|
1894
1894
|
*/
|
|
1895
1895
|
destroy: function() {
|
|
1896
|
-
this.element &&
|
|
1896
|
+
this.element && Wt(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null;
|
|
1897
1897
|
}
|
|
1898
1898
|
};
|
|
1899
|
-
function
|
|
1899
|
+
function Wt(a, o) {
|
|
1900
1900
|
var u = a.element;
|
|
1901
1901
|
if (u.style) {
|
|
1902
1902
|
var g;
|
|
1903
|
-
M(a.options.cssProps, function(
|
|
1904
|
-
g =
|
|
1905
|
-
}),
|
|
1903
|
+
M(a.options.cssProps, function(A, O) {
|
|
1904
|
+
g = R(u.style, O), o ? (a.oldCssProps[g] = u.style[g], u.style[g] = A) : u.style[g] = a.oldCssProps[g] || "";
|
|
1905
|
+
}), o || (a.oldCssProps = {});
|
|
1906
1906
|
}
|
|
1907
1907
|
}
|
|
1908
|
-
function
|
|
1909
|
-
var u =
|
|
1910
|
-
u.initEvent(a, !0, !0), u.gesture =
|
|
1908
|
+
function An(a, o) {
|
|
1909
|
+
var u = l.createEvent("Event");
|
|
1910
|
+
u.initEvent(a, !0, !0), u.gesture = o, o.target.dispatchEvent(u);
|
|
1911
1911
|
}
|
|
1912
|
-
return
|
|
1913
|
-
INPUT_START:
|
|
1912
|
+
return P(Ue, {
|
|
1913
|
+
INPUT_START: z,
|
|
1914
1914
|
INPUT_MOVE: se,
|
|
1915
|
-
INPUT_END:
|
|
1916
|
-
INPUT_CANCEL:
|
|
1915
|
+
INPUT_END: J,
|
|
1916
|
+
INPUT_CANCEL: ee,
|
|
1917
1917
|
STATE_POSSIBLE: nt,
|
|
1918
1918
|
STATE_BEGAN: fe,
|
|
1919
|
-
STATE_CHANGED:
|
|
1920
|
-
STATE_ENDED:
|
|
1919
|
+
STATE_CHANGED: Be,
|
|
1920
|
+
STATE_ENDED: Se,
|
|
1921
1921
|
STATE_RECOGNIZED: we,
|
|
1922
|
-
STATE_CANCELLED:
|
|
1922
|
+
STATE_CANCELLED: Ye,
|
|
1923
1923
|
STATE_FAILED: me,
|
|
1924
|
-
DIRECTION_NONE:
|
|
1925
|
-
DIRECTION_LEFT:
|
|
1926
|
-
DIRECTION_RIGHT:
|
|
1927
|
-
DIRECTION_UP:
|
|
1928
|
-
DIRECTION_DOWN:
|
|
1924
|
+
DIRECTION_NONE: _e,
|
|
1925
|
+
DIRECTION_LEFT: Pe,
|
|
1926
|
+
DIRECTION_RIGHT: Oe,
|
|
1927
|
+
DIRECTION_UP: ke,
|
|
1928
|
+
DIRECTION_DOWN: Me,
|
|
1929
1929
|
DIRECTION_HORIZONTAL: ue,
|
|
1930
|
-
DIRECTION_VERTICAL:
|
|
1931
|
-
DIRECTION_ALL:
|
|
1930
|
+
DIRECTION_VERTICAL: ve,
|
|
1931
|
+
DIRECTION_ALL: Re,
|
|
1932
1932
|
Manager: wt,
|
|
1933
1933
|
Input: le,
|
|
1934
1934
|
TouchAction: pt,
|
|
1935
1935
|
TouchInput: et,
|
|
1936
1936
|
MouseInput: $e,
|
|
1937
1937
|
PointerEventInput: ht,
|
|
1938
|
-
TouchMouseInput:
|
|
1939
|
-
SingleTouchInput:
|
|
1938
|
+
TouchMouseInput: vt,
|
|
1939
|
+
SingleTouchInput: Dt,
|
|
1940
1940
|
Recognizer: Ee,
|
|
1941
|
-
AttrRecognizer:
|
|
1941
|
+
AttrRecognizer: de,
|
|
1942
1942
|
Tap: it,
|
|
1943
1943
|
Pan: at,
|
|
1944
1944
|
Swipe: bt,
|
|
1945
1945
|
Pinch: mt,
|
|
1946
1946
|
Rotate: yt,
|
|
1947
1947
|
Press: gt,
|
|
1948
|
-
on:
|
|
1949
|
-
off:
|
|
1948
|
+
on: C,
|
|
1949
|
+
off: x,
|
|
1950
1950
|
each: M,
|
|
1951
|
-
merge:
|
|
1952
|
-
extend:
|
|
1953
|
-
assign:
|
|
1951
|
+
merge: _,
|
|
1952
|
+
extend: S,
|
|
1953
|
+
assign: P,
|
|
1954
1954
|
inherit: E,
|
|
1955
1955
|
bindFn: b,
|
|
1956
|
-
prefixed:
|
|
1957
|
-
}),
|
|
1958
|
-
})(typeof window != "undefined" ? window : {}, typeof document != "undefined" ? document : {}),
|
|
1959
|
-
|
|
1956
|
+
prefixed: R
|
|
1957
|
+
}), Ue;
|
|
1958
|
+
})(typeof window != "undefined" ? window : {}, typeof document != "undefined" ? document : {}), qe = function(d, l) {
|
|
1959
|
+
l === void 0 && console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'), l === document && console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'), this.object = d, this.domElement = l, this.enabled = !0, this.target = new ye(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !1, this.keyPanSpeed = 7, this.autoRotate = !1, this.autoRotateSpeed = 2, this.enableKeys = !0, this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 }, this.mouseButtons = { LEFT: xe.ROTATE, MIDDLE: xe.DOLLY, RIGHT: xe.PAN }, this.touches = { ONE: Ce.ROTATE, TWO: Ce.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.getPolarAngle = function() {
|
|
1960
1960
|
return c.phi;
|
|
1961
1961
|
}, this.getAzimuthalAngle = function() {
|
|
1962
1962
|
return c.theta;
|
|
1963
1963
|
}, this.saveState = function() {
|
|
1964
1964
|
e.target0.copy(e.target), e.position0.copy(e.object.position), e.zoom0 = e.object.zoom;
|
|
1965
1965
|
}, this.reset = function() {
|
|
1966
|
-
e.target.copy(e.target0), e.object.position.copy(e.position0), e.object.zoom = e.zoom0, e.object.updateProjectionMatrix(), e.dispatchEvent(n), e.update(),
|
|
1966
|
+
e.target.copy(e.target0), e.object.position.copy(e.position0), e.object.zoom = e.zoom0, e.object.updateProjectionMatrix(), e.dispatchEvent(n), e.update(), i = s.NONE;
|
|
1967
1967
|
}, this.update = (function() {
|
|
1968
|
-
var
|
|
1968
|
+
var m = new ye(), j = new Kt().setFromUnitVectors(d.up, new ye(0, 1, 0)), te = j.clone().inverse(), ae = new ye(), pe = new Kt();
|
|
1969
1969
|
return function() {
|
|
1970
1970
|
var be = e.object.position;
|
|
1971
|
-
return
|
|
1971
|
+
return m.copy(be).sub(e.target), m.applyQuaternion(j), c.setFromVector3(m), e.autoRotate && i === s.NONE && Y(F()), e.enableDamping ? (c.theta += v.theta * e.dampingFactor, c.phi += v.phi * e.dampingFactor) : (c.theta += v.theta, c.phi += v.phi), c.theta = Math.max(e.minAzimuthAngle, Math.min(e.maxAzimuthAngle, c.theta)), c.phi = Math.max(e.minPolarAngle, Math.min(e.maxPolarAngle, c.phi)), c.makeSafe(), c.radius *= y, c.radius = Math.max(e.minDistance, Math.min(e.maxDistance, c.radius)), e.enableDamping === !0 ? e.target.addScaledVector(M, e.dampingFactor) : e.target.add(M), m.setFromSpherical(c), m.applyQuaternion(te), be.copy(e.target).add(m), e.object.lookAt(e.target), e.enableDamping === !0 ? (v.theta *= 1 - e.dampingFactor, v.phi *= 1 - e.dampingFactor, M.multiplyScalar(1 - e.dampingFactor)) : (v.set(0, 0, 0), M.set(0, 0, 0)), y = 1, w || ae.distanceToSquared(e.object.position) > h || 8 * (1 - pe.dot(e.object.quaternion)) > h ? (e.dispatchEvent(n), ae.copy(e.object.position), pe.copy(e.object.quaternion), w = !1, !0) : !1;
|
|
1972
1972
|
};
|
|
1973
1973
|
})(), this.dispose = function() {
|
|
1974
|
-
e.domElement.removeEventListener("contextmenu", Qe, !1), e.domElement.removeEventListener("mousedown",
|
|
1974
|
+
e.domElement.removeEventListener("contextmenu", Qe, !1), e.domElement.removeEventListener("mousedown", Me, !1), e.domElement.removeEventListener("wheel", Re, !1), e.domElement.removeEventListener("touchstart", Fe, !1), e.domElement.removeEventListener("touchend", Ze, !1), e.domElement.removeEventListener("touchmove", le, !1), document.removeEventListener("mousemove", ue, !1), document.removeEventListener("mouseup", ve, !1), e.domElement.removeEventListener("keydown", ze, !1);
|
|
1975
1975
|
};
|
|
1976
|
-
var e = this, n = { type: "change" }, t = { type: "start" }, r = { type: "end" },
|
|
1976
|
+
var e = this, n = { type: "change" }, t = { type: "start" }, r = { type: "end" }, s = {
|
|
1977
1977
|
NONE: -1,
|
|
1978
1978
|
ROTATE: 0,
|
|
1979
1979
|
DOLLY: 1,
|
|
@@ -1982,401 +1982,401 @@ var Tt = (function(h, s, e, n) {
|
|
|
1982
1982
|
TOUCH_PAN: 4,
|
|
1983
1983
|
TOUCH_DOLLY_PAN: 5,
|
|
1984
1984
|
TOUCH_DOLLY_ROTATE: 6
|
|
1985
|
-
},
|
|
1986
|
-
function
|
|
1985
|
+
}, i = s.NONE, h = 1e-6, c = new Ht(), v = new Ht(), y = 1, M = new ye(), w = !1, P = new Te(), S = new Te(), _ = new Te(), E = new Te(), b = new Te(), T = new Te(), f = new Te(), C = new Te(), x = new Te();
|
|
1986
|
+
function F() {
|
|
1987
1987
|
return 2 * Math.PI / 60 / 60 * e.autoRotateSpeed;
|
|
1988
1988
|
}
|
|
1989
|
-
function
|
|
1989
|
+
function V() {
|
|
1990
1990
|
return Math.pow(0.95, e.zoomSpeed);
|
|
1991
1991
|
}
|
|
1992
|
-
function
|
|
1993
|
-
|
|
1992
|
+
function Y(m) {
|
|
1993
|
+
v.theta -= m;
|
|
1994
1994
|
}
|
|
1995
|
-
function
|
|
1996
|
-
|
|
1995
|
+
function G(m) {
|
|
1996
|
+
v.phi -= m;
|
|
1997
1997
|
}
|
|
1998
|
-
var
|
|
1999
|
-
var
|
|
2000
|
-
return function(
|
|
2001
|
-
|
|
1998
|
+
var q = (function() {
|
|
1999
|
+
var m = new ye();
|
|
2000
|
+
return function(te, ae) {
|
|
2001
|
+
m.setFromMatrixColumn(ae, 0), m.multiplyScalar(-te), M.add(m);
|
|
2002
2002
|
};
|
|
2003
|
-
})(),
|
|
2004
|
-
var
|
|
2005
|
-
return function(
|
|
2006
|
-
e.screenSpacePanning === !0 ?
|
|
2003
|
+
})(), Q = (function() {
|
|
2004
|
+
var m = new ye();
|
|
2005
|
+
return function(te, ae) {
|
|
2006
|
+
e.screenSpacePanning === !0 ? m.setFromMatrixColumn(ae, 1) : (m.setFromMatrixColumn(ae, 0), m.crossVectors(e.object.up, m)), m.multiplyScalar(te), M.add(m);
|
|
2007
2007
|
};
|
|
2008
|
-
})(),
|
|
2009
|
-
var
|
|
2010
|
-
return function(
|
|
2008
|
+
})(), R = (function() {
|
|
2009
|
+
var m = new ye();
|
|
2010
|
+
return function(te, ae) {
|
|
2011
2011
|
var pe = e.domElement;
|
|
2012
2012
|
if (e.object.isPerspectiveCamera) {
|
|
2013
2013
|
var Ve = e.object.position;
|
|
2014
|
-
|
|
2015
|
-
var be =
|
|
2016
|
-
be *= Math.tan(e.object.fov / 2 * Math.PI / 180),
|
|
2017
|
-
} else e.object.isOrthographicCamera ? (
|
|
2014
|
+
m.copy(Ve).sub(e.target);
|
|
2015
|
+
var be = m.length();
|
|
2016
|
+
be *= Math.tan(e.object.fov / 2 * Math.PI / 180), q(2 * te * be / pe.clientHeight, e.object.matrix), Q(2 * ae * be / pe.clientHeight, e.object.matrix);
|
|
2017
|
+
} else e.object.isOrthographicCamera ? (q(te * (e.object.right - e.object.left) / e.object.zoom / pe.clientWidth, e.object.matrix), Q(ae * (e.object.top - e.object.bottom) / e.object.zoom / pe.clientHeight, e.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), e.enablePan = !1);
|
|
2018
2018
|
};
|
|
2019
2019
|
})();
|
|
2020
|
-
function
|
|
2021
|
-
e.object.isPerspectiveCamera ? y /=
|
|
2020
|
+
function H(m) {
|
|
2021
|
+
e.object.isPerspectiveCamera ? y /= m : e.object.isOrthographicCamera ? (e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom * m)), e.object.updateProjectionMatrix(), w = !0) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
|
|
2022
2022
|
}
|
|
2023
|
-
function
|
|
2024
|
-
e.object.isPerspectiveCamera ? y *=
|
|
2023
|
+
function L(m) {
|
|
2024
|
+
e.object.isPerspectiveCamera ? y *= m : e.object.isOrthographicCamera ? (e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / m)), e.object.updateProjectionMatrix(), w = !0) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
|
|
2025
2025
|
}
|
|
2026
|
-
function
|
|
2027
|
-
|
|
2026
|
+
function k(m) {
|
|
2027
|
+
P.set(m.clientX, m.clientY);
|
|
2028
2028
|
}
|
|
2029
|
-
function
|
|
2030
|
-
f.set(
|
|
2029
|
+
function I(m) {
|
|
2030
|
+
f.set(m.clientX, m.clientY);
|
|
2031
2031
|
}
|
|
2032
|
-
function
|
|
2033
|
-
E.set(
|
|
2032
|
+
function D(m) {
|
|
2033
|
+
E.set(m.clientX, m.clientY);
|
|
2034
2034
|
}
|
|
2035
|
-
function
|
|
2036
|
-
|
|
2037
|
-
var
|
|
2038
|
-
|
|
2035
|
+
function W(m) {
|
|
2036
|
+
S.set(m.clientX, m.clientY), _.subVectors(S, P).multiplyScalar(e.rotateSpeed);
|
|
2037
|
+
var j = e.domElement;
|
|
2038
|
+
Y(2 * Math.PI * _.x / j.clientHeight), G(2 * Math.PI * _.y / j.clientHeight), P.copy(S), e.update();
|
|
2039
2039
|
}
|
|
2040
|
-
function
|
|
2041
|
-
|
|
2040
|
+
function $(m) {
|
|
2041
|
+
C.set(m.clientX, m.clientY), x.subVectors(C, f), x.y > 0 ? H(V()) : x.y < 0 && L(V()), f.copy(C), e.update();
|
|
2042
2042
|
}
|
|
2043
|
-
function
|
|
2044
|
-
b.set(
|
|
2043
|
+
function Z(m) {
|
|
2044
|
+
b.set(m.clientX, m.clientY), T.subVectors(b, E).multiplyScalar(e.panSpeed), R(T.x, T.y), E.copy(b), e.update();
|
|
2045
2045
|
}
|
|
2046
|
-
function
|
|
2047
|
-
|
|
2046
|
+
function B(m) {
|
|
2047
|
+
m.deltaY < 0 ? L(V()) : m.deltaY > 0 && H(V()), e.update();
|
|
2048
2048
|
}
|
|
2049
|
-
function
|
|
2050
|
-
var
|
|
2051
|
-
switch (
|
|
2049
|
+
function ne(m) {
|
|
2050
|
+
var j = !1;
|
|
2051
|
+
switch (m.keyCode) {
|
|
2052
2052
|
case e.keys.UP:
|
|
2053
|
-
|
|
2053
|
+
R(0, e.keyPanSpeed), j = !0;
|
|
2054
2054
|
break;
|
|
2055
2055
|
case e.keys.BOTTOM:
|
|
2056
|
-
|
|
2056
|
+
R(0, -e.keyPanSpeed), j = !0;
|
|
2057
2057
|
break;
|
|
2058
2058
|
case e.keys.LEFT:
|
|
2059
|
-
|
|
2059
|
+
R(e.keyPanSpeed, 0), j = !0;
|
|
2060
2060
|
break;
|
|
2061
2061
|
case e.keys.RIGHT:
|
|
2062
|
-
|
|
2062
|
+
R(-e.keyPanSpeed, 0), j = !0;
|
|
2063
2063
|
break;
|
|
2064
2064
|
}
|
|
2065
|
-
|
|
2065
|
+
j && (m.preventDefault(), e.update());
|
|
2066
2066
|
}
|
|
2067
|
-
function
|
|
2068
|
-
if (
|
|
2069
|
-
|
|
2067
|
+
function X(m) {
|
|
2068
|
+
if (m.touches.length == 1)
|
|
2069
|
+
P.set(m.touches[0].pageX, m.touches[0].pageY);
|
|
2070
2070
|
else {
|
|
2071
|
-
var
|
|
2072
|
-
|
|
2071
|
+
var j = 0.5 * (m.touches[0].pageX + m.touches[1].pageX), te = 0.5 * (m.touches[0].pageY + m.touches[1].pageY);
|
|
2072
|
+
P.set(j, te);
|
|
2073
2073
|
}
|
|
2074
2074
|
}
|
|
2075
|
-
function
|
|
2076
|
-
if (
|
|
2077
|
-
E.set(
|
|
2075
|
+
function K(m) {
|
|
2076
|
+
if (m.touches.length == 1)
|
|
2077
|
+
E.set(m.touches[0].pageX, m.touches[0].pageY);
|
|
2078
2078
|
else {
|
|
2079
|
-
var
|
|
2080
|
-
E.set(
|
|
2079
|
+
var j = 0.5 * (m.touches[0].pageX + m.touches[1].pageX), te = 0.5 * (m.touches[0].pageY + m.touches[1].pageY);
|
|
2080
|
+
E.set(j, te);
|
|
2081
2081
|
}
|
|
2082
2082
|
}
|
|
2083
|
-
function
|
|
2084
|
-
var
|
|
2085
|
-
f.set(0,
|
|
2083
|
+
function z(m) {
|
|
2084
|
+
var j = m.touches[0].pageX - m.touches[1].pageX, te = m.touches[0].pageY - m.touches[1].pageY, ae = Math.sqrt(j * j + te * te);
|
|
2085
|
+
f.set(0, ae);
|
|
2086
2086
|
}
|
|
2087
|
-
function se(
|
|
2088
|
-
e.enableZoom &&
|
|
2087
|
+
function se(m) {
|
|
2088
|
+
e.enableZoom && z(m), e.enablePan && K(m);
|
|
2089
2089
|
}
|
|
2090
|
-
function
|
|
2091
|
-
e.enableZoom &&
|
|
2090
|
+
function J(m) {
|
|
2091
|
+
e.enableZoom && z(m), e.enableRotate && X(m);
|
|
2092
2092
|
}
|
|
2093
|
-
function
|
|
2094
|
-
if (
|
|
2095
|
-
|
|
2093
|
+
function ee(m) {
|
|
2094
|
+
if (m.touches.length == 1)
|
|
2095
|
+
S.set(m.touches[0].pageX, m.touches[0].pageY);
|
|
2096
2096
|
else {
|
|
2097
|
-
var
|
|
2098
|
-
|
|
2097
|
+
var j = 0.5 * (m.touches[0].pageX + m.touches[1].pageX), te = 0.5 * (m.touches[0].pageY + m.touches[1].pageY);
|
|
2098
|
+
S.set(j, te);
|
|
2099
2099
|
}
|
|
2100
|
-
|
|
2101
|
-
var
|
|
2102
|
-
|
|
2100
|
+
_.subVectors(S, P).multiplyScalar(e.rotateSpeed);
|
|
2101
|
+
var ae = e.domElement;
|
|
2102
|
+
Y(2 * Math.PI * _.x / ae.clientHeight), G(2 * Math.PI * _.y / ae.clientHeight), P.copy(S);
|
|
2103
2103
|
}
|
|
2104
|
-
function
|
|
2105
|
-
if (
|
|
2106
|
-
b.set(
|
|
2104
|
+
function _e(m) {
|
|
2105
|
+
if (m.touches.length == 1)
|
|
2106
|
+
b.set(m.touches[0].pageX, m.touches[0].pageY);
|
|
2107
2107
|
else {
|
|
2108
|
-
var
|
|
2109
|
-
b.set(
|
|
2108
|
+
var j = 0.5 * (m.touches[0].pageX + m.touches[1].pageX), te = 0.5 * (m.touches[0].pageY + m.touches[1].pageY);
|
|
2109
|
+
b.set(j, te);
|
|
2110
2110
|
}
|
|
2111
|
-
T.subVectors(b, E).multiplyScalar(e.panSpeed),
|
|
2111
|
+
T.subVectors(b, E).multiplyScalar(e.panSpeed), R(T.x, T.y), E.copy(b);
|
|
2112
2112
|
}
|
|
2113
|
-
function
|
|
2114
|
-
var
|
|
2115
|
-
|
|
2113
|
+
function Pe(m) {
|
|
2114
|
+
var j = m.touches[0].pageX - m.touches[1].pageX, te = m.touches[0].pageY - m.touches[1].pageY, ae = Math.sqrt(j * j + te * te);
|
|
2115
|
+
C.set(0, ae), x.set(0, Math.pow(C.y / f.y, e.zoomSpeed)), H(x.y), f.copy(C);
|
|
2116
2116
|
}
|
|
2117
|
-
function
|
|
2118
|
-
e.enableZoom &&
|
|
2117
|
+
function Oe(m) {
|
|
2118
|
+
e.enableZoom && Pe(m), e.enablePan && _e(m);
|
|
2119
2119
|
}
|
|
2120
|
-
function
|
|
2121
|
-
e.enableZoom &&
|
|
2120
|
+
function ke(m) {
|
|
2121
|
+
e.enableZoom && Pe(m), e.enableRotate && ee(m);
|
|
2122
2122
|
}
|
|
2123
|
-
function
|
|
2123
|
+
function Me(m) {
|
|
2124
2124
|
if (e.enabled !== !1) {
|
|
2125
|
-
|
|
2126
|
-
var
|
|
2127
|
-
switch (
|
|
2125
|
+
m.preventDefault(), e.domElement.focus ? e.domElement.focus() : window.focus();
|
|
2126
|
+
var j;
|
|
2127
|
+
switch (m.button) {
|
|
2128
2128
|
case 0:
|
|
2129
|
-
|
|
2129
|
+
j = e.mouseButtons.LEFT;
|
|
2130
2130
|
break;
|
|
2131
2131
|
case 1:
|
|
2132
|
-
|
|
2132
|
+
j = e.mouseButtons.MIDDLE;
|
|
2133
2133
|
break;
|
|
2134
2134
|
case 2:
|
|
2135
|
-
|
|
2135
|
+
j = e.mouseButtons.RIGHT;
|
|
2136
2136
|
break;
|
|
2137
2137
|
default:
|
|
2138
|
-
|
|
2138
|
+
j = -1;
|
|
2139
2139
|
}
|
|
2140
|
-
switch (
|
|
2141
|
-
case
|
|
2140
|
+
switch (j) {
|
|
2141
|
+
case xe.DOLLY:
|
|
2142
2142
|
if (e.enableZoom === !1) return;
|
|
2143
|
-
|
|
2143
|
+
I(m), i = s.DOLLY;
|
|
2144
2144
|
break;
|
|
2145
|
-
case
|
|
2146
|
-
if (
|
|
2145
|
+
case xe.ROTATE:
|
|
2146
|
+
if (m.ctrlKey || m.metaKey || m.shiftKey) {
|
|
2147
2147
|
if (e.enablePan === !1) return;
|
|
2148
|
-
|
|
2148
|
+
D(m), i = s.PAN;
|
|
2149
2149
|
} else {
|
|
2150
2150
|
if (e.enableRotate === !1) return;
|
|
2151
|
-
|
|
2151
|
+
k(m), i = s.ROTATE;
|
|
2152
2152
|
}
|
|
2153
2153
|
break;
|
|
2154
|
-
case
|
|
2155
|
-
if (
|
|
2154
|
+
case xe.PAN:
|
|
2155
|
+
if (m.ctrlKey || m.metaKey || m.shiftKey) {
|
|
2156
2156
|
if (e.enableRotate === !1) return;
|
|
2157
|
-
|
|
2157
|
+
k(m), i = s.ROTATE;
|
|
2158
2158
|
} else {
|
|
2159
2159
|
if (e.enablePan === !1) return;
|
|
2160
|
-
|
|
2160
|
+
D(m), i = s.PAN;
|
|
2161
2161
|
}
|
|
2162
2162
|
break;
|
|
2163
2163
|
default:
|
|
2164
|
-
|
|
2164
|
+
i = s.NONE;
|
|
2165
2165
|
}
|
|
2166
|
-
|
|
2166
|
+
i !== s.NONE && (document.addEventListener("mousemove", ue, !1), document.addEventListener("mouseup", ve, !1), e.dispatchEvent(t));
|
|
2167
2167
|
}
|
|
2168
2168
|
}
|
|
2169
|
-
function ue(
|
|
2169
|
+
function ue(m) {
|
|
2170
2170
|
if (e.enabled !== !1)
|
|
2171
|
-
switch (
|
|
2172
|
-
case
|
|
2171
|
+
switch (m.preventDefault(), i) {
|
|
2172
|
+
case s.ROTATE:
|
|
2173
2173
|
if (e.enableRotate === !1) return;
|
|
2174
|
-
|
|
2174
|
+
W(m);
|
|
2175
2175
|
break;
|
|
2176
|
-
case
|
|
2176
|
+
case s.DOLLY:
|
|
2177
2177
|
if (e.enableZoom === !1) return;
|
|
2178
|
-
|
|
2178
|
+
$(m);
|
|
2179
2179
|
break;
|
|
2180
|
-
case
|
|
2180
|
+
case s.PAN:
|
|
2181
2181
|
if (e.enablePan === !1) return;
|
|
2182
|
-
|
|
2182
|
+
Z(m);
|
|
2183
2183
|
break;
|
|
2184
2184
|
}
|
|
2185
2185
|
}
|
|
2186
|
-
function
|
|
2187
|
-
e.enabled !== !1 && (document.removeEventListener("mousemove", ue, !1), document.removeEventListener("mouseup",
|
|
2186
|
+
function ve(m) {
|
|
2187
|
+
e.enabled !== !1 && (document.removeEventListener("mousemove", ue, !1), document.removeEventListener("mouseup", ve, !1), e.dispatchEvent(r), i = s.NONE);
|
|
2188
2188
|
}
|
|
2189
|
-
function
|
|
2190
|
-
e.enabled === !1 || e.enableZoom === !1 ||
|
|
2189
|
+
function Re(m) {
|
|
2190
|
+
e.enabled === !1 || e.enableZoom === !1 || i !== s.NONE && i !== s.ROTATE || (m.preventDefault(), m.stopPropagation(), e.dispatchEvent(t), B(m), e.dispatchEvent(r));
|
|
2191
2191
|
}
|
|
2192
|
-
function
|
|
2193
|
-
e.enabled === !1 || e.enableKeys === !1 || e.enablePan === !1 ||
|
|
2192
|
+
function ze(m) {
|
|
2193
|
+
e.enabled === !1 || e.enableKeys === !1 || e.enablePan === !1 || ne(m);
|
|
2194
2194
|
}
|
|
2195
|
-
function Fe(
|
|
2195
|
+
function Fe(m) {
|
|
2196
2196
|
if (e.enabled !== !1) {
|
|
2197
|
-
switch (
|
|
2197
|
+
switch (m.preventDefault(), m.touches.length) {
|
|
2198
2198
|
case 1:
|
|
2199
2199
|
switch (e.touches.ONE) {
|
|
2200
|
-
case
|
|
2200
|
+
case Ce.ROTATE:
|
|
2201
2201
|
if (e.enableRotate === !1) return;
|
|
2202
|
-
|
|
2202
|
+
X(m), i = s.TOUCH_ROTATE;
|
|
2203
2203
|
break;
|
|
2204
|
-
case
|
|
2204
|
+
case Ce.PAN:
|
|
2205
2205
|
if (e.enablePan === !1) return;
|
|
2206
|
-
|
|
2206
|
+
K(m), i = s.TOUCH_PAN;
|
|
2207
2207
|
break;
|
|
2208
2208
|
default:
|
|
2209
|
-
|
|
2209
|
+
i = s.NONE;
|
|
2210
2210
|
}
|
|
2211
2211
|
break;
|
|
2212
2212
|
case 2:
|
|
2213
2213
|
switch (e.touches.TWO) {
|
|
2214
|
-
case
|
|
2214
|
+
case Ce.DOLLY_PAN:
|
|
2215
2215
|
if (e.enableZoom === !1 && e.enablePan === !1) return;
|
|
2216
|
-
se(
|
|
2216
|
+
se(m), i = s.TOUCH_DOLLY_PAN;
|
|
2217
2217
|
break;
|
|
2218
|
-
case
|
|
2218
|
+
case Ce.DOLLY_ROTATE:
|
|
2219
2219
|
if (e.enableZoom === !1 && e.enableRotate === !1) return;
|
|
2220
|
-
|
|
2220
|
+
J(m), i = s.TOUCH_DOLLY_ROTATE;
|
|
2221
2221
|
break;
|
|
2222
2222
|
default:
|
|
2223
|
-
|
|
2223
|
+
i = s.NONE;
|
|
2224
2224
|
}
|
|
2225
2225
|
break;
|
|
2226
2226
|
default:
|
|
2227
|
-
|
|
2227
|
+
i = s.NONE;
|
|
2228
2228
|
}
|
|
2229
|
-
|
|
2229
|
+
i !== s.NONE && e.dispatchEvent(t);
|
|
2230
2230
|
}
|
|
2231
2231
|
}
|
|
2232
|
-
function le(
|
|
2232
|
+
function le(m) {
|
|
2233
2233
|
if (e.enabled !== !1)
|
|
2234
|
-
switch (
|
|
2235
|
-
case
|
|
2234
|
+
switch (m.preventDefault(), m.stopPropagation(), i) {
|
|
2235
|
+
case s.TOUCH_ROTATE:
|
|
2236
2236
|
if (e.enableRotate === !1) return;
|
|
2237
|
-
|
|
2237
|
+
ee(m), e.update();
|
|
2238
2238
|
break;
|
|
2239
|
-
case
|
|
2239
|
+
case s.TOUCH_PAN:
|
|
2240
2240
|
if (e.enablePan === !1) return;
|
|
2241
|
-
|
|
2241
|
+
_e(m), e.update();
|
|
2242
2242
|
break;
|
|
2243
|
-
case
|
|
2243
|
+
case s.TOUCH_DOLLY_PAN:
|
|
2244
2244
|
if (e.enableZoom === !1 && e.enablePan === !1) return;
|
|
2245
|
-
|
|
2245
|
+
Oe(m), e.update();
|
|
2246
2246
|
break;
|
|
2247
|
-
case
|
|
2247
|
+
case s.TOUCH_DOLLY_ROTATE:
|
|
2248
2248
|
if (e.enableZoom === !1 && e.enableRotate === !1) return;
|
|
2249
|
-
|
|
2249
|
+
ke(m), e.update();
|
|
2250
2250
|
break;
|
|
2251
2251
|
default:
|
|
2252
|
-
|
|
2252
|
+
i = s.NONE;
|
|
2253
2253
|
}
|
|
2254
2254
|
}
|
|
2255
|
-
function Ze(
|
|
2256
|
-
e.enabled !== !1 && (e.dispatchEvent(r),
|
|
2255
|
+
function Ze(m) {
|
|
2256
|
+
e.enabled !== !1 && (e.dispatchEvent(r), i = s.NONE);
|
|
2257
2257
|
}
|
|
2258
|
-
function Qe(
|
|
2259
|
-
e.enabled !== !1 &&
|
|
2258
|
+
function Qe(m) {
|
|
2259
|
+
e.enabled !== !1 && m.preventDefault();
|
|
2260
2260
|
}
|
|
2261
|
-
e.domElement.addEventListener("contextmenu", Qe, !1), e.domElement.addEventListener("mousedown",
|
|
2261
|
+
e.domElement.addEventListener("contextmenu", Qe, !1), e.domElement.addEventListener("mousedown", Me, !1), e.domElement.addEventListener("wheel", Re, !1), e.domElement.addEventListener("touchstart", Fe, !1), e.domElement.addEventListener("touchend", Ze, !1), e.domElement.addEventListener("touchmove", le, !1), e.domElement.addEventListener("keydown", ze, !1), e.domElement.tabIndex === -1 && (e.domElement.tabIndex = 0), this.update();
|
|
2262
2262
|
};
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
var
|
|
2266
|
-
|
|
2263
|
+
qe.prototype = Object.create(Jt.prototype);
|
|
2264
|
+
qe.prototype.constructor = qe;
|
|
2265
|
+
var Ct = function(d, l) {
|
|
2266
|
+
qe.call(this, d, l), this.mouseButtons.LEFT = xe.PAN, this.mouseButtons.RIGHT = xe.ROTATE, this.touches.ONE = Ce.PAN, this.touches.TWO = Ce.DOLLY_ROTATE;
|
|
2267
2267
|
};
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
var
|
|
2271
|
-
$t.call(this), this.element =
|
|
2272
|
-
this.traverse(function(
|
|
2273
|
-
|
|
2268
|
+
Ct.prototype = Object.create(Jt.prototype);
|
|
2269
|
+
Ct.prototype.constructor = Ct;
|
|
2270
|
+
var Ae = function(d) {
|
|
2271
|
+
$t.call(this), this.element = d, this.element.style.position = "absolute", this.element.style.pointerEvents = "auto", this.addEventListener("removed", function() {
|
|
2272
|
+
this.traverse(function(l) {
|
|
2273
|
+
l.element instanceof Element && l.element.parentNode !== null && l.element.parentNode.removeChild(l.element);
|
|
2274
2274
|
});
|
|
2275
2275
|
});
|
|
2276
2276
|
};
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
var ct = function(
|
|
2280
|
-
|
|
2277
|
+
Ae.prototype = Object.create($t.prototype);
|
|
2278
|
+
Ae.prototype.constructor = Ae;
|
|
2279
|
+
var ct = function(d) {
|
|
2280
|
+
Ae.call(this, d);
|
|
2281
2281
|
};
|
|
2282
|
-
ct.prototype = Object.create(
|
|
2282
|
+
ct.prototype = Object.create(Ae.prototype);
|
|
2283
2283
|
ct.prototype.constructor = ct;
|
|
2284
|
-
var
|
|
2285
|
-
var
|
|
2284
|
+
var Vn = function() {
|
|
2285
|
+
var d = this, l, e, n, t, r = new xn(), s = {
|
|
2286
2286
|
camera: { fov: 0, style: "" },
|
|
2287
2287
|
objects: /* @__PURE__ */ new WeakMap()
|
|
2288
|
-
},
|
|
2289
|
-
|
|
2290
|
-
var
|
|
2291
|
-
|
|
2288
|
+
}, i = document.createElement("div");
|
|
2289
|
+
i.style.overflow = "hidden", this.domElement = i;
|
|
2290
|
+
var h = document.createElement("div");
|
|
2291
|
+
h.style.WebkitTransformStyle = "preserve-3d", h.style.transformStyle = "preserve-3d", h.style.pointerEvents = "none", i.appendChild(h);
|
|
2292
2292
|
var c = /Trident/i.test(navigator.userAgent);
|
|
2293
2293
|
this.getSize = function() {
|
|
2294
2294
|
return {
|
|
2295
|
-
width:
|
|
2295
|
+
width: l,
|
|
2296
2296
|
height: e
|
|
2297
2297
|
};
|
|
2298
2298
|
}, this.setSize = function(E, b) {
|
|
2299
|
-
|
|
2299
|
+
l = E, e = b, n = l / 2, t = e / 2, i.style.width = E + "px", i.style.height = b + "px", h.style.width = E + "px", h.style.height = b + "px";
|
|
2300
2300
|
};
|
|
2301
|
-
function
|
|
2301
|
+
function v(E) {
|
|
2302
2302
|
return Math.abs(E) < 1e-10 ? 0 : E;
|
|
2303
2303
|
}
|
|
2304
2304
|
function y(E) {
|
|
2305
2305
|
var b = E.elements;
|
|
2306
|
-
return "matrix3d(" +
|
|
2306
|
+
return "matrix3d(" + v(b[0]) + "," + v(-b[1]) + "," + v(b[2]) + "," + v(b[3]) + "," + v(b[4]) + "," + v(-b[5]) + "," + v(b[6]) + "," + v(b[7]) + "," + v(b[8]) + "," + v(-b[9]) + "," + v(b[10]) + "," + v(b[11]) + "," + v(b[12]) + "," + v(-b[13]) + "," + v(b[14]) + "," + v(b[15]) + ")";
|
|
2307
2307
|
}
|
|
2308
2308
|
function M(E, b) {
|
|
2309
|
-
var T = E.elements, f = "matrix3d(" +
|
|
2309
|
+
var T = E.elements, f = "matrix3d(" + v(T[0]) + "," + v(T[1]) + "," + v(T[2]) + "," + v(T[3]) + "," + v(-T[4]) + "," + v(-T[5]) + "," + v(-T[6]) + "," + v(-T[7]) + "," + v(T[8]) + "," + v(T[9]) + "," + v(T[10]) + "," + v(T[11]) + "," + v(T[12]) + "," + v(T[13]) + "," + v(T[14]) + "," + v(T[15]) + ")";
|
|
2310
2310
|
return c ? "translate(-50%,-50%)translate(" + n + "px," + t + "px)" + b + f : "translate(-50%,-50%)" + f;
|
|
2311
2311
|
}
|
|
2312
2312
|
function w(E, b, T, f) {
|
|
2313
|
-
if (E instanceof
|
|
2314
|
-
E.onBeforeRender(
|
|
2315
|
-
var
|
|
2316
|
-
E instanceof ct ? (r.copy(T.matrixWorldInverse), r.transpose(), r.copyPosition(E.matrixWorld), r.scale(E.scale), r.elements[3] = 0, r.elements[7] = 0, r.elements[11] = 0, r.elements[15] = 1,
|
|
2317
|
-
var
|
|
2318
|
-
if (
|
|
2319
|
-
|
|
2320
|
-
var
|
|
2321
|
-
c && (
|
|
2313
|
+
if (E instanceof Ae) {
|
|
2314
|
+
E.onBeforeRender(d, b, T);
|
|
2315
|
+
var C;
|
|
2316
|
+
E instanceof ct ? (r.copy(T.matrixWorldInverse), r.transpose(), r.copyPosition(E.matrixWorld), r.scale(E.scale), r.elements[3] = 0, r.elements[7] = 0, r.elements[11] = 0, r.elements[15] = 1, C = M(r, f)) : C = M(E.matrixWorld, f);
|
|
2317
|
+
var x = E.element, F = s.objects.get(E);
|
|
2318
|
+
if (F === void 0 || F.style !== C) {
|
|
2319
|
+
x.style.WebkitTransform = C, x.style.transform = C;
|
|
2320
|
+
var V = { style: C };
|
|
2321
|
+
c && (V.distanceToCameraSquared = P(T, E)), s.objects.set(E, V);
|
|
2322
2322
|
}
|
|
2323
|
-
|
|
2323
|
+
x.style.display = E.visible ? "" : "none", x.parentNode !== h && h.appendChild(x), E.onAfterRender(d, b, T);
|
|
2324
2324
|
}
|
|
2325
|
-
for (var
|
|
2326
|
-
w(E.children[
|
|
2325
|
+
for (var Y = 0, G = E.children.length; Y < G; Y++)
|
|
2326
|
+
w(E.children[Y], b, T, f);
|
|
2327
2327
|
}
|
|
2328
|
-
var
|
|
2328
|
+
var P = (function() {
|
|
2329
2329
|
var E = new ye(), b = new ye();
|
|
2330
2330
|
return function(T, f) {
|
|
2331
2331
|
return E.setFromMatrixPosition(T.matrixWorld), b.setFromMatrixPosition(f.matrixWorld), E.distanceToSquared(b);
|
|
2332
2332
|
};
|
|
2333
2333
|
})();
|
|
2334
|
-
function
|
|
2334
|
+
function S(E) {
|
|
2335
2335
|
var b = [];
|
|
2336
2336
|
return E.traverse(function(T) {
|
|
2337
|
-
T instanceof
|
|
2337
|
+
T instanceof Ae && b.push(T);
|
|
2338
2338
|
}), b;
|
|
2339
2339
|
}
|
|
2340
|
-
function
|
|
2341
|
-
for (var b =
|
|
2342
|
-
var
|
|
2343
|
-
return
|
|
2344
|
-
}), T = b.length, f = 0,
|
|
2340
|
+
function _(E) {
|
|
2341
|
+
for (var b = S(E).sort(function(x, F) {
|
|
2342
|
+
var V = s.objects.get(x).distanceToCameraSquared, Y = s.objects.get(F).distanceToCameraSquared;
|
|
2343
|
+
return V - Y;
|
|
2344
|
+
}), T = b.length, f = 0, C = b.length; f < C; f++)
|
|
2345
2345
|
b[f].element.style.zIndex = T - f;
|
|
2346
2346
|
}
|
|
2347
2347
|
this.render = function(E, b) {
|
|
2348
2348
|
var T = b.projectionMatrix.elements[5] * t;
|
|
2349
|
-
if (
|
|
2350
|
-
var f = -(b.right + b.left) / 2,
|
|
2351
|
-
var
|
|
2352
|
-
|
|
2349
|
+
if (s.camera.fov !== T && (b.isPerspectiveCamera ? (i.style.WebkitPerspective = T + "px", i.style.perspective = T + "px") : (i.style.WebkitPerspective = "", i.style.perspective = ""), s.camera.fov = T), E.autoUpdate === !0 && E.updateMatrixWorld(), b.parent === null && b.updateMatrixWorld(), b.isOrthographicCamera)
|
|
2350
|
+
var f = -(b.right + b.left) / 2, C = (b.top + b.bottom) / 2;
|
|
2351
|
+
var x = b.isOrthographicCamera ? "scale(" + T + ")translate(" + v(f) + "px," + v(C) + "px)" + y(b.matrixWorldInverse) : "translateZ(" + T + "px)" + y(b.matrixWorldInverse), F = x + "translate(" + n + "px," + t + "px)";
|
|
2352
|
+
s.camera.style !== F && !c && (h.style.WebkitTransform = F, h.style.transform = F, s.camera.style = F), w(E, E, b, x), c && _(E);
|
|
2353
2353
|
};
|
|
2354
2354
|
};
|
|
2355
|
-
function Zt(
|
|
2356
|
-
var n =
|
|
2357
|
-
return new p.Vector2((
|
|
2355
|
+
function Zt(d, l, e) {
|
|
2356
|
+
var n = l.getBoundingClientRect(), t = n.top, r = n.left, s = n.width, i = n.height;
|
|
2357
|
+
return new p.Vector2((d.x - r) / s * 2 - 1, -(d.y - t) / i * 2 + 1);
|
|
2358
2358
|
}
|
|
2359
2359
|
var jn = (
|
|
2360
2360
|
/** @class */
|
|
2361
|
-
(function(
|
|
2362
|
-
he(
|
|
2363
|
-
function
|
|
2364
|
-
var
|
|
2365
|
-
|
|
2366
|
-
var
|
|
2367
|
-
|
|
2361
|
+
(function(d) {
|
|
2362
|
+
he(l, d);
|
|
2363
|
+
function l(e, n, t, r, s) {
|
|
2364
|
+
var i = d.call(this) || this;
|
|
2365
|
+
i.type = "RoundedBoxGeometry", s = isNaN(s) ? 1 : Math.max(1, Math.floor(s)), e = isNaN(e) ? 1 : e, n = isNaN(n) ? 1 : n, t = isNaN(t) ? 1 : t, r = isNaN(r) ? 0.15 : r, r = Math.min(r, Math.min(e, Math.min(n, Math.min(t))) / 2);
|
|
2366
|
+
var h = e / 2 - r, c = n / 2 - r, v = t / 2 - r;
|
|
2367
|
+
i.parameters = {
|
|
2368
2368
|
width: e,
|
|
2369
2369
|
height: n,
|
|
2370
2370
|
depth: t,
|
|
2371
2371
|
radius: r,
|
|
2372
|
-
radiusSegments:
|
|
2372
|
+
radiusSegments: s
|
|
2373
2373
|
};
|
|
2374
|
-
var y =
|
|
2374
|
+
var y = s + 1, M = y * s + 1 << 3, w = new p.BufferAttribute(new Float32Array(M * 3), 3), P = new p.BufferAttribute(new Float32Array(M * 3), 3), S = [], _ = [];
|
|
2375
2375
|
new p.Vector3();
|
|
2376
|
-
var E = new p.Vector3(), b = [], T = [], f = [],
|
|
2377
|
-
|
|
2378
|
-
function
|
|
2379
|
-
for (var
|
|
2376
|
+
var E = new p.Vector3(), b = [], T = [], f = [], C = y * s, x = y * s + 1;
|
|
2377
|
+
F(), Y(), V(), G(), Q(), q();
|
|
2378
|
+
function F() {
|
|
2379
|
+
for (var L = [
|
|
2380
2380
|
new p.Vector3(1, 1, 1),
|
|
2381
2381
|
new p.Vector3(1, 1, -1),
|
|
2382
2382
|
new p.Vector3(-1, 1, -1),
|
|
@@ -2385,37 +2385,37 @@ var jn = (
|
|
|
2385
2385
|
new p.Vector3(1, -1, -1),
|
|
2386
2386
|
new p.Vector3(-1, -1, -1),
|
|
2387
2387
|
new p.Vector3(-1, -1, 1)
|
|
2388
|
-
],
|
|
2389
|
-
|
|
2390
|
-
for (var
|
|
2391
|
-
var
|
|
2392
|
-
if (
|
|
2388
|
+
], k = 0; k < 8; k++)
|
|
2389
|
+
S.push([]), _.push([]);
|
|
2390
|
+
for (var I = Math.PI / 2, D = new p.Vector3(h, c, v), W = 0; W <= s; W++) {
|
|
2391
|
+
var $ = W / s, Z = $ * I, B = Math.cos(Z), ne = Math.sin(Z);
|
|
2392
|
+
if (W == s) {
|
|
2393
2393
|
E.set(0, 1, 0);
|
|
2394
|
-
var
|
|
2395
|
-
|
|
2396
|
-
var
|
|
2397
|
-
|
|
2394
|
+
var X = E.clone().multiplyScalar(r).add(D);
|
|
2395
|
+
S[0].push(X), b.push(X);
|
|
2396
|
+
var K = E.clone();
|
|
2397
|
+
_[0].push(K), T.push(K);
|
|
2398
2398
|
continue;
|
|
2399
2399
|
}
|
|
2400
|
-
for (var
|
|
2401
|
-
var se =
|
|
2402
|
-
E.x =
|
|
2403
|
-
var
|
|
2404
|
-
|
|
2405
|
-
var
|
|
2406
|
-
|
|
2400
|
+
for (var z = 0; z <= s; z++) {
|
|
2401
|
+
var se = z / s, J = se * I;
|
|
2402
|
+
E.x = B * Math.cos(J), E.y = ne, E.z = B * Math.sin(J);
|
|
2403
|
+
var X = E.clone().multiplyScalar(r).add(D);
|
|
2404
|
+
S[0].push(X), b.push(X);
|
|
2405
|
+
var K = E.clone().normalize();
|
|
2406
|
+
_[0].push(K), T.push(K);
|
|
2407
2407
|
}
|
|
2408
2408
|
}
|
|
2409
|
-
for (var
|
|
2410
|
-
for (var
|
|
2411
|
-
var
|
|
2412
|
-
|
|
2413
|
-
var
|
|
2414
|
-
|
|
2409
|
+
for (var ee = 1; ee < 8; ee++)
|
|
2410
|
+
for (var k = 0; k < S[0].length; k++) {
|
|
2411
|
+
var X = S[0][k].clone().multiply(L[ee]);
|
|
2412
|
+
S[ee].push(X), b.push(X);
|
|
2413
|
+
var K = _[0][k].clone().multiply(L[ee]);
|
|
2414
|
+
_[ee].push(K), T.push(K);
|
|
2415
2415
|
}
|
|
2416
2416
|
}
|
|
2417
|
-
function
|
|
2418
|
-
for (var
|
|
2417
|
+
function V() {
|
|
2418
|
+
for (var L = [
|
|
2419
2419
|
!0,
|
|
2420
2420
|
!1,
|
|
2421
2421
|
!0,
|
|
@@ -2424,136 +2424,136 @@ var jn = (
|
|
|
2424
2424
|
!0,
|
|
2425
2425
|
!1,
|
|
2426
2426
|
!0
|
|
2427
|
-
],
|
|
2428
|
-
for (var
|
|
2429
|
-
for (var
|
|
2430
|
-
var
|
|
2431
|
-
I
|
|
2427
|
+
], k = y * (s - 1), I = 0; I < 8; I++) {
|
|
2428
|
+
for (var D = x * I, W = 0; W < s - 1; W++)
|
|
2429
|
+
for (var $ = W * y, Z = (W + 1) * y, B = 0; B < s; B++) {
|
|
2430
|
+
var ne = B + 1, X = D + $ + B, K = D + $ + ne, z = D + Z + B, se = D + Z + ne;
|
|
2431
|
+
L[I] ? (f.push(X), f.push(z), f.push(K), f.push(K), f.push(z), f.push(se)) : (f.push(X), f.push(K), f.push(z), f.push(K), f.push(se), f.push(z));
|
|
2432
2432
|
}
|
|
2433
|
-
for (var
|
|
2434
|
-
var
|
|
2435
|
-
I
|
|
2433
|
+
for (var B = 0; B < s; B++) {
|
|
2434
|
+
var X = D + k + B, K = D + k + B + 1, z = D + C;
|
|
2435
|
+
L[I] ? (f.push(X), f.push(z), f.push(K)) : (f.push(X), f.push(K), f.push(z));
|
|
2436
2436
|
}
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
|
-
function
|
|
2440
|
-
var
|
|
2441
|
-
f.push(
|
|
2439
|
+
function Y() {
|
|
2440
|
+
var L = C, k = C + x, I = C + x * 2, D = C + x * 3;
|
|
2441
|
+
f.push(L), f.push(k), f.push(I), f.push(L), f.push(I), f.push(D), L = C + x * 4, k = C + x * 5, I = C + x * 6, D = C + x * 7, f.push(L), f.push(I), f.push(k), f.push(L), f.push(D), f.push(I), L = 0, k = x, I = x * 4, D = x * 5, f.push(L), f.push(I), f.push(k), f.push(k), f.push(I), f.push(D), L = x * 2, k = x * 3, I = x * 6, D = x * 7, f.push(L), f.push(I), f.push(k), f.push(k), f.push(I), f.push(D), L = s, k = s + x * 3, I = s + x * 4, D = s + x * 7, f.push(L), f.push(k), f.push(I), f.push(k), f.push(D), f.push(I), L = s + x, k = s + x * 2, I = s + x * 5, D = s + x * 6, f.push(L), f.push(I), f.push(k), f.push(k), f.push(I), f.push(D);
|
|
2442
2442
|
}
|
|
2443
|
-
function
|
|
2444
|
-
for (var
|
|
2445
|
-
for (var
|
|
2446
|
-
var
|
|
2447
|
-
|
|
2443
|
+
function G() {
|
|
2444
|
+
for (var L = 0; L < 4; L++)
|
|
2445
|
+
for (var k = L * x, I = 4 * x + k, D = (L & 1) === 1, W = 0; W < s; W++) {
|
|
2446
|
+
var $ = W + 1, Z = k + W, B = k + $, ne = I + W, X = I + $;
|
|
2447
|
+
D ? (f.push(Z), f.push(ne), f.push(B), f.push(B), f.push(ne), f.push(X)) : (f.push(Z), f.push(B), f.push(ne), f.push(B), f.push(X), f.push(ne));
|
|
2448
2448
|
}
|
|
2449
2449
|
}
|
|
2450
|
-
function
|
|
2451
|
-
for (var
|
|
2452
|
-
for (var
|
|
2453
|
-
var
|
|
2454
|
-
|
|
2450
|
+
function q() {
|
|
2451
|
+
for (var L = [0, 2, 4, 6], k = [1, 3, 5, 7], I = 0; I < 4; I++)
|
|
2452
|
+
for (var D = x * L[I], W = x * k[I], $ = 1 >= I, Z = 0; Z < s; Z++) {
|
|
2453
|
+
var B = Z * y, ne = (Z + 1) * y, X = D + B, K = D + ne, z = W + B, se = W + ne;
|
|
2454
|
+
$ ? (f.push(X), f.push(z), f.push(K), f.push(K), f.push(z), f.push(se)) : (f.push(X), f.push(K), f.push(z), f.push(K), f.push(se), f.push(z));
|
|
2455
2455
|
}
|
|
2456
2456
|
}
|
|
2457
|
-
function
|
|
2458
|
-
for (var
|
|
2459
|
-
for (var
|
|
2460
|
-
var
|
|
2461
|
-
|
|
2457
|
+
function Q() {
|
|
2458
|
+
for (var L = s - 1, k = [0, 1, 4, 5], I = [3, 2, 7, 6], D = [0, 1, 1, 0], W = 0; W < 4; W++)
|
|
2459
|
+
for (var $ = k[W] * x, Z = I[W] * x, B = 0; B <= L; B++) {
|
|
2460
|
+
var ne = $ + s + B * y, X = $ + (B != L ? s + (B + 1) * y : x - 1), K = Z + s + B * y, z = Z + (B != L ? s + (B + 1) * y : x - 1);
|
|
2461
|
+
D[W] ? (f.push(ne), f.push(K), f.push(X), f.push(X), f.push(K), f.push(z)) : (f.push(ne), f.push(X), f.push(K), f.push(X), f.push(z), f.push(K));
|
|
2462
2462
|
}
|
|
2463
2463
|
}
|
|
2464
|
-
for (var
|
|
2465
|
-
w.setXYZ(
|
|
2466
|
-
return
|
|
2464
|
+
for (var R = 0, H = 0; H < b.length; H++)
|
|
2465
|
+
w.setXYZ(R, b[H].x, b[H].y, b[H].z), P.setXYZ(R, T[H].x, T[H].y, T[H].z), R++;
|
|
2466
|
+
return i.setIndex(new p.BufferAttribute(new Uint16Array(f), 1)), i.setAttribute("position", w), i.setAttribute("normal", P), i;
|
|
2467
2467
|
}
|
|
2468
|
-
return
|
|
2468
|
+
return l;
|
|
2469
2469
|
})(p.BufferGeometry)
|
|
2470
2470
|
);
|
|
2471
|
-
function
|
|
2472
|
-
return typeof
|
|
2471
|
+
function We(d, l) {
|
|
2472
|
+
return typeof d != "number" || typeof l != "number" ? !1 : Math.abs(d - l) < 1e-3;
|
|
2473
2473
|
}
|
|
2474
|
-
function He(
|
|
2474
|
+
function He(d, l, e, n) {
|
|
2475
2475
|
n === void 0 && (n = function(r) {
|
|
2476
2476
|
return r;
|
|
2477
2477
|
});
|
|
2478
2478
|
var t = n(e);
|
|
2479
|
-
return
|
|
2479
|
+
return d * (1 - t) + l * t;
|
|
2480
2480
|
}
|
|
2481
2481
|
var oe = Number((Math.PI / 2).toFixed(5));
|
|
2482
|
-
function Gn(
|
|
2482
|
+
function Gn(d, l, e) {
|
|
2483
2483
|
var n = new p.Shape();
|
|
2484
|
-
return n.moveTo(e, 0), n.lineTo(
|
|
2484
|
+
return n.moveTo(e, 0), n.lineTo(d - e, 0), n.absarc(d - e, e, e, -oe, 0, !1), n.lineTo(d, l - e), n.absarc(d - e, l - e, e, 0, oe, !1), n.lineTo(e, l), n.absarc(e, l - e, e, oe, Math.PI, !1), n.lineTo(0, e), n.absarc(e, e, e, Math.PI, Math.PI * 1.5, !1), n;
|
|
2485
2485
|
}
|
|
2486
|
-
var
|
|
2487
|
-
var
|
|
2488
|
-
|
|
2489
|
-
var e = new
|
|
2490
|
-
return e.name =
|
|
2491
|
-
}, ot = function(
|
|
2492
|
-
var
|
|
2486
|
+
var Ke = function(d) {
|
|
2487
|
+
var l = document.createElement("div");
|
|
2488
|
+
l.innerText = d;
|
|
2489
|
+
var e = new Ae(l);
|
|
2490
|
+
return e.name = d, e.scale.set(0.3, 0.3, 0.3), l.style.pointerEvents = "none", l.style.backfaceVisibility = "hidden", e;
|
|
2491
|
+
}, ot = function(d) {
|
|
2492
|
+
var l = new p.PlaneGeometry(5, 5), e = new p.MeshBasicMaterial({
|
|
2493
2493
|
transparent: !0,
|
|
2494
2494
|
opacity: 0
|
|
2495
|
-
}), n = new p.Mesh(
|
|
2496
|
-
t.innerText =
|
|
2497
|
-
var r = new
|
|
2498
|
-
return r.name =
|
|
2495
|
+
}), n = new p.Mesh(l, e), t = document.createElement("div");
|
|
2496
|
+
t.innerText = d;
|
|
2497
|
+
var r = new Ae(t);
|
|
2498
|
+
return r.name = d, r.scale.set(0.3, 0.3, 0.3), t.style.color = "#ffffff", t.style.opacity = "0.5", t.style.pointerEvents = "none", t.style.backfaceVisibility = "hidden", n.rotateX(-oe), n.add(r), n;
|
|
2499
2499
|
}, Yn = (
|
|
2500
2500
|
/** @class */
|
|
2501
|
-
(function(
|
|
2502
|
-
he(
|
|
2503
|
-
function
|
|
2504
|
-
var t =
|
|
2505
|
-
t.camera = new
|
|
2506
|
-
var
|
|
2501
|
+
(function(d) {
|
|
2502
|
+
he(l, d);
|
|
2503
|
+
function l(e, n) {
|
|
2504
|
+
var t = d.call(this, e) || this;
|
|
2505
|
+
t.camera = new Mn(90), t.scene = new p.Scene(), t.renderer = new p.WebGLRenderer({ antialias: !0, alpha: !0 }), t.css3drenderer = new Vn(), t.ambientLight = new p.AmbientLight(16777215, 0.7), t.wrapper = document.createElement("div"), t.arrows = document.createElement("div"), t.arrowLeft = document.createElement("div"), t.arrowRight = document.createElement("div"), t.arrowFront = document.createElement("div"), t.arrowBack = document.createElement("div"), t.arrowTop = document.createElement("div"), t.arrowBottom = document.createElement("div"), t.spherical = null, t.dragging = !1, t.style = document.createElement("style"), t.directionalLight = new p.DirectionalLight(16777215, 0.2), t.box = new p.Mesh(new jn(8, 8, 8, 0.5, 20), new p.MeshPhongMaterial({ color: 16777215 })), t.faces = new p.Group(), t.orient = function(i) {
|
|
2506
|
+
var h = i.longitude, c = i.latitude;
|
|
2507
2507
|
t.dragging = !1, t.spherical = null, t.controls.enableDamping = !1, t.five.setState(Object.assign({
|
|
2508
2508
|
latitude: c
|
|
2509
|
-
},
|
|
2510
|
-
longitude:
|
|
2509
|
+
}, h !== void 0 ? {
|
|
2510
|
+
longitude: h + t.config.fixedLongitude
|
|
2511
2511
|
} : {})), t.five.ready().then(function() {
|
|
2512
2512
|
t.controls.enableDamping = !0, t.setState({ arrowsVisible: !0 });
|
|
2513
2513
|
});
|
|
2514
2514
|
}, t.onRenderFrame = function() {
|
|
2515
|
-
var
|
|
2516
|
-
if (t.renderer.render(t.scene, t.camera), t.css3drenderer.render(t.scene, t.camera), t.directionalLight.position.copy(t.camera.position), (
|
|
2515
|
+
var i, h, c, v, y;
|
|
2516
|
+
if (t.renderer.render(t.scene, t.camera), t.css3drenderer.render(t.scene, t.camera), t.directionalLight.position.copy(t.camera.position), (i = t.controls) === null || i === void 0 || i.update(), t.dragging) {
|
|
2517
2517
|
t.camera.computePose(), t.updateByCamera();
|
|
2518
|
-
var M = t.camera.pose, w = M.longitude,
|
|
2519
|
-
t.five.setState({ longitude: w, latitude:
|
|
2520
|
-
} else if (t.spherical && (!
|
|
2521
|
-
t.spherical = { pi: (
|
|
2522
|
-
var
|
|
2523
|
-
t.five.setState({ longitude: w, latitude:
|
|
2518
|
+
var M = t.camera.pose, w = M.longitude, P = M.latitude;
|
|
2519
|
+
t.five.setState({ longitude: w, latitude: P }, !0), t.updateArrows({ longitude: w, latitude: P });
|
|
2520
|
+
} else if (t.spherical && (!We(t.spherical.pi, (h = t.controls) === null || h === void 0 ? void 0 : h.getPolarAngle()) || !We(t.spherical.theta, (c = t.controls) === null || c === void 0 ? void 0 : c.getAzimuthalAngle()))) {
|
|
2521
|
+
t.spherical = { pi: (v = t.controls) === null || v === void 0 ? void 0 : v.getPolarAngle(), theta: (y = t.controls) === null || y === void 0 ? void 0 : y.getAzimuthalAngle() }, t.camera.computePose(), t.updateByCamera();
|
|
2522
|
+
var S = t.camera.pose, w = S.longitude, P = S.latitude;
|
|
2523
|
+
t.five.setState({ longitude: w, latitude: P }, !0), t.updateArrows({ longitude: w, latitude: P });
|
|
2524
2524
|
} else
|
|
2525
2525
|
t.spherical = null;
|
|
2526
|
-
}, t.onTapGesture = function(
|
|
2527
|
-
var
|
|
2528
|
-
y.setFromCamera(
|
|
2526
|
+
}, t.onTapGesture = function(i) {
|
|
2527
|
+
var h = i.pointers[0].clientX, c = i.pointers[0].clientY, v = Zt({ x: h, y: c }, t.wrapper), y = new p.Raycaster();
|
|
2528
|
+
y.setFromCamera(v, t.camera);
|
|
2529
2529
|
var M = y.intersectObjects(t.faces.children, !1)[0];
|
|
2530
2530
|
if (M) {
|
|
2531
|
-
var w = M.object.userData,
|
|
2532
|
-
t.orient({ longitude:
|
|
2531
|
+
var w = M.object.userData, P = w.longitude, S = w.latitude;
|
|
2532
|
+
t.orient({ longitude: P, latitude: S });
|
|
2533
2533
|
}
|
|
2534
2534
|
}, t.onFiveWantsGesture = function() {
|
|
2535
2535
|
if (t.spherical)
|
|
2536
2536
|
return !1;
|
|
2537
|
-
}, t.onFiveModeChange = function(
|
|
2538
|
-
t.controls && (t.controls.maxPolarAngle =
|
|
2539
|
-
}, t.onCameraUpdate = function(
|
|
2540
|
-
var
|
|
2537
|
+
}, t.onFiveModeChange = function(i) {
|
|
2538
|
+
t.controls && (t.controls.maxPolarAngle = i === "Topview" ? 0 : oe);
|
|
2539
|
+
}, t.onCameraUpdate = function(i) {
|
|
2540
|
+
var h = i.state;
|
|
2541
2541
|
if (!t.dragging && !t.spherical) {
|
|
2542
|
-
var c =
|
|
2543
|
-
t.camera.pose.longitude === c && t.camera.pose.latitude ===
|
|
2542
|
+
var c = h.longitude, v = h.latitude;
|
|
2543
|
+
t.camera.pose.longitude === c && t.camera.pose.latitude === v || (t.camera.setFromPose({ longitude: c, latitude: v, distance: 20, offset: new p.Vector3(0, 0, 0) }), t.updateByCamera(), t.updateArrows({ longitude: c, latitude: v }));
|
|
2544
2544
|
}
|
|
2545
|
-
}, t.onPanStart = function(
|
|
2545
|
+
}, t.onPanStart = function(i) {
|
|
2546
2546
|
t.dragging = !0, t.spherical = {};
|
|
2547
|
-
}, t.onMouseMove = function(
|
|
2547
|
+
}, t.onMouseMove = function(i) {
|
|
2548
2548
|
if (!t.dragging) {
|
|
2549
|
-
var
|
|
2550
|
-
c.setFromCamera(
|
|
2551
|
-
var
|
|
2549
|
+
var h = Zt({ x: i.clientX, y: i.clientY }, t.wrapper), c = new p.Raycaster();
|
|
2550
|
+
c.setFromCamera(h, t.camera);
|
|
2551
|
+
var v = c.intersectObjects(t.faces.children, !1)[0];
|
|
2552
2552
|
t.faces.children.forEach(function(y) {
|
|
2553
2553
|
y.material.opacity = 0, y.children[0].element.style.color = "";
|
|
2554
|
-
}),
|
|
2554
|
+
}), v && (v.object.material.opacity = 0.3, v.object.children[0].element.style.color = "#336dff");
|
|
2555
2555
|
}
|
|
2556
|
-
}, t.onPanEnd = function(
|
|
2556
|
+
}, t.onPanEnd = function(i) {
|
|
2557
2557
|
t.dragging = !1, t.spherical = { pi: t.controls.getPolarAngle(), theta: t.controls.getAzimuthalAngle() };
|
|
2558
2558
|
}, t.dispose = function() {
|
|
2559
2559
|
t.disable();
|
|
@@ -2564,8 +2564,8 @@ var We = function(h) {
|
|
|
2564
2564
|
arrowsVisible: !1
|
|
2565
2565
|
};
|
|
2566
2566
|
t.state = Object.assign(r, n == null ? void 0 : n.initialState);
|
|
2567
|
-
var
|
|
2568
|
-
return t._config =
|
|
2567
|
+
var s = N({ fixedLongitude: 0, orthoView: !0 }, n == null ? void 0 : n.config);
|
|
2568
|
+
return t._config = s, t.state.enabled && t._enable({ userAction: !1 }), t.mc = new Tt.Manager(t.wrapper), t.mc.add(new Tt.Tap({ interval: 410 })), t.mc.add(new Tt.Pan({ threshold: 10, pointers: 0 })), t.camera.setFromPose({
|
|
2569
2569
|
distance: 20,
|
|
2570
2570
|
offset: new p.Vector3(0, 0, 0),
|
|
2571
2571
|
longitude: e.camera.pose.latitude,
|
|
@@ -2617,22 +2617,22 @@ var We = function(h) {
|
|
|
2617
2617
|
transparent: !0
|
|
2618
2618
|
})), t.init(), t;
|
|
2619
2619
|
}
|
|
2620
|
-
return Object.defineProperty(
|
|
2620
|
+
return Object.defineProperty(l.prototype, "config", {
|
|
2621
2621
|
get: function() {
|
|
2622
|
-
return
|
|
2622
|
+
return N({}, this._config);
|
|
2623
2623
|
},
|
|
2624
2624
|
enumerable: !1,
|
|
2625
2625
|
configurable: !0
|
|
2626
|
-
}),
|
|
2626
|
+
}), l.prototype.updateState = function(e, n) {
|
|
2627
2627
|
var t = this.state;
|
|
2628
|
-
this.state =
|
|
2629
|
-
},
|
|
2628
|
+
this.state = N(N({}, this.state), e), typeof e.arrowsVisible == "boolean" && this.handleArrowsVisible(e.arrowsVisible), this.hooks.emit("stateChange", { state: this.state, prevState: t, userAction: n });
|
|
2629
|
+
}, l.prototype.appendTo = function(e) {
|
|
2630
2630
|
if (e) {
|
|
2631
2631
|
e.appendChild(this.wrapper);
|
|
2632
2632
|
var n = this.wrapper.getBoundingClientRect(), t = n.width, r = n.height;
|
|
2633
2633
|
this.renderer.setSize(t, r), this.css3drenderer.setSize(t, r);
|
|
2634
2634
|
}
|
|
2635
|
-
},
|
|
2635
|
+
}, l.prototype.init = function() {
|
|
2636
2636
|
this.renderer.setClearAlpha(0), this.renderer.domElement.style.outline = "none", this.initDom(), this.initFaces(), this.initControls(), this.initLights();
|
|
2637
2637
|
var e = this.cylinder;
|
|
2638
2638
|
e.position.y = -3;
|
|
@@ -2642,9 +2642,9 @@ var We = function(h) {
|
|
|
2642
2642
|
t.position.set(19, 0, 0), e.add(t);
|
|
2643
2643
|
var r = ot("北");
|
|
2644
2644
|
r.position.set(0, 0, -19), e.add(r);
|
|
2645
|
-
var
|
|
2646
|
-
|
|
2647
|
-
},
|
|
2645
|
+
var s = ot("南");
|
|
2646
|
+
s.position.set(0, 0, 19), e.add(s), this.updateByCamera(), this.scene.add(e, this.box, this.faces), this.scene.rotation.y = this.config.fixedLongitude;
|
|
2647
|
+
}, l.prototype.initDom = function() {
|
|
2648
2648
|
this.style.innerHTML = `
|
|
2649
2649
|
.OrientationPlugin .OrientationArrows {
|
|
2650
2650
|
position: absolute;
|
|
@@ -2746,7 +2746,7 @@ var We = function(h) {
|
|
|
2746
2746
|
transform: translate(0, -15px);
|
|
2747
2747
|
}
|
|
2748
2748
|
`, this.wrapper.className = "OrientationPlugin", this.arrows.className = "OrientationArrows", this.wrapper.style.cssText = "position: relative; width: 100%; height: 100%", this.wrapper.appendChild(this.arrows), this.arrowLeft.className = this.arrowRight.className = this.arrowTop.className = this.arrowBack.className = this.arrowFront.className = "OrientationArrow", this.arrowBottom.className = "OrientationArrow disabled", this.arrowBack.innerText = "后", this.arrowFront.innerText = "前", this.arrowLeft.innerText = "左", this.arrowRight.innerText = "右", this.arrowTop.innerText = "上", this.arrowBottom.innerText = "下", this.css3drenderer.domElement.style.cssText = "position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;";
|
|
2749
|
-
},
|
|
2749
|
+
}, l.prototype.bindEvents = function() {
|
|
2750
2750
|
var e = this;
|
|
2751
2751
|
this.five.on("renderFrame", this.onRenderFrame), this.five.on("camera.update", this.onCameraUpdate), this.five.on("wantsGesture", this.onFiveWantsGesture), this.five.on("modeChange", this.onFiveModeChange), this.mc.on("tap", this.onTapGesture), this.mc.on("panstart", this.onPanStart), this.mc.on("panend", this.onPanEnd), this.wrapper.addEventListener("mousemove", this.onMouseMove), this.arrowTop.onclick = function() {
|
|
2752
2752
|
return e.orient({ longitude: 0, latitude: oe });
|
|
@@ -2759,35 +2759,35 @@ var We = function(h) {
|
|
|
2759
2759
|
}, this.arrowBack.onclick = function() {
|
|
2760
2760
|
return e.orient({ longitude: Math.PI, latitude: 0 });
|
|
2761
2761
|
};
|
|
2762
|
-
},
|
|
2762
|
+
}, l.prototype.unbindEvents = function() {
|
|
2763
2763
|
this.five.off("renderFrame", this.onRenderFrame), this.five.off("camera.update", this.onCameraUpdate), this.five.off("wantsGesture", this.onFiveWantsGesture), this.five.off("modeChange", this.onFiveModeChange), this.mc.off("tap", this.onTapGesture), this.mc.off("panstart", this.onPanStart), this.mc.off("panend", this.onPanEnd), this.wrapper.removeEventListener("mousemove", this.onMouseMove), this.arrowTop.onclick = null, this.arrowLeft.onclick = null, this.arrowRight.onclick = null, this.arrowFront.onclick = null, this.arrowBack.onclick = null;
|
|
2764
|
-
},
|
|
2765
|
-
var e = He(0.2, 1, this.camera.pose.latitude / Math.PI * 2, function(
|
|
2766
|
-
return
|
|
2767
|
-
}), n = He(11, 13, this.camera.pose.latitude / Math.PI * 2, function(
|
|
2768
|
-
return
|
|
2769
|
-
}), t = He(12, 15, this.camera.pose.latitude / Math.PI * 2, function(
|
|
2770
|
-
return
|
|
2771
|
-
}), r = He(13, 19, this.camera.pose.latitude / Math.PI * 2, function(
|
|
2772
|
-
return
|
|
2773
|
-
}),
|
|
2774
|
-
return
|
|
2764
|
+
}, l.prototype.updateByCamera = function() {
|
|
2765
|
+
var e = He(0.2, 1, this.camera.pose.latitude / Math.PI * 2, function(i) {
|
|
2766
|
+
return i * i;
|
|
2767
|
+
}), n = He(11, 13, this.camera.pose.latitude / Math.PI * 2, function(i) {
|
|
2768
|
+
return i * i;
|
|
2769
|
+
}), t = He(12, 15, this.camera.pose.latitude / Math.PI * 2, function(i) {
|
|
2770
|
+
return i * i;
|
|
2771
|
+
}), r = He(13, 19, this.camera.pose.latitude / Math.PI * 2, function(i) {
|
|
2772
|
+
return i * i;
|
|
2773
|
+
}), s = He(-0.2, 0.5, this.camera.pose.latitude / Math.PI * 2, function(i) {
|
|
2774
|
+
return i * i;
|
|
2775
2775
|
});
|
|
2776
|
-
this.cylinder.geometry = new p.CylinderGeometry(n, t, 0.01, 50, 1, !0), this.cylinder.material.uniforms.radiusTop.value = n, this.cylinder.material.uniforms.radiusBottom.value = t, this.cylinder.material.needsUpdate = !0, this.cylinder.children.forEach(function(
|
|
2777
|
-
|
|
2778
|
-
var
|
|
2779
|
-
|
|
2776
|
+
this.cylinder.geometry = new p.CylinderGeometry(n, t, 0.01, 50, 1, !0), this.cylinder.material.uniforms.radiusTop.value = n, this.cylinder.material.uniforms.radiusBottom.value = t, this.cylinder.material.needsUpdate = !0, this.cylinder.children.forEach(function(i) {
|
|
2777
|
+
i.position.normalize().multiplyScalar(r), i.scale.set(e, e, e);
|
|
2778
|
+
var h = i.children[0];
|
|
2779
|
+
h && (h.element.style.opacity = s.toString());
|
|
2780
2780
|
});
|
|
2781
|
-
},
|
|
2781
|
+
}, l.prototype.updateArrows = function(e) {
|
|
2782
2782
|
e.longitude;
|
|
2783
2783
|
var n = e.latitude, t = oe - n < 0.02;
|
|
2784
2784
|
this.setState({ arrowsVisible: t });
|
|
2785
|
-
},
|
|
2785
|
+
}, l.prototype.handleArrowsVisible = function(e) {
|
|
2786
2786
|
var n = this;
|
|
2787
2787
|
if (this.state.enabled)
|
|
2788
2788
|
if (this.cylinder.material.uniforms.opacity.value = e ? 0.4 : 1, this.cylinder.material.needsUpdate = !0, e) {
|
|
2789
|
-
var t = this.five.getCurrentState(), r = t.longitude,
|
|
2790
|
-
if (oe -
|
|
2789
|
+
var t = this.five.getCurrentState(), r = t.longitude, s = t.latitude;
|
|
2790
|
+
if (oe - s < 0.03)
|
|
2791
2791
|
this.five.state.mode === "Topview" || this.five.state.mode === "Mapview" ? (this.faces.getObjectByName("上").element.className = "active", this.arrows.innerHTML = "", this.arrows.appendChild(this.arrowBack), this.arrows.appendChild(this.arrowLeft), this.arrows.appendChild(this.arrowRight), this.arrows.appendChild(this.arrowFront), this.arrows.style.transform = "rotate(".concat((r - this.config.fixedLongitude) / Math.PI * 180, "deg)")) : (this.arrows.innerHTML = "", this.faces.getObjectByName("上").element.className = "");
|
|
2792
2792
|
else {
|
|
2793
2793
|
switch (this.arrows.innerHTML = "", this.arrows.appendChild(this.arrowTop), this.config.orthoView && this.five.ready().then(function() {
|
|
@@ -2795,13 +2795,13 @@ var We = function(h) {
|
|
|
2795
2795
|
return n.five.controller.cameraMotion.ended = !1;
|
|
2796
2796
|
});
|
|
2797
2797
|
}), !0) {
|
|
2798
|
-
case
|
|
2798
|
+
case We(0, r - this.config.fixedLongitude):
|
|
2799
2799
|
this.arrows.appendChild(this.arrowLeft), this.arrows.appendChild(this.arrowRight), this.arrows.appendChild(this.arrowBottom), this.faces.getObjectByName("前").element.className = "active";
|
|
2800
2800
|
break;
|
|
2801
|
-
case
|
|
2801
|
+
case We(oe, r - this.config.fixedLongitude):
|
|
2802
2802
|
this.arrows.appendChild(this.arrowFront), this.arrows.appendChild(this.arrowBack), this.arrows.appendChild(this.arrowBottom), this.faces.getObjectByName("右").element.className = "active";
|
|
2803
2803
|
break;
|
|
2804
|
-
case
|
|
2804
|
+
case We(Math.PI, r - this.config.fixedLongitude):
|
|
2805
2805
|
this.arrows.appendChild(this.arrowRight), this.arrows.appendChild(this.arrowLeft), this.arrows.appendChild(this.arrowBottom), this.faces.getObjectByName("后").element.className = "active";
|
|
2806
2806
|
break;
|
|
2807
2807
|
default:
|
|
@@ -2814,35 +2814,35 @@ var We = function(h) {
|
|
|
2814
2814
|
} else
|
|
2815
2815
|
this.config.orthoView && (this.five.controller.cameraType = "auto", this.five.ready().then(function() {
|
|
2816
2816
|
return n.five.controller.cameraMotion.ended = !1;
|
|
2817
|
-
})), this.arrows.style.display = "none", this.faces.children.forEach(function(
|
|
2818
|
-
|
|
2817
|
+
})), this.arrows.style.display = "none", this.faces.children.forEach(function(i) {
|
|
2818
|
+
i.children[0].element.className = "";
|
|
2819
2819
|
});
|
|
2820
|
-
},
|
|
2820
|
+
}, l.prototype.setState = function(e, n) {
|
|
2821
2821
|
n === void 0 && (n = {});
|
|
2822
2822
|
var t = this.state, r = n.userAction !== void 0 ? n.userAction : !0;
|
|
2823
2823
|
if (this.updateState(e, r), e.enabled !== void 0 && t.enabled !== e.enabled) {
|
|
2824
|
-
var
|
|
2825
|
-
e.enabled ? this._enable(
|
|
2824
|
+
var s = { userAction: r };
|
|
2825
|
+
e.enabled ? this._enable(s) : this._disable(s);
|
|
2826
2826
|
}
|
|
2827
|
-
},
|
|
2827
|
+
}, l.prototype.initLights = function() {
|
|
2828
2828
|
this.directionalLight.target = this.box, this.scene.add(this.ambientLight, this.directionalLight);
|
|
2829
|
-
},
|
|
2829
|
+
}, l.prototype.initFaces = function() {
|
|
2830
2830
|
var e = Gn(7, 7, 0.5), n = new p.ShapeGeometry(e);
|
|
2831
2831
|
n.translate(-3.5, -3.5, 0);
|
|
2832
2832
|
var t = new p.Mesh(n, new p.MeshBasicMaterial({ transparent: !0, color: 3370495, opacity: 0 }));
|
|
2833
|
-
t.userData = { longitude: 0, latitude: 0 }, t.position.z = 4.1, t.add(
|
|
2833
|
+
t.userData = { longitude: 0, latitude: 0 }, t.position.z = 4.1, t.add(Ke("前"));
|
|
2834
2834
|
var r = new p.Mesh(n, new p.MeshBasicMaterial({ transparent: !0, color: 3370495, opacity: 0 }));
|
|
2835
|
-
r.rotateY(Math.PI), r.position.z = -4.1, r.add(
|
|
2836
|
-
var
|
|
2837
|
-
|
|
2838
|
-
var
|
|
2839
|
-
|
|
2840
|
-
var
|
|
2841
|
-
|
|
2842
|
-
},
|
|
2843
|
-
var e = this.controls = new
|
|
2835
|
+
r.rotateY(Math.PI), r.position.z = -4.1, r.add(Ke("后")), r.userData = { longitude: Math.PI, latitude: 0 };
|
|
2836
|
+
var s = new p.Mesh(n, new p.MeshBasicMaterial({ transparent: !0, color: 3370495, opacity: 0 }));
|
|
2837
|
+
s.rotateY(oe), s.position.x = 4.1, s.add(Ke("右")), s.userData = { longitude: oe, latitude: 0 };
|
|
2838
|
+
var i = new p.Mesh(n, new p.MeshBasicMaterial({ transparent: !0, color: 3370495, opacity: 0 }));
|
|
2839
|
+
i.rotateY(-oe), i.position.x = -4.1, i.add(Ke("左")), i.userData = { longitude: -oe, latitude: 0 };
|
|
2840
|
+
var h = new p.Mesh(n, new p.MeshBasicMaterial({ transparent: !0, color: 3370495, opacity: 0 }));
|
|
2841
|
+
h.rotateX(-oe), h.position.y = 4.1, h.add(Ke("上")), h.userData = { longitude: 0, latitude: oe }, this.faces.add(t, r, i, s, h);
|
|
2842
|
+
}, l.prototype.initControls = function() {
|
|
2843
|
+
var e = this.controls = new qe(this.camera, this.renderer.domElement);
|
|
2844
2844
|
e.enableZoom = !1, e.enableDamping = !0, e.enablePan = !1, e.maxPolarAngle = oe, e.dampingFactor = 0.15, e.rotateSpeed = 0.25;
|
|
2845
|
-
},
|
|
2845
|
+
}, l.prototype.load = function(e) {
|
|
2846
2846
|
return De(this, void 0, void 0, function() {
|
|
2847
2847
|
return Ne(this, function(n) {
|
|
2848
2848
|
return [
|
|
@@ -2851,36 +2851,36 @@ var We = function(h) {
|
|
|
2851
2851
|
];
|
|
2852
2852
|
});
|
|
2853
2853
|
});
|
|
2854
|
-
},
|
|
2854
|
+
}, l.prototype._enable = function(e) {
|
|
2855
2855
|
var n = this.five.getCurrentState(), t = n.longitude, r = n.latitude;
|
|
2856
2856
|
this.camera.setFromPose({ longitude: t, latitude: r, distance: 20, offset: new p.Vector3(0, 0, 0) }), this.updateByCamera(), this.wrapper.appendChild(this.renderer.domElement), this.wrapper.appendChild(this.css3drenderer.domElement), this.bindEvents();
|
|
2857
|
-
},
|
|
2857
|
+
}, l.prototype._disable = function(e) {
|
|
2858
2858
|
this.wrapper.removeChild(this.renderer.domElement), this.wrapper.removeChild(this.css3drenderer.domElement), this.unbindEvents();
|
|
2859
|
-
},
|
|
2859
|
+
}, l.prototype.enable = function(e) {
|
|
2860
2860
|
var n;
|
|
2861
2861
|
if (!this.state.enabled) {
|
|
2862
2862
|
var t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
2863
2863
|
this.updateState({ enabled: !0 }, t), this._enable({ userAction: t }), document.head.appendChild(this.style);
|
|
2864
2864
|
}
|
|
2865
|
-
},
|
|
2865
|
+
}, l.prototype.disable = function(e) {
|
|
2866
2866
|
var n;
|
|
2867
2867
|
if (this.state.enabled !== !1) {
|
|
2868
2868
|
var t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
2869
2869
|
this.updateState({ enabled: !1 }, t), this._disable({ userAction: t }), document.head.removeChild(this.style);
|
|
2870
2870
|
}
|
|
2871
|
-
},
|
|
2872
|
-
})(
|
|
2873
|
-
), nr = function(
|
|
2874
|
-
return new Yn(
|
|
2875
|
-
},
|
|
2871
|
+
}, l;
|
|
2872
|
+
})(Xe.Controller)
|
|
2873
|
+
), nr = function(d, l) {
|
|
2874
|
+
return new Yn(d, l);
|
|
2875
|
+
}, Wn = (
|
|
2876
2876
|
/** @class */
|
|
2877
|
-
(function(
|
|
2878
|
-
he(
|
|
2879
|
-
function
|
|
2880
|
-
var t =
|
|
2877
|
+
(function(d) {
|
|
2878
|
+
he(l, d);
|
|
2879
|
+
function l(e, n) {
|
|
2880
|
+
var t = d.call(this, e) || this;
|
|
2881
2881
|
return t.data = {}, t.pluginName = "BackgroundPlugin", t._onFiveCameraUpdate = function(r) {
|
|
2882
|
-
var
|
|
2883
|
-
t.gradientBg && (t.gradientBg.style.transform = "translateY(-".concat((1 -
|
|
2882
|
+
var s = (Math.PI / 2 - Math.max(r.latitude, 0)) / (Math.PI / 2), i = Math.max(0.2 - s, 0) * 10;
|
|
2883
|
+
t.gradientBg && (t.gradientBg.style.transform = "translateY(-".concat((1 - s) * 50, "%)")), t.groundBg && (t.groundBg.style.backgroundImage = "radial-gradient(circle, #2E303350 ".concat(i * 100, "%, transparent ").concat(i * 120, "%)"));
|
|
2884
2884
|
}, t._addEventListener = function() {
|
|
2885
2885
|
t.five.on("cameraUpdate", t._onFiveCameraUpdate);
|
|
2886
2886
|
}, t._removeEventListener = function() {
|
|
@@ -2894,19 +2894,19 @@ var We = function(h) {
|
|
|
2894
2894
|
];
|
|
2895
2895
|
});
|
|
2896
2896
|
});
|
|
2897
|
-
}, t.setState = function(r,
|
|
2897
|
+
}, t.setState = function(r, s) {
|
|
2898
2898
|
}, t.enable = function() {
|
|
2899
|
-
var r,
|
|
2900
|
-
if (!
|
|
2899
|
+
var r, s = (r = t.five.getElement()) === null || r === void 0 ? void 0 : r.parentNode;
|
|
2900
|
+
if (!s) {
|
|
2901
2901
|
t.five.ready().then(function() {
|
|
2902
2902
|
return t.enable();
|
|
2903
2903
|
});
|
|
2904
2904
|
return;
|
|
2905
2905
|
}
|
|
2906
|
-
t.state.enabled || (t._onFiveCameraUpdate(t.five.getPose(), !1), t.gradientBg &&
|
|
2906
|
+
t.state.enabled || (t._onFiveCameraUpdate(t.five.getPose(), !1), t.gradientBg && s.appendChild(t.gradientBg), t.groundBg && s.appendChild(t.groundBg), t.style && document.head.appendChild(t.style), t._addEventListener(), t.hooks.emit("enable", { userAction: !0 }), t.state.enabled = !0);
|
|
2907
2907
|
}, t.disable = function(r) {
|
|
2908
|
-
var
|
|
2909
|
-
t.state.enabled && ((
|
|
2908
|
+
var s, i, h, c;
|
|
2909
|
+
t.state.enabled && ((i = (s = t.gradientBg) === null || s === void 0 ? void 0 : s.parentNode) === null || i === void 0 || i.removeChild(t.gradientBg), (c = (h = t.groundBg) === null || h === void 0 ? void 0 : h.parentNode) === null || c === void 0 || c.removeChild(t.groundBg), t.style && document.head.removeChild(t.style), t._removeEventListener(), t.hooks.emit("disable", { userAction: !0 }), t.state.enabled = !1);
|
|
2910
2910
|
}, t.dispose = function() {
|
|
2911
2911
|
t._removeEventListener(), t.hooks.emit("disable", { userAction: !0 }), t.state.enabled = !1;
|
|
2912
2912
|
}, t.state = {
|
|
@@ -2934,10 +2934,10 @@ var We = function(h) {
|
|
|
2934
2934
|
}
|
|
2935
2935
|
`, t.enable()), t;
|
|
2936
2936
|
}
|
|
2937
|
-
return
|
|
2938
|
-
})(
|
|
2939
|
-
), rr = function(
|
|
2940
|
-
return new
|
|
2937
|
+
return l;
|
|
2938
|
+
})(_t.Controller)
|
|
2939
|
+
), rr = function(d, l) {
|
|
2940
|
+
return new Wn(d, l);
|
|
2941
2941
|
};
|
|
2942
2942
|
new p.Matrix4().fromArray([
|
|
2943
2943
|
1,
|
|
@@ -2957,28 +2957,28 @@ new p.Matrix4().fromArray([
|
|
|
2957
2957
|
0,
|
|
2958
2958
|
1
|
|
2959
2959
|
]);
|
|
2960
|
-
var
|
|
2960
|
+
var At = (
|
|
2961
2961
|
/** @class */
|
|
2962
2962
|
(function() {
|
|
2963
|
-
function
|
|
2964
|
-
this.R =
|
|
2963
|
+
function d(l, e, n, t, r) {
|
|
2964
|
+
this.R = l, this.Q = e, this.A = n, this.B = t, this.C = r, this.cov = NaN, this.x = NaN;
|
|
2965
2965
|
}
|
|
2966
|
-
return
|
|
2966
|
+
return d.prototype.filter = function(l, e) {
|
|
2967
2967
|
if (e === void 0 && (e = 0), isNaN(this.x))
|
|
2968
|
-
this.x = 1 / this.C *
|
|
2968
|
+
this.x = 1 / this.C * l, this.cov = 1 / this.C * this.Q * (1 / this.C);
|
|
2969
2969
|
else {
|
|
2970
2970
|
var n = this.A * this.x + this.B * e, t = this.A * this.cov * this.A + this.R, r = t * this.C * (1 / (this.C * t * this.C + this.Q));
|
|
2971
|
-
this.x = n + r * (
|
|
2971
|
+
this.x = n + r * (l - this.C * n), this.cov = t - r * this.C * t;
|
|
2972
2972
|
}
|
|
2973
2973
|
return this.x;
|
|
2974
|
-
},
|
|
2974
|
+
}, d;
|
|
2975
2975
|
})()
|
|
2976
|
-
),
|
|
2976
|
+
), Hn = (
|
|
2977
2977
|
/** @class */
|
|
2978
|
-
(function(
|
|
2979
|
-
he(
|
|
2980
|
-
function
|
|
2981
|
-
var t =
|
|
2978
|
+
(function(d) {
|
|
2979
|
+
he(l, d);
|
|
2980
|
+
function l(e, n) {
|
|
2981
|
+
var t = d.call(this, e) || this;
|
|
2982
2982
|
t.dispose = function() {
|
|
2983
2983
|
t.disable();
|
|
2984
2984
|
}, t.five = e;
|
|
@@ -2987,31 +2987,31 @@ var Pt = (
|
|
|
2987
2987
|
visible: !0
|
|
2988
2988
|
};
|
|
2989
2989
|
t.state = Object.assign(r, n == null ? void 0 : n.initialState);
|
|
2990
|
-
var
|
|
2991
|
-
return t._config =
|
|
2990
|
+
var s = N({}, n == null ? void 0 : n.config);
|
|
2991
|
+
return t._config = s, t.state.enabled && t._enable({ userAction: !1 }), t.cancelAnimation = null, t.skipStart = 0, t.skipEnd = 0, t.location = 0, t.totalDistance = 0, t.trajectory = null, t.currentKeyFrame = null, t.nextKeyframe = null, t.nextButOneKeyframe = null, t.keyframes = [], t.rate = t.config.rate || 1, t.virualCamera = t.five.camera.clone(), t.playingState = {
|
|
2992
2992
|
keyframeIndex: null,
|
|
2993
2993
|
progress: null
|
|
2994
|
-
}, Object.defineProperties(t, {
|
|
2994
|
+
}, t.timeArray = null, t.startTimestamp = null, t.playbackStartTime = null, t.playbackEndTime = null, Object.defineProperties(t, {
|
|
2995
2995
|
currentDistance: {
|
|
2996
2996
|
get: function() {
|
|
2997
2997
|
return this._currentDistance;
|
|
2998
2998
|
},
|
|
2999
|
-
set: function(
|
|
3000
|
-
this._currentDistance =
|
|
2999
|
+
set: function(i) {
|
|
3000
|
+
this._currentDistance = i;
|
|
3001
3001
|
}
|
|
3002
3002
|
}
|
|
3003
3003
|
}), t;
|
|
3004
3004
|
}
|
|
3005
|
-
return Object.defineProperty(
|
|
3005
|
+
return Object.defineProperty(l.prototype, "config", {
|
|
3006
3006
|
get: function() {
|
|
3007
|
-
return
|
|
3007
|
+
return N({}, this._config);
|
|
3008
3008
|
},
|
|
3009
3009
|
enumerable: !1,
|
|
3010
3010
|
configurable: !0
|
|
3011
|
-
}),
|
|
3011
|
+
}), l.prototype.updateState = function(e, n) {
|
|
3012
3012
|
var t = this.state;
|
|
3013
|
-
this.state =
|
|
3014
|
-
},
|
|
3013
|
+
this.state = N(N({}, this.state), e), this.hooks.emit("stateChange", { state: this.state, prevState: t, userAction: n });
|
|
3014
|
+
}, l.prototype.load = function(e) {
|
|
3015
3015
|
return De(this, void 0, void 0, function() {
|
|
3016
3016
|
return Ne(this, function(n) {
|
|
3017
3017
|
return [
|
|
@@ -3020,34 +3020,36 @@ var Pt = (
|
|
|
3020
3020
|
];
|
|
3021
3021
|
});
|
|
3022
3022
|
});
|
|
3023
|
-
},
|
|
3023
|
+
}, l.prototype.loadTrajectory = function(e) {
|
|
3024
3024
|
this.trajectory = e, this.cancelAnimation && this.cancelAnimation(), this.playingState.keyframeIndex = null, this.playingState.progress = null;
|
|
3025
|
-
var n = 0.01, t = 0.1, r = 1,
|
|
3025
|
+
var n = 0.01, t = 0.1, r = 1, s = 0, i = 1, h = new At(n, t, r, s, i), c = new At(n, t, r, s, i), v = new At(n, t, r, s, i);
|
|
3026
3026
|
if (this.trajectory && this.trajectory.content.loadState === "READY") {
|
|
3027
|
-
|
|
3027
|
+
var y = this.trajectory.content.data.positionArray;
|
|
3028
|
+
this.timeArray = this.trajectory.content.data.timeArray;
|
|
3029
|
+
for (var M = new Float32Array(y.length / 3), w = 0; w < M.length; w++)
|
|
3028
3030
|
if (w === 0)
|
|
3029
3031
|
M[w] = 0;
|
|
3030
3032
|
else {
|
|
3031
|
-
var
|
|
3032
|
-
M[w] =
|
|
3033
|
+
var P = new p.Vector3(y[w - 3], y[w - 2], y[w - 1]), S = new p.Vector3(y[w], y[w + 1], y[w + 2]);
|
|
3034
|
+
M[w] = S.distanceTo(P) + M[w - 1];
|
|
3033
3035
|
}
|
|
3034
3036
|
this.totalDistance = M[M.length - 1];
|
|
3035
3037
|
for (var w = 0; w < M.length; w++) {
|
|
3036
|
-
for (var
|
|
3037
|
-
b >= 0 && b < M.length && (
|
|
3038
|
-
|
|
3039
|
-
var T =
|
|
3040
|
-
position: new p.Vector3(T, f,
|
|
3038
|
+
for (var _ = new p.Vector3(0, 0, 0), E = 0, b = w - 5; b < w + 6; b++)
|
|
3039
|
+
b >= 0 && b < M.length && (_.add(new p.Vector3(y[b * 3], y[b * 3 + 1], y[b * 3 + 2])), E++);
|
|
3040
|
+
_.divideScalar(E).applyMatrix4(e.transform);
|
|
3041
|
+
var T = h.filter(_.x), f = c.filter(_.y), C = v.filter(_.z), x = {
|
|
3042
|
+
position: new p.Vector3(T, f, C),
|
|
3041
3043
|
location: M[w]
|
|
3042
3044
|
};
|
|
3043
|
-
this.keyframes.push(
|
|
3045
|
+
this.keyframes.push(x);
|
|
3044
3046
|
}
|
|
3045
3047
|
} else
|
|
3046
3048
|
throw new Error("trajectory content is not ready");
|
|
3047
|
-
},
|
|
3049
|
+
}, l.prototype.setPlayingState = function(e) {
|
|
3048
3050
|
(e.keyframeIndex !== null || e.progress !== null) && (this.cancelAnimation && this.cancelAnimation(), this.playingState.keyframeIndex = e.keyframeIndex ? e.keyframeIndex : this.playingState.keyframeIndex, this.playingState.progress = e.progress ? e.progress : this.playingState.progress, this.play());
|
|
3049
|
-
},
|
|
3050
|
-
},
|
|
3051
|
+
}, l.prototype._enable = function(e) {
|
|
3052
|
+
}, l.prototype.play = function() {
|
|
3051
3053
|
var e = this, n = this.keyframes.length;
|
|
3052
3054
|
if (n < 2)
|
|
3053
3055
|
throw new Error("keyframes length must be greater than 2");
|
|
@@ -3055,26 +3057,93 @@ var Pt = (
|
|
|
3055
3057
|
keyframeIndex: null,
|
|
3056
3058
|
progress: null
|
|
3057
3059
|
};
|
|
3058
|
-
this.playingState.keyframeIndex !== null && this.playingState.progress !== null ? (t.keyframeIndex = this.playingState.keyframeIndex, t.progress = this.playingState.progress) : this.playingState.keyframeIndex === null && this.playingState.progress === null && (this.playingState.keyframeIndex = this.skipStart, this.playingState.progress = 0, this.virualCamera.position.copy(this.keyframes[this.playingState.keyframeIndex].position.clone()), this.virualCamera.lookAt(this.keyframes[1].position.clone()), this.virualCamera.computePose(), this.five.setState(
|
|
3059
|
-
var r = this.playingState.keyframeIndex,
|
|
3060
|
-
this.cancelAnimation =
|
|
3060
|
+
this.playingState.keyframeIndex !== null && this.playingState.progress !== null ? (t.keyframeIndex = this.playingState.keyframeIndex, t.progress = this.playingState.progress) : this.playingState.keyframeIndex === null && this.playingState.progress === null && (this.playingState.keyframeIndex = this.skipStart, this.playingState.progress = 0, this.virualCamera.position.copy(this.keyframes[this.playingState.keyframeIndex].position.clone()), this.virualCamera.lookAt(this.keyframes[1].position.clone()), this.virualCamera.computePose(), this.five.setState(N({}, this.virualCamera.pose)));
|
|
3061
|
+
var r = this.playingState.keyframeIndex, s = 0;
|
|
3062
|
+
this.cancelAnimation = Ie.shared.add(function(i, h) {
|
|
3061
3063
|
if (r === n - 1 - e.skipEnd && e.cancelAnimation) {
|
|
3062
3064
|
e.cancelAnimation();
|
|
3063
3065
|
return;
|
|
3064
3066
|
}
|
|
3065
3067
|
e.currentKeyFrame = e.keyframes[r], e.nextKeyframe = e.keyframes[r + 1], r + 2 <= n - 1 ? e.nextButOneKeyframe = e.keyframes[r + 2] : e.nextButOneKeyframe = null;
|
|
3066
|
-
var c = e.currentKeyFrame.position.clone(),
|
|
3068
|
+
var c = e.currentKeyFrame.position.clone(), v = e.nextKeyframe.position.clone(), y = e.nextKeyframe.position.clone().sub(e.currentKeyFrame.position.clone()).normalize(), M = c.clone().add(y.clone().multiplyScalar(0.01)), w = new p.Vector3();
|
|
3067
3069
|
e.nextButOneKeyframe !== null ? w = e.nextButOneKeyframe.position.clone().sub(e.nextKeyframe.position.clone()).normalize() : w.copy(y);
|
|
3068
|
-
var
|
|
3069
|
-
|
|
3070
|
-
var
|
|
3071
|
-
|
|
3072
|
-
var
|
|
3073
|
-
e.virualCamera.position.copy(
|
|
3070
|
+
var P = v.clone().add(w.clone().multiplyScalar(0.01));
|
|
3071
|
+
s += h / 1e3 * e.rate;
|
|
3072
|
+
var S = s / c.distanceTo(v);
|
|
3073
|
+
S = S >= 1 ? 1 : S, t.keyframeIndex !== null && t.progress !== null && (S = t.progress, t.keyframeIndex = null, t.progress = null);
|
|
3074
|
+
var _ = c.clone().lerp(v, S), E = M.clone().lerp(P, S);
|
|
3075
|
+
e.virualCamera.position.copy(_), e.virualCamera.lookAt(E), e.virualCamera.updateMatrixWorld(), e.virualCamera.updateMatrix(), e.virualCamera.computePose(), e.five.setState(N({}, e.virualCamera.pose)), e.location = e.keyframes[r].location + c.clone().distanceTo(_), S === 1 ? (s = 0, r++, e.playingState.keyframeIndex = r, e.playingState.progress = 0) : (e.playingState.keyframeIndex = r, e.playingState.progress = S);
|
|
3074
3076
|
});
|
|
3075
|
-
},
|
|
3077
|
+
}, l.prototype.pause = function() {
|
|
3078
|
+
var e;
|
|
3079
|
+
if (this.cancelAnimation) {
|
|
3080
|
+
if (this.playingState.keyframeIndex !== null && this.playingState.keyframeIndex >= 0 && this.playingState.keyframeIndex < this.keyframes.length) {
|
|
3081
|
+
var n = this.playingState.keyframeIndex, t = (e = this.playingState.progress) !== null && e !== void 0 ? e : 0, r = this.keyframes[n], s = n + 1 < this.keyframes.length ? this.keyframes[n + 1] : r, i = r.position.clone(), h = s.position.clone(), c = i.clone().lerp(h, t), v = h.clone().sub(i).normalize(), y = c.clone().add(v.multiplyScalar(0.01));
|
|
3082
|
+
this.virualCamera.position.copy(c), this.virualCamera.lookAt(y), this.virualCamera.updateMatrixWorld(), this.virualCamera.updateMatrix(), this.virualCamera.computePose(), this.five.setState(N({}, this.virualCamera.pose));
|
|
3083
|
+
} else if (this.currentKeyFrame && this.nextKeyframe) {
|
|
3084
|
+
var i = this.currentKeyFrame.position.clone(), h = this.nextKeyframe.position.clone(), c = i.clone(), v = h.clone().sub(i).normalize(), y = c.clone().add(v.multiplyScalar(0.01));
|
|
3085
|
+
this.virualCamera.position.copy(c), this.virualCamera.lookAt(y), this.virualCamera.updateMatrixWorld(), this.virualCamera.updateMatrix(), this.virualCamera.computePose(), this.five.setState(N({}, this.virualCamera.pose));
|
|
3086
|
+
}
|
|
3087
|
+
this.cancelAnimation();
|
|
3088
|
+
}
|
|
3089
|
+
this.startTimestamp = null;
|
|
3090
|
+
}, l.prototype.playByTimestamp = function() {
|
|
3091
|
+
var e = this, n;
|
|
3092
|
+
if (!this.trajectory || !this.timeArray || this.timeArray.length === 0)
|
|
3093
|
+
throw new Error("Trajectory or timeArray is not available");
|
|
3094
|
+
var t = this.keyframes.length;
|
|
3095
|
+
if (t < 2)
|
|
3096
|
+
throw new Error("keyframes length must be greater than 2");
|
|
3076
3097
|
this.cancelAnimation && this.cancelAnimation();
|
|
3077
|
-
|
|
3098
|
+
var r = this.skipStart, s = this.timeArray.length - 1 - this.skipEnd;
|
|
3099
|
+
if (r >= s || r < 0 || s >= this.timeArray.length)
|
|
3100
|
+
throw new Error("Invalid skipStart or skipEnd values");
|
|
3101
|
+
this.playbackStartTime = this.timeArray[r], this.playbackEndTime = this.timeArray[s], this.playbackEndTime - this.playbackStartTime;
|
|
3102
|
+
var i, h = 0, c = null;
|
|
3103
|
+
if (this.playingState.keyframeIndex !== null && this.playingState.keyframeIndex >= r && this.playingState.keyframeIndex < t - this.skipEnd) {
|
|
3104
|
+
i = this.playingState.keyframeIndex, h = (n = this.playingState.progress) !== null && n !== void 0 ? n : 0;
|
|
3105
|
+
var v = this.timeArray[i], y = i + 1 < this.timeArray.length ? this.timeArray[i + 1] : v, M = y - v;
|
|
3106
|
+
c = v + M * h;
|
|
3107
|
+
} else
|
|
3108
|
+
i = this.skipStart, i >= t - 1 - this.skipEnd && (i = t - 1 - this.skipEnd - 1), i < 0 && (i = 0), c = null;
|
|
3109
|
+
var w = this.playbackStartTime;
|
|
3110
|
+
if (c !== null) {
|
|
3111
|
+
var P = c - w;
|
|
3112
|
+
this.startTimestamp = Date.now() - P / this.rate;
|
|
3113
|
+
} else
|
|
3114
|
+
this.startTimestamp = Date.now();
|
|
3115
|
+
if (h > 0 && i + 1 < t) {
|
|
3116
|
+
var S = this.keyframes[i].position.clone(), _ = this.keyframes[i + 1].position.clone(), E = S.clone().lerp(_, h), b = _.clone().sub(S).normalize(), T = E.clone().add(b.multiplyScalar(0.01));
|
|
3117
|
+
this.virualCamera.position.copy(E), this.virualCamera.lookAt(T);
|
|
3118
|
+
} else
|
|
3119
|
+
this.virualCamera.position.copy(this.keyframes[i].position.clone()), i + 1 < t && this.virualCamera.lookAt(this.keyframes[i + 1].position.clone());
|
|
3120
|
+
this.virualCamera.computePose(), this.five.setState(N({}, this.virualCamera.pose)), this.cancelAnimation = Ie.shared.add(function(f, C) {
|
|
3121
|
+
if (e.startTimestamp) {
|
|
3122
|
+
var x = Date.now() - e.startTimestamp, F = w + x * e.rate;
|
|
3123
|
+
if (e.playbackEndTime && F >= e.playbackEndTime) {
|
|
3124
|
+
var V = t - 1 - e.skipEnd;
|
|
3125
|
+
if (V > 0 && V < t) {
|
|
3126
|
+
if (e.currentKeyFrame = e.keyframes[V - 1], e.nextKeyframe = e.keyframes[V], e.virualCamera.position.copy(e.nextKeyframe.position.clone()), V + 1 < t)
|
|
3127
|
+
e.virualCamera.lookAt(e.keyframes[V + 1].position.clone());
|
|
3128
|
+
else {
|
|
3129
|
+
var Y = e.nextKeyframe.position.clone().sub(e.currentKeyFrame.position.clone()).normalize();
|
|
3130
|
+
e.virualCamera.lookAt(e.nextKeyframe.position.clone().add(Y.multiplyScalar(0.01)));
|
|
3131
|
+
}
|
|
3132
|
+
e.virualCamera.computePose(), e.five.setState(N({}, e.virualCamera.pose));
|
|
3133
|
+
}
|
|
3134
|
+
e.cancelAnimation && (e.cancelAnimation(), e.startTimestamp = null);
|
|
3135
|
+
return;
|
|
3136
|
+
}
|
|
3137
|
+
var G = e.findKeyFrameByTimestamp(F);
|
|
3138
|
+
if (!(G === void 0 || G >= t - 1 - e.skipEnd) && (G !== i && (i = G), !(i >= t - 1 - e.skipEnd) && (e.currentKeyFrame = e.keyframes[i], e.nextKeyframe = e.keyframes[i + 1], i + 2 <= t - 1 ? e.nextButOneKeyframe = e.keyframes[i + 2] : e.nextButOneKeyframe = null, !!e.timeArray))) {
|
|
3139
|
+
var q = e.timeArray[i], Q = e.timeArray[i + 1], R = Q - q, H = R > 0 ? (F - q) / R : 0, L = Math.max(0, Math.min(1, H)), k = e.currentKeyFrame.position.clone(), I = e.nextKeyframe.position.clone(), D = e.nextKeyframe.position.clone().sub(e.currentKeyFrame.position.clone()).normalize(), W = k.clone().add(D.clone().multiplyScalar(0.01)), $ = new p.Vector3();
|
|
3140
|
+
e.nextButOneKeyframe !== null ? $ = e.nextButOneKeyframe.position.clone().sub(e.nextKeyframe.position.clone()).normalize() : $.copy(D);
|
|
3141
|
+
var Z = I.clone().add($.clone().multiplyScalar(0.01)), B = k.clone().lerp(I, L), ne = W.clone().lerp(Z, L);
|
|
3142
|
+
e.virualCamera.position.copy(B), e.virualCamera.lookAt(ne), e.virualCamera.updateMatrixWorld(), e.virualCamera.updateMatrix(), e.virualCamera.computePose(), e.five.setState(N({}, e.virualCamera.pose)), e.playingState.keyframeIndex = i, e.playingState.progress = L, e.location = e.keyframes[i].location + k.clone().distanceTo(B), e.playingState.keyframeIndex = i, e.playingState.progress = L;
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
});
|
|
3146
|
+
}, l.prototype.findKeyFrameByLocation = function(e) {
|
|
3078
3147
|
if (this.keyframes.length !== 0) {
|
|
3079
3148
|
for (var n = 0, t = this.keyframes.length - 1; n <= t; ) {
|
|
3080
3149
|
var r = Math.floor((n + t) / 2);
|
|
@@ -3087,30 +3156,109 @@ var Pt = (
|
|
|
3087
3156
|
progress: 0
|
|
3088
3157
|
};
|
|
3089
3158
|
}
|
|
3090
|
-
},
|
|
3159
|
+
}, l.prototype.findKeyFrameByTimestamp = function(e) {
|
|
3160
|
+
if (!(!this.timeArray || this.timeArray.length === 0 || this.keyframes.length === 0)) {
|
|
3161
|
+
for (var n = 0, t = this.timeArray.length - 1, r = 0, s = Math.abs(this.timeArray[0] - e); n <= t; ) {
|
|
3162
|
+
var i = Math.floor((n + t) / 2), h = this.timeArray[i], c = Math.abs(h - e);
|
|
3163
|
+
if (c < s && (s = c, r = i), h === e)
|
|
3164
|
+
return i;
|
|
3165
|
+
h < e ? n = i + 1 : t = i - 1;
|
|
3166
|
+
}
|
|
3167
|
+
if (r > 0) {
|
|
3168
|
+
var v = Math.abs(this.timeArray[r - 1] - e);
|
|
3169
|
+
v < s && (r = r - 1);
|
|
3170
|
+
}
|
|
3171
|
+
if (r < this.timeArray.length - 1) {
|
|
3172
|
+
var y = Math.abs(this.timeArray[r + 1] - e);
|
|
3173
|
+
y < s && (r = r + 1);
|
|
3174
|
+
}
|
|
3175
|
+
return r;
|
|
3176
|
+
}
|
|
3177
|
+
}, l.prototype.resetPlayingState = function() {
|
|
3091
3178
|
this.playingState.keyframeIndex = null, this.playingState.progress = null;
|
|
3092
|
-
},
|
|
3093
|
-
|
|
3179
|
+
}, l.prototype.getTotalTime = function() {
|
|
3180
|
+
if (!this.timeArray || this.timeArray.length === 0)
|
|
3181
|
+
return null;
|
|
3182
|
+
var e = this.skipStart, n = this.timeArray.length - 1 - this.skipEnd;
|
|
3183
|
+
if (e >= n || e < 0 || n >= this.timeArray.length)
|
|
3184
|
+
return null;
|
|
3185
|
+
var t = this.timeArray[e], r = this.timeArray[n];
|
|
3186
|
+
return r - t;
|
|
3187
|
+
}, l.prototype.setPlayingStateByTimestamp = function(e) {
|
|
3188
|
+
var n = this;
|
|
3189
|
+
if (!this.trajectory || !this.timeArray || this.timeArray.length === 0)
|
|
3190
|
+
throw new Error("Trajectory or timeArray is not available");
|
|
3191
|
+
var t = this.keyframes.length;
|
|
3192
|
+
if (e < 0 || e >= t)
|
|
3193
|
+
throw new Error("Invalid keyframeIndex");
|
|
3194
|
+
this.cancelAnimation && this.cancelAnimation();
|
|
3195
|
+
var r = this.skipStart, s = this.timeArray.length - 1 - this.skipEnd;
|
|
3196
|
+
if (r >= s || r < 0 || s >= this.timeArray.length)
|
|
3197
|
+
throw new Error("Invalid skipStart or skipEnd values");
|
|
3198
|
+
this.playbackStartTime = this.timeArray[r], this.playbackEndTime = this.timeArray[s];
|
|
3199
|
+
var i = this.timeArray[e], h = i - this.playbackStartTime;
|
|
3200
|
+
if (this.startTimestamp = Date.now() - h / this.rate, this.playingState.keyframeIndex = e, this.playingState.progress = 0, this.virualCamera.position.copy(this.keyframes[e].position.clone()), e + 1 < t)
|
|
3201
|
+
this.virualCamera.lookAt(this.keyframes[e + 1].position.clone());
|
|
3202
|
+
else if (e > 0) {
|
|
3203
|
+
var c = this.keyframes[e].position.clone().sub(this.keyframes[e - 1].position.clone()).normalize();
|
|
3204
|
+
this.virualCamera.lookAt(this.keyframes[e].position.clone().add(c.multiplyScalar(0.01)));
|
|
3205
|
+
}
|
|
3206
|
+
this.virualCamera.computePose(), this.five.setState(N({}, this.virualCamera.pose));
|
|
3207
|
+
var v = this.playbackStartTime, y = e;
|
|
3208
|
+
this.cancelAnimation = Ie.shared.add(function(M, w) {
|
|
3209
|
+
if (!(n.timeArray === null || n.timeArray.length === 0) && n.startTimestamp) {
|
|
3210
|
+
var P = Date.now() - n.startTimestamp, S = v + P * n.rate;
|
|
3211
|
+
if (n.playbackEndTime && S >= n.playbackEndTime) {
|
|
3212
|
+
var _ = t - 1 - n.skipEnd;
|
|
3213
|
+
if (_ > 0 && _ < t) {
|
|
3214
|
+
if (n.currentKeyFrame = n.keyframes[_ - 1], n.nextKeyframe = n.keyframes[_], n.virualCamera.position.copy(n.nextKeyframe.position.clone()), _ + 1 < t)
|
|
3215
|
+
n.virualCamera.lookAt(n.keyframes[_ + 1].position.clone());
|
|
3216
|
+
else {
|
|
3217
|
+
var E = n.nextKeyframe.position.clone().sub(n.currentKeyFrame.position.clone()).normalize();
|
|
3218
|
+
n.virualCamera.lookAt(n.nextKeyframe.position.clone().add(E.multiplyScalar(0.01)));
|
|
3219
|
+
}
|
|
3220
|
+
n.virualCamera.computePose(), n.five.setState(N({}, n.virualCamera.pose));
|
|
3221
|
+
}
|
|
3222
|
+
n.cancelAnimation && (n.cancelAnimation(), n.startTimestamp = null);
|
|
3223
|
+
return;
|
|
3224
|
+
}
|
|
3225
|
+
var b = n.findKeyFrameByTimestamp(S);
|
|
3226
|
+
if (!(b === void 0 || b >= t - 1 - n.skipEnd) && (b !== y && (y = b), !(y >= t - 1 - n.skipEnd))) {
|
|
3227
|
+
n.currentKeyFrame = n.keyframes[y], n.nextKeyframe = n.keyframes[y + 1], y + 2 <= t - 1 ? n.nextButOneKeyframe = n.keyframes[y + 2] : n.nextButOneKeyframe = null;
|
|
3228
|
+
var T = n.currentKeyFrame.position.clone(), f = n.nextKeyframe.position.clone(), C = n.nextKeyframe.position.clone().sub(n.currentKeyFrame.position.clone()).normalize(), x = T.clone().add(C.clone().multiplyScalar(0.01)), F = new p.Vector3();
|
|
3229
|
+
n.nextButOneKeyframe !== null ? F = n.nextButOneKeyframe.position.clone().sub(n.nextKeyframe.position.clone()).normalize() : F.copy(C);
|
|
3230
|
+
var V = f.clone().add(F.clone().multiplyScalar(0.01)), Y = n.timeArray[y], G = n.timeArray[y + 1], q = G - Y, Q = 0;
|
|
3231
|
+
if (q > 0) {
|
|
3232
|
+
var R = S - Y;
|
|
3233
|
+
Q = Math.max(0, Math.min(1, R / q));
|
|
3234
|
+
}
|
|
3235
|
+
var H = Q * Q * (3 - 2 * Q), L = T.clone().lerp(f, H), k = x.clone().lerp(V, H);
|
|
3236
|
+
n.virualCamera.position.copy(L), n.virualCamera.lookAt(k), n.virualCamera.computePose(), n.five.setState(N({}, n.virualCamera.pose));
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
});
|
|
3240
|
+
}, l.prototype._disable = function(e) {
|
|
3241
|
+
}, l.prototype.enable = function(e) {
|
|
3094
3242
|
var n;
|
|
3095
3243
|
if (!this.state.enabled) {
|
|
3096
3244
|
var t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
3097
3245
|
this.updateState({ enabled: !0 }, t), this._enable({ userAction: t });
|
|
3098
3246
|
}
|
|
3099
|
-
},
|
|
3247
|
+
}, l.prototype.disable = function(e) {
|
|
3100
3248
|
var n;
|
|
3101
3249
|
if (this.state.enabled !== !1) {
|
|
3102
3250
|
var t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
3103
3251
|
this.updateState({ enabled: !1 }, t), this._disable({ userAction: t });
|
|
3104
3252
|
}
|
|
3105
|
-
},
|
|
3106
|
-
})(
|
|
3107
|
-
), ar = function(
|
|
3108
|
-
return new
|
|
3253
|
+
}, l;
|
|
3254
|
+
})(Xe.Controller)
|
|
3255
|
+
), ar = function(d, l) {
|
|
3256
|
+
return new Hn(d, l);
|
|
3109
3257
|
};
|
|
3110
|
-
function Qt(
|
|
3111
|
-
return
|
|
3258
|
+
function Qt(d, l, e) {
|
|
3259
|
+
return d < l ? l : d > e ? e : d;
|
|
3112
3260
|
}
|
|
3113
|
-
var
|
|
3261
|
+
var Kn = (
|
|
3114
3262
|
/* glsl */
|
|
3115
3263
|
`
|
|
3116
3264
|
varying vec2 vUv;
|
|
@@ -3121,7 +3269,7 @@ void main() {
|
|
|
3121
3269
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
3122
3270
|
}
|
|
3123
3271
|
`
|
|
3124
|
-
),
|
|
3272
|
+
), Xn = (
|
|
3125
3273
|
/* glsl */
|
|
3126
3274
|
`
|
|
3127
3275
|
varying vec2 vUv;
|
|
@@ -3143,18 +3291,18 @@ void main() {
|
|
|
3143
3291
|
gl_FragColor.a = gl_FragColor.a * opacity;
|
|
3144
3292
|
}
|
|
3145
3293
|
`
|
|
3146
|
-
),
|
|
3294
|
+
), qn = [1, 5, 2, 6, 3, 7, 4, 8, 9, 13, 10, 14, 11, 15, 12, 16], Pt = 512, Mt = 512, st = 128, Zn = (
|
|
3147
3295
|
/** @class */
|
|
3148
|
-
(function(
|
|
3149
|
-
he(
|
|
3150
|
-
function
|
|
3151
|
-
var t =
|
|
3296
|
+
(function(d) {
|
|
3297
|
+
he(l, d);
|
|
3298
|
+
function l(e, n) {
|
|
3299
|
+
var t = d.call(this, e) || this;
|
|
3152
3300
|
t.group = new p.Group(), t.mesh = (function() {
|
|
3153
|
-
var
|
|
3154
|
-
|
|
3155
|
-
var
|
|
3156
|
-
vertexShader:
|
|
3157
|
-
fragmentShader:
|
|
3301
|
+
var i = new p.CylinderGeometry(0.12, 0.12, 1, 32, 1, !0);
|
|
3302
|
+
i.translate(0, 0.5, 0);
|
|
3303
|
+
var h = new p.ShaderMaterial({
|
|
3304
|
+
vertexShader: Kn,
|
|
3305
|
+
fragmentShader: Xn,
|
|
3158
3306
|
uniforms: {
|
|
3159
3307
|
map: { value: new p.Texture() },
|
|
3160
3308
|
progress: { value: 0 },
|
|
@@ -3162,24 +3310,24 @@ void main() {
|
|
|
3162
3310
|
},
|
|
3163
3311
|
transparent: !0,
|
|
3164
3312
|
depthTest: !1
|
|
3165
|
-
}), c = new p.Mesh(
|
|
3313
|
+
}), c = new p.Mesh(i, h);
|
|
3166
3314
|
return c;
|
|
3167
|
-
})(), t.panoMesh = new
|
|
3168
|
-
}, t.drawLine = function(
|
|
3315
|
+
})(), t.panoMesh = new Sn({ scale: 1.5 }), t.stop = function() {
|
|
3316
|
+
}, t.drawLine = function(i, h) {
|
|
3169
3317
|
if (t.ctx) {
|
|
3170
3318
|
var c = (function() {
|
|
3171
|
-
var M, w =
|
|
3172
|
-
return w * ((M =
|
|
3173
|
-
})(),
|
|
3174
|
-
y.addColorStop(0, "rgba(255,255,255,0)"), y.addColorStop(0.5, "rgba(255,255,255,1)"), y.addColorStop(1, "rgba(255,255,255,0)"), t.ctx.fillStyle = y, t.ctx.fillRect(c,
|
|
3319
|
+
var M, w = Pt / 16 | 0;
|
|
3320
|
+
return w * ((M = qn[i]) !== null && M !== void 0 ? M : 0);
|
|
3321
|
+
})(), v = (1 - (h + i * 150) % 1200 / 1200) * (Mt + st), y = t.ctx.createLinearGradient(0, v - st, 0, v);
|
|
3322
|
+
y.addColorStop(0, "rgba(255,255,255,0)"), y.addColorStop(0.5, "rgba(255,255,255,1)"), y.addColorStop(1, "rgba(255,255,255,0)"), t.ctx.fillStyle = y, t.ctx.fillRect(c, v - st, 3, st);
|
|
3175
3323
|
}
|
|
3176
|
-
}, t.anime = function(
|
|
3324
|
+
}, t.anime = function(i) {
|
|
3177
3325
|
if (t.ctx && t.startTime) {
|
|
3178
|
-
t.ctx.clearRect(0, 0,
|
|
3179
|
-
for (var
|
|
3180
|
-
t.drawLine(
|
|
3181
|
-
var c = Qt((
|
|
3182
|
-
t.panoMesh.setOpacity(
|
|
3326
|
+
t.ctx.clearRect(0, 0, Pt, Mt);
|
|
3327
|
+
for (var h = 0; h < 16; h++)
|
|
3328
|
+
t.drawLine(h, i - t.startTime);
|
|
3329
|
+
var c = Qt((i - t.startTime) / 1e3, 0, 1), v = Qt((i - t.startTime) / 300, 0, t.config.maxOpacity);
|
|
3330
|
+
t.panoMesh.setOpacity(v), t.mesh.material.uniforms.progress.value = c, t.mesh.material.uniforms.opacity.value = v, t.mesh.material.uniforms.map.value.needsUpdate = !0, t.five.needsRender = !0;
|
|
3183
3331
|
}
|
|
3184
3332
|
}, t.dispose = function() {
|
|
3185
3333
|
t.disable();
|
|
@@ -3189,24 +3337,24 @@ void main() {
|
|
|
3189
3337
|
visible: !0
|
|
3190
3338
|
};
|
|
3191
3339
|
t.state = Object.assign(r, n == null ? void 0 : n.initialState);
|
|
3192
|
-
var
|
|
3193
|
-
return t._config =
|
|
3340
|
+
var s = N(N({}, n == null ? void 0 : n.config), { maxOpacity: 1 });
|
|
3341
|
+
return t._config = s, typeof document == "undefined" || (t.canvas = document.createElement("canvas"), t.ctx = t.canvas.getContext("2d"), t.canvas.width = Pt, t.canvas.height = Mt, t.ctx.shadowColor = "rgba(255,255,255,0.5)", t.ctx.shadowBlur = 6, t.ctx.shadowOffsetX = 0, t.ctx.shadowOffsetY = 0, t.mesh.material.uniforms.map.value = new p.CanvasTexture(t.canvas), t.group.add(t.mesh), t.panoMesh.setProgress(1), t.panoMesh.setOpacity(0), t.group.add(t.panoMesh), t.state.enabled && t._enable({ userAction: !1 })), t;
|
|
3194
3342
|
}
|
|
3195
|
-
return Object.defineProperty(
|
|
3343
|
+
return Object.defineProperty(l.prototype, "config", {
|
|
3196
3344
|
get: function() {
|
|
3197
|
-
return
|
|
3345
|
+
return N({}, this._config);
|
|
3198
3346
|
},
|
|
3199
3347
|
enumerable: !1,
|
|
3200
3348
|
configurable: !0
|
|
3201
|
-
}),
|
|
3349
|
+
}), l.prototype.updateState = function(e, n) {
|
|
3202
3350
|
var t = this.state;
|
|
3203
|
-
this.state =
|
|
3204
|
-
},
|
|
3351
|
+
this.state = N(N({}, this.state), e), this.hooks.emit("stateChange", { state: this.state, prevState: t, userAction: n });
|
|
3352
|
+
}, l.prototype.updateConfig = function(e, n) {
|
|
3205
3353
|
var t;
|
|
3206
3354
|
n === void 0 && (n = {});
|
|
3207
|
-
var r = this.config,
|
|
3208
|
-
this._config =
|
|
3209
|
-
},
|
|
3355
|
+
var r = this.config, s = N(N({}, r), e);
|
|
3356
|
+
this._config = s, this.hooks.emit("configChange", { prevConfig: r, config: s, userAction: (t = n.userAction) !== null && t !== void 0 ? t : !0 });
|
|
3357
|
+
}, l.prototype.load = function(e) {
|
|
3210
3358
|
return De(this, void 0, void 0, function() {
|
|
3211
3359
|
return Ne(this, function(n) {
|
|
3212
3360
|
return [
|
|
@@ -3215,97 +3363,97 @@ void main() {
|
|
|
3215
3363
|
];
|
|
3216
3364
|
});
|
|
3217
3365
|
});
|
|
3218
|
-
},
|
|
3366
|
+
}, l.prototype._enable = function(e) {
|
|
3219
3367
|
var n = this;
|
|
3220
3368
|
this.mesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition), this.panoMesh.position.copy(this.five.observers[this.five.state.panoIndex].standingPosition), this.five.ready().then(function() {
|
|
3221
|
-
n.five.scene.add(n.group), n.stop =
|
|
3369
|
+
n.five.scene.add(n.group), n.stop = Ie.shared.add(function(t, r) {
|
|
3222
3370
|
n.startTime || (n.startTime = t), n.panoMesh.updateTime(t, r), n.anime(t);
|
|
3223
3371
|
});
|
|
3224
3372
|
});
|
|
3225
|
-
},
|
|
3373
|
+
}, l.prototype._disable = function(e) {
|
|
3226
3374
|
this.five.scene.remove(this.group), this.panoMesh.setOpacity(0), this.startTime = void 0, this.stop(), this.five.needsRender = !0;
|
|
3227
|
-
},
|
|
3375
|
+
}, l.prototype.enable = function(e) {
|
|
3228
3376
|
var n;
|
|
3229
3377
|
if (this.ctx && !this.state.enabled && this.five.observers[this.five.state.panoIndex]) {
|
|
3230
3378
|
var t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
3231
3379
|
this.updateState({ enabled: !0 }, t), this._enable({ userAction: t });
|
|
3232
3380
|
}
|
|
3233
|
-
},
|
|
3381
|
+
}, l.prototype.disable = function(e) {
|
|
3234
3382
|
var n;
|
|
3235
3383
|
if (this.state.enabled !== !1) {
|
|
3236
3384
|
var t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
3237
3385
|
this.updateState({ enabled: !1 }, t), this._disable({ userAction: t });
|
|
3238
3386
|
}
|
|
3239
|
-
},
|
|
3387
|
+
}, l.prototype.setState = function(e, n) {
|
|
3240
3388
|
n === void 0 && (n = {});
|
|
3241
3389
|
var t = this.state, r = n.userAction !== void 0 ? n.userAction : !0;
|
|
3242
3390
|
if (this.updateState(e, r), e.enabled !== void 0 && t.enabled !== e.enabled) {
|
|
3243
|
-
var
|
|
3244
|
-
e.enabled ? this._enable(
|
|
3391
|
+
var s = { userAction: r };
|
|
3392
|
+
e.enabled ? this._enable(s) : this._disable(s);
|
|
3245
3393
|
}
|
|
3246
|
-
},
|
|
3247
|
-
})(
|
|
3248
|
-
), ir = function(
|
|
3249
|
-
return new Zn(
|
|
3250
|
-
},
|
|
3394
|
+
}, l;
|
|
3395
|
+
})(_t.Controller)
|
|
3396
|
+
), ir = function(d, l) {
|
|
3397
|
+
return new Zn(d, l);
|
|
3398
|
+
}, Ot = (
|
|
3251
3399
|
/** @class */
|
|
3252
|
-
(function(
|
|
3253
|
-
he(
|
|
3254
|
-
function
|
|
3255
|
-
var e =
|
|
3400
|
+
(function(d) {
|
|
3401
|
+
he(l, d);
|
|
3402
|
+
function l() {
|
|
3403
|
+
var e = d.call(this) || this;
|
|
3256
3404
|
e.type = "LineSegmentsGeometry";
|
|
3257
3405
|
var n = [-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0], t = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2], r = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5];
|
|
3258
3406
|
return e.setIndex(r), e.setAttribute("position", new p.Float32BufferAttribute(n, 3)), e.setAttribute("uv", new p.Float32BufferAttribute(t, 2)), e;
|
|
3259
3407
|
}
|
|
3260
|
-
return
|
|
3408
|
+
return l.prototype.applyMatrix4 = function(e) {
|
|
3261
3409
|
var n = this.attributes.instanceStart, t = this.attributes.instanceEnd;
|
|
3262
3410
|
return n !== void 0 && (n.applyMatrix4(e), t.applyMatrix4(e), n.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this;
|
|
3263
|
-
},
|
|
3411
|
+
}, l.prototype.setPositions = function(e) {
|
|
3264
3412
|
var n;
|
|
3265
3413
|
e instanceof Float32Array ? n = e : Array.isArray(e) ? n = new Float32Array(e) : n = new Float32Array();
|
|
3266
3414
|
var t = new p.InstancedInterleavedBuffer(n, 6, 1);
|
|
3267
3415
|
return this.setAttribute("instanceStart", new p.InterleavedBufferAttribute(t, 3, 0)), this.setAttribute("instanceEnd", new p.InterleavedBufferAttribute(t, 3, 3)), this.computeBoundingBox(), this.computeBoundingSphere(), this;
|
|
3268
|
-
},
|
|
3416
|
+
}, l.prototype.setColors = function(e) {
|
|
3269
3417
|
var n;
|
|
3270
3418
|
e instanceof Float32Array ? n = e : Array.isArray(e) ? n = new Float32Array(e) : n = new Float32Array();
|
|
3271
3419
|
var t = new p.InstancedInterleavedBuffer(n, 6, 1);
|
|
3272
3420
|
return this.setAttribute("instanceColorStart", new p.InterleavedBufferAttribute(t, 3, 0)), this.setAttribute("instanceColorEnd", new p.InterleavedBufferAttribute(t, 3, 3)), this;
|
|
3273
|
-
},
|
|
3421
|
+
}, l.prototype.fromWireframeGeometry = function(e) {
|
|
3274
3422
|
return this.setPositions(e.attributes.position.array), this;
|
|
3275
|
-
},
|
|
3423
|
+
}, l.prototype.fromEdgesGeometry = function(e) {
|
|
3276
3424
|
return this.setPositions(e.attributes.position.array), this;
|
|
3277
|
-
},
|
|
3425
|
+
}, l.prototype.fromMesh = function(e) {
|
|
3278
3426
|
return this.fromWireframeGeometry(new p.WireframeGeometry(e.geometry)), this;
|
|
3279
|
-
},
|
|
3427
|
+
}, l.prototype.fromLineSegments = function(e) {
|
|
3280
3428
|
var n = e.geometry;
|
|
3281
3429
|
if (n instanceof p.Geometry) {
|
|
3282
3430
|
var t = new p.BufferGeometry().fromGeometry(n);
|
|
3283
3431
|
this.setPositions(t.attributes.position.array);
|
|
3284
3432
|
} else n instanceof p.BufferGeometry && this.setPositions(n.attributes.position.array);
|
|
3285
3433
|
return this;
|
|
3286
|
-
},
|
|
3434
|
+
}, l.prototype.computeBoundingBox = function() {
|
|
3287
3435
|
this.boundingBox === null && (this.boundingBox = new p.Box3());
|
|
3288
3436
|
var e = this.attributes.instanceStart, n = this.attributes.instanceEnd;
|
|
3289
3437
|
if (e !== void 0 && n !== void 0) {
|
|
3290
3438
|
var t = new p.Box3();
|
|
3291
3439
|
this.boundingBox.setFromBufferAttribute(e), t.setFromBufferAttribute(n), this.boundingBox.union(t);
|
|
3292
3440
|
}
|
|
3293
|
-
},
|
|
3441
|
+
}, l.prototype.computeBoundingSphere = function() {
|
|
3294
3442
|
this.boundingSphere === null && (this.boundingSphere = new p.Sphere()), this.boundingBox === null && this.computeBoundingBox();
|
|
3295
3443
|
var e = this.attributes.instanceStart, n = this.attributes.instanceEnd;
|
|
3296
3444
|
if (e !== void 0 && n !== void 0) {
|
|
3297
3445
|
var t = this.boundingSphere.center;
|
|
3298
3446
|
this.boundingBox.getCenter(t);
|
|
3299
|
-
for (var r = 0,
|
|
3300
|
-
|
|
3447
|
+
for (var r = 0, s = new p.Vector3(), i = 0, h = e.count; i < h; i++)
|
|
3448
|
+
s.fromBufferAttribute(e, i), r = Math.max(r, t.distanceToSquared(s)), s.fromBufferAttribute(n, i), r = Math.max(r, t.distanceToSquared(s));
|
|
3301
3449
|
this.boundingSphere.radius = Math.sqrt(r), isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this);
|
|
3302
3450
|
}
|
|
3303
|
-
},
|
|
3304
|
-
},
|
|
3451
|
+
}, l.prototype.toJSON = function() {
|
|
3452
|
+
}, l;
|
|
3305
3453
|
})(p.InstancedBufferGeometry)
|
|
3306
3454
|
);
|
|
3307
|
-
Object.assign(
|
|
3308
|
-
var
|
|
3455
|
+
Object.assign(Ot.prototype, { isLineSegmentsGeometry: !0 });
|
|
3456
|
+
var St = {
|
|
3309
3457
|
uniforms: p.UniformsUtils.merge([
|
|
3310
3458
|
p.UniformsLib.common,
|
|
3311
3459
|
p.UniformsLib.fog,
|
|
@@ -3533,15 +3681,15 @@ var xt = {
|
|
|
3533
3681
|
#include <premultiplied_alpha_fragment>
|
|
3534
3682
|
}
|
|
3535
3683
|
`
|
|
3536
|
-
},
|
|
3684
|
+
}, kt = (
|
|
3537
3685
|
/** @class */
|
|
3538
|
-
(function(
|
|
3539
|
-
he(
|
|
3540
|
-
function
|
|
3541
|
-
var n =
|
|
3542
|
-
uniforms: p.UniformsUtils.clone(
|
|
3543
|
-
vertexShader:
|
|
3544
|
-
fragmentShader:
|
|
3686
|
+
(function(d) {
|
|
3687
|
+
he(l, d);
|
|
3688
|
+
function l(e) {
|
|
3689
|
+
var n = d.call(this, {
|
|
3690
|
+
uniforms: p.UniformsUtils.clone(St.uniforms),
|
|
3691
|
+
vertexShader: St.vertexShader,
|
|
3692
|
+
fragmentShader: St.fragmentShader,
|
|
3545
3693
|
clipping: !0
|
|
3546
3694
|
}) || this;
|
|
3547
3695
|
return n.type = "LineMaterial", n.dashed = !1, Object.defineProperties(n, {
|
|
@@ -3682,107 +3830,107 @@ var xt = {
|
|
|
3682
3830
|
}
|
|
3683
3831
|
}), n.setValues(e), n;
|
|
3684
3832
|
}
|
|
3685
|
-
return
|
|
3833
|
+
return l;
|
|
3686
3834
|
})(p.ShaderMaterial)
|
|
3687
3835
|
);
|
|
3688
|
-
Object.assign(
|
|
3836
|
+
Object.assign(kt.prototype, { isLineMaterial: !0 });
|
|
3689
3837
|
var en = (
|
|
3690
3838
|
/** @class */
|
|
3691
|
-
(function(
|
|
3692
|
-
he(
|
|
3693
|
-
function
|
|
3694
|
-
var t =
|
|
3695
|
-
return t.type = "LineSegments2", t.geometry = e !== void 0 ? e : new
|
|
3839
|
+
(function(d) {
|
|
3840
|
+
he(l, d);
|
|
3841
|
+
function l(e, n) {
|
|
3842
|
+
var t = d.call(this) || this;
|
|
3843
|
+
return t.type = "LineSegments2", t.geometry = e !== void 0 ? e : new Ot(), t.material = n !== void 0 ? n : new kt({ color: Math.random() * 16777215 }), t;
|
|
3696
3844
|
}
|
|
3697
|
-
return
|
|
3698
|
-
for (var e = this.geometry, n = e.attributes.instanceStart, t = e.attributes.instanceEnd, r = new Float32Array(2 * n.count),
|
|
3699
|
-
|
|
3700
|
-
this.material.uniforms.totalLength.value =
|
|
3701
|
-
for (var c = 0, y = 0,
|
|
3702
|
-
|
|
3703
|
-
var M =
|
|
3845
|
+
return l.prototype.computeLineDistances = function() {
|
|
3846
|
+
for (var e = this.geometry, n = e.attributes.instanceStart, t = e.attributes.instanceEnd, r = new Float32Array(2 * n.count), s = new p.Vector3(), i = new p.Vector3(), h = 0, c = 0, v = n.count; c < v; c++)
|
|
3847
|
+
s.fromBufferAttribute(n, c), i.fromBufferAttribute(t, c), h += s.distanceTo(i);
|
|
3848
|
+
this.material.uniforms.totalLength.value = h;
|
|
3849
|
+
for (var c = 0, y = 0, v = n.count; c < v; c++, y += 2) {
|
|
3850
|
+
s.fromBufferAttribute(n, c), i.fromBufferAttribute(t, c);
|
|
3851
|
+
var M = s.distanceTo(i);
|
|
3704
3852
|
r[y] = y === 0 ? 0 : r[y - 1], r[y + 1] = r[y] + M;
|
|
3705
3853
|
}
|
|
3706
3854
|
var w = new p.InstancedInterleavedBuffer(r, 2, 1);
|
|
3707
3855
|
return e.setAttribute("instanceDistanceStart", new p.InterleavedBufferAttribute(w, 1, 0)), e.setAttribute("instanceDistanceEnd", new p.InterleavedBufferAttribute(w, 1, 1)), this;
|
|
3708
|
-
},
|
|
3856
|
+
}, l.prototype.raycast = function(e, n) {
|
|
3709
3857
|
e.camera === null && console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');
|
|
3710
|
-
var t = e.ray, r = e.camera,
|
|
3711
|
-
t.at(1,
|
|
3858
|
+
var t = e.ray, r = e.camera, s = r.projectionMatrix, i = this.geometry, h = this.material, c = h.resolution, v = h.linewidth, y = i.attributes.instanceStart, M = i.attributes.instanceEnd, w = new p.Vector4(), P = new p.Vector4(), S = new p.Vector4(), _ = new p.Vector3(), E = new p.Matrix4(), b = new p.Line3(), T = new p.Vector3();
|
|
3859
|
+
t.at(1, S), S.w = 1, S.applyMatrix4(r.matrixWorldInverse), S.applyMatrix4(s), S.multiplyScalar(1 / S.w), S.x *= c.x / 2, S.y *= c.y / 2, S.z = 0, _.copy(S);
|
|
3712
3860
|
var f = this.matrixWorld;
|
|
3713
3861
|
E.multiplyMatrices(r.matrixWorldInverse, f);
|
|
3714
|
-
for (var
|
|
3715
|
-
w.fromBufferAttribute(y,
|
|
3716
|
-
var
|
|
3717
|
-
if (!(
|
|
3718
|
-
w.x *= c.x / 2, w.y *= c.y / 2,
|
|
3719
|
-
var
|
|
3720
|
-
b.at(
|
|
3721
|
-
var
|
|
3722
|
-
if (
|
|
3723
|
-
b.start.fromBufferAttribute(y,
|
|
3724
|
-
var
|
|
3725
|
-
t.distanceSqToSegment(b.start, b.end,
|
|
3726
|
-
point:
|
|
3727
|
-
pointOnLine:
|
|
3728
|
-
distance: t.origin.distanceTo(
|
|
3862
|
+
for (var C = 0, x = y.count; C < x; C++) {
|
|
3863
|
+
w.fromBufferAttribute(y, C), P.fromBufferAttribute(M, C), w.w = 1, P.w = 1, w.applyMatrix4(E), P.applyMatrix4(E), w.applyMatrix4(s), P.applyMatrix4(s), w.multiplyScalar(1 / w.w), P.multiplyScalar(1 / P.w);
|
|
3864
|
+
var F = w.z < -1 && P.z < -1, V = w.z > 1 && P.z > 1;
|
|
3865
|
+
if (!(F || V)) {
|
|
3866
|
+
w.x *= c.x / 2, w.y *= c.y / 2, P.x *= c.x / 2, P.y *= c.y / 2, b.start.copy(w), b.start.z = 0, b.end.copy(P), b.end.z = 0;
|
|
3867
|
+
var Y = b.closestPointToPointParameter(_, !0);
|
|
3868
|
+
b.at(Y, T);
|
|
3869
|
+
var G = p.MathUtils.lerp(w.z, P.z, Y), q = G >= -1 && G <= 1, Q = _.distanceTo(T) < v * 0.5;
|
|
3870
|
+
if (q && Q) {
|
|
3871
|
+
b.start.fromBufferAttribute(y, C), b.end.fromBufferAttribute(M, C), b.start.applyMatrix4(f), b.end.applyMatrix4(f);
|
|
3872
|
+
var R = new p.Vector3(), H = new p.Vector3();
|
|
3873
|
+
t.distanceSqToSegment(b.start, b.end, H, R), n.push({
|
|
3874
|
+
point: H,
|
|
3875
|
+
pointOnLine: R,
|
|
3876
|
+
distance: t.origin.distanceTo(H),
|
|
3729
3877
|
object: this,
|
|
3730
|
-
faceIndex:
|
|
3878
|
+
faceIndex: C
|
|
3731
3879
|
});
|
|
3732
3880
|
}
|
|
3733
3881
|
}
|
|
3734
3882
|
}
|
|
3735
|
-
},
|
|
3883
|
+
}, l;
|
|
3736
3884
|
})(p.Mesh)
|
|
3737
3885
|
);
|
|
3738
3886
|
Object.assign(en.prototype, { isLineSegments2: !0 });
|
|
3739
3887
|
var tn = (
|
|
3740
3888
|
/** @class */
|
|
3741
|
-
(function(
|
|
3742
|
-
he(
|
|
3743
|
-
function
|
|
3744
|
-
var t =
|
|
3889
|
+
(function(d) {
|
|
3890
|
+
he(l, d);
|
|
3891
|
+
function l(e, n) {
|
|
3892
|
+
var t = d.call(this, e, n) || this;
|
|
3745
3893
|
return t.type = "Line2", t;
|
|
3746
3894
|
}
|
|
3747
|
-
return
|
|
3895
|
+
return l;
|
|
3748
3896
|
})(en)
|
|
3749
3897
|
);
|
|
3750
3898
|
Object.assign(tn.prototype, { isLine2: !0 });
|
|
3751
3899
|
var nn = (
|
|
3752
3900
|
/** @class */
|
|
3753
|
-
(function(
|
|
3754
|
-
he(
|
|
3755
|
-
function
|
|
3756
|
-
var e =
|
|
3901
|
+
(function(d) {
|
|
3902
|
+
he(l, d);
|
|
3903
|
+
function l() {
|
|
3904
|
+
var e = d.call(this) || this;
|
|
3757
3905
|
return e.type = "LineGeometry", e;
|
|
3758
3906
|
}
|
|
3759
|
-
return
|
|
3907
|
+
return l.prototype.setPositions = function(e) {
|
|
3760
3908
|
for (var n = e.length - 3, t = new Float32Array(2 * n), r = 0; r < n; r += 3)
|
|
3761
3909
|
t[2 * r] = e[r], t[2 * r + 1] = e[r + 1], t[2 * r + 2] = e[r + 2], t[2 * r + 3] = e[r + 3], t[2 * r + 4] = e[r + 4], t[2 * r + 5] = e[r + 5];
|
|
3762
|
-
return
|
|
3763
|
-
},
|
|
3910
|
+
return d.prototype.setPositions.call(this, t), this;
|
|
3911
|
+
}, l.prototype.setColors = function(e) {
|
|
3764
3912
|
for (var n = e.length - 3, t = new Float32Array(2 * n), r = 0; r < n; r += 3)
|
|
3765
3913
|
t[2 * r] = e[r], t[2 * r + 1] = e[r + 1], t[2 * r + 2] = e[r + 2], t[2 * r + 3] = e[r + 3], t[2 * r + 4] = e[r + 4], t[2 * r + 5] = e[r + 5];
|
|
3766
|
-
return
|
|
3767
|
-
},
|
|
3914
|
+
return d.prototype.setColors.call(this, t), this;
|
|
3915
|
+
}, l.prototype.fromLine = function(e) {
|
|
3768
3916
|
var n = e.geometry;
|
|
3769
3917
|
if (n instanceof p.Geometry) {
|
|
3770
3918
|
var t = new p.BufferGeometry().fromGeometry(n);
|
|
3771
3919
|
this.setPositions(t.attributes.position.array);
|
|
3772
3920
|
} else n instanceof p.BufferGeometry && this.setPositions(n.attributes.position.array);
|
|
3773
3921
|
return this;
|
|
3774
|
-
},
|
|
3922
|
+
}, l.prototype.copy = function() {
|
|
3775
3923
|
return this;
|
|
3776
|
-
},
|
|
3777
|
-
})(
|
|
3924
|
+
}, l;
|
|
3925
|
+
})(Ot)
|
|
3778
3926
|
);
|
|
3779
3927
|
Object.assign(nn.prototype, { isLineGeometry: !0 });
|
|
3780
3928
|
var Qn = (
|
|
3781
3929
|
/** @class */
|
|
3782
|
-
(function(
|
|
3783
|
-
he(
|
|
3784
|
-
function
|
|
3785
|
-
var t =
|
|
3930
|
+
(function(d) {
|
|
3931
|
+
he(l, d);
|
|
3932
|
+
function l(e, n) {
|
|
3933
|
+
var t = d.call(this, e) || this;
|
|
3786
3934
|
t.paths = /* @__PURE__ */ new Map(), t.up = new p.Vector3(0, 1, 0);
|
|
3787
3935
|
var r = {
|
|
3788
3936
|
enabled: !0,
|
|
@@ -3790,7 +3938,7 @@ var Qn = (
|
|
|
3790
3938
|
playing: !1
|
|
3791
3939
|
};
|
|
3792
3940
|
t.state = Object.assign(r, n == null ? void 0 : n.initialState);
|
|
3793
|
-
var
|
|
3941
|
+
var s = {
|
|
3794
3942
|
lineCount: 6,
|
|
3795
3943
|
spacing: 0.02,
|
|
3796
3944
|
lineWidth: 2,
|
|
@@ -3812,66 +3960,66 @@ var Qn = (
|
|
|
3812
3960
|
subMeshHighlightWidth: 1
|
|
3813
3961
|
// 添加这一行
|
|
3814
3962
|
};
|
|
3815
|
-
return t._config =
|
|
3816
|
-
t.addPath(
|
|
3963
|
+
return t._config = N(N({}, s), n == null ? void 0 : n.config), n != null && n.paths && n.paths.length > 0 && n.paths.forEach(function(i) {
|
|
3964
|
+
t.addPath(i);
|
|
3817
3965
|
}), t.state.enabled && t._enable({ userAction: !1 }), t;
|
|
3818
3966
|
}
|
|
3819
|
-
return Object.defineProperty(
|
|
3967
|
+
return Object.defineProperty(l.prototype, "config", {
|
|
3820
3968
|
get: function() {
|
|
3821
|
-
return
|
|
3969
|
+
return N({}, this._config);
|
|
3822
3970
|
},
|
|
3823
3971
|
enumerable: !1,
|
|
3824
3972
|
configurable: !0
|
|
3825
|
-
}),
|
|
3973
|
+
}), l.prototype.updateState = function(e, n) {
|
|
3826
3974
|
var t = this.state;
|
|
3827
|
-
this.state =
|
|
3828
|
-
},
|
|
3975
|
+
this.state = N(N({}, this.state), e), this.hooks.emit("stateChange", { state: this.state, prevState: t, userAction: n });
|
|
3976
|
+
}, l.prototype.load = function(e, n) {
|
|
3829
3977
|
return De(this, void 0, void 0, function() {
|
|
3830
3978
|
var t, r = this;
|
|
3831
|
-
return Ne(this, function(
|
|
3832
|
-
return this.clearAllPaths(), e.paths.forEach(function(
|
|
3833
|
-
var
|
|
3979
|
+
return Ne(this, function(s) {
|
|
3980
|
+
return this.clearAllPaths(), e.paths.forEach(function(i) {
|
|
3981
|
+
var h, c, v = i.points.map(function(y) {
|
|
3834
3982
|
return new p.Vector3(y.x, y.y, y.z);
|
|
3835
3983
|
});
|
|
3836
3984
|
r.addPath({
|
|
3837
|
-
id:
|
|
3838
|
-
points:
|
|
3839
|
-
enabled: (
|
|
3840
|
-
visible: (c =
|
|
3841
|
-
color:
|
|
3842
|
-
lineWidth:
|
|
3843
|
-
speed:
|
|
3985
|
+
id: i.id,
|
|
3986
|
+
points: v,
|
|
3987
|
+
enabled: (h = i.enabled) !== null && h !== void 0 ? h : !0,
|
|
3988
|
+
visible: (c = i.visible) !== null && c !== void 0 ? c : !0,
|
|
3989
|
+
color: i.color,
|
|
3990
|
+
lineWidth: i.lineWidth,
|
|
3991
|
+
speed: i.speed
|
|
3844
3992
|
});
|
|
3845
|
-
}), t = /* @__PURE__ */ new Map(), this.paths.forEach(function(
|
|
3846
|
-
t.set(
|
|
3993
|
+
}), t = /* @__PURE__ */ new Map(), this.paths.forEach(function(i, h) {
|
|
3994
|
+
t.set(h, i.config);
|
|
3847
3995
|
}), this.data = { paths: t }, this.hooks.emit("dataLoaded", this.data), n && this.setState(n), [
|
|
3848
3996
|
2
|
|
3849
3997
|
/*return*/
|
|
3850
3998
|
];
|
|
3851
3999
|
});
|
|
3852
4000
|
});
|
|
3853
|
-
},
|
|
3854
|
-
var n, t, r,
|
|
4001
|
+
}, l.prototype.addPath = function(e) {
|
|
4002
|
+
var n, t, r, s, i, h, c, v;
|
|
3855
4003
|
if (e.points.length < 2)
|
|
3856
4004
|
return console.warn("DynamicPathLinePlugin: 路径 ".concat(e.id, " 至少需要2个点")), !1;
|
|
3857
4005
|
if (this.paths.has(e.id))
|
|
3858
4006
|
return console.warn("DynamicPathLinePlugin: 路径 ".concat(e.id, " 已存在")), !1;
|
|
3859
|
-
var y = new p.CatmullRomCurve3(e.points), M = (n = e.subMeshColor) !== null && n !== void 0 ? n : this._config.subMeshColor, w = (t = e.subMeshWidth) !== null && t !== void 0 ? t : this._config.subMeshWidth,
|
|
3860
|
-
|
|
3861
|
-
var
|
|
3862
|
-
|
|
3863
|
-
var
|
|
4007
|
+
var y = new p.CatmullRomCurve3(e.points), M = (n = e.subMeshColor) !== null && n !== void 0 ? n : this._config.subMeshColor, w = (t = e.subMeshWidth) !== null && t !== void 0 ? t : this._config.subMeshWidth, P = (r = e.subMeshOpacity) !== null && r !== void 0 ? r : this._config.subMeshOpacity, S = (s = e.enableSubMesh) !== null && s !== void 0 ? s : !0, _ = (i = e.speed) !== null && i !== void 0 ? i : this._config.speed, E = (h = e.range) !== null && h !== void 0 ? h : this._config.range, b = this.createLines(e, y, E), T = this.createParticles(), f = T.particles, C = T.particleGeometry, x = T.particleMaterial, F = T.particleInfos, V = T.particlePositions, Y = this.createSubMeshGeometry(e, y, w), G = y.getLength(), q = this.createSubMeshMaterial(M, P, G, E);
|
|
4008
|
+
q.uniforms.totalLength.value = G;
|
|
4009
|
+
var Q = new p.Mesh(Y, q);
|
|
4010
|
+
Q.visible = S, this.five.scene.add(Q);
|
|
4011
|
+
var R = {
|
|
3864
4012
|
id: e.id,
|
|
3865
4013
|
config: e,
|
|
3866
4014
|
curve: y,
|
|
3867
4015
|
lines: b,
|
|
3868
4016
|
particles: f,
|
|
3869
|
-
particleGeometry:
|
|
3870
|
-
particleMaterial:
|
|
3871
|
-
particleInfos:
|
|
3872
|
-
particlePositions:
|
|
4017
|
+
particleGeometry: C,
|
|
4018
|
+
particleMaterial: x,
|
|
4019
|
+
particleInfos: F,
|
|
4020
|
+
particlePositions: V,
|
|
3873
4021
|
enabled: (c = e.enabled) !== null && c !== void 0 ? c : !0,
|
|
3874
|
-
visible: (
|
|
4022
|
+
visible: (v = e.visible) !== null && v !== void 0 ? v : !0,
|
|
3875
4023
|
startOffset: 0,
|
|
3876
4024
|
endOffset: 0,
|
|
3877
4025
|
lastAnimationProgress: 0,
|
|
@@ -3882,99 +4030,99 @@ var Qn = (
|
|
|
3882
4030
|
subMeshUnfoldStarted: !1,
|
|
3883
4031
|
subMeshUnfoldStartTime: 0,
|
|
3884
4032
|
lastUpdateTime: performance.now() / 1e3,
|
|
3885
|
-
subMesh:
|
|
3886
|
-
subMeshGeometry:
|
|
3887
|
-
subMeshMaterial:
|
|
4033
|
+
subMesh: Q,
|
|
4034
|
+
subMeshGeometry: Y,
|
|
4035
|
+
subMeshMaterial: q,
|
|
3888
4036
|
subMeshColor: M,
|
|
3889
4037
|
subMeshWidth: w,
|
|
3890
|
-
subMeshOpacity:
|
|
3891
|
-
speed:
|
|
4038
|
+
subMeshOpacity: P,
|
|
4039
|
+
speed: _,
|
|
3892
4040
|
animationId: null,
|
|
3893
|
-
enableSubMesh:
|
|
4041
|
+
enableSubMesh: S,
|
|
3894
4042
|
isPaused: !1,
|
|
3895
4043
|
pausedProgress: 0,
|
|
3896
4044
|
pausedTime: 0
|
|
3897
4045
|
};
|
|
3898
|
-
this.paths.set(e.id,
|
|
3899
|
-
var
|
|
3900
|
-
return this.paths.forEach(function(
|
|
3901
|
-
|
|
3902
|
-
}), this.data = { paths:
|
|
3903
|
-
},
|
|
4046
|
+
this.paths.set(e.id, R);
|
|
4047
|
+
var H = this.data, L = /* @__PURE__ */ new Map();
|
|
4048
|
+
return this.paths.forEach(function(k, I) {
|
|
4049
|
+
L.set(I, k.config);
|
|
4050
|
+
}), this.data = { paths: L }, this.hooks.emit("dataChange", this.data, H), this.hooks.emit("pathAdd", e.id, e), this.state.playing && this.startPathAnimation(e.id), !0;
|
|
4051
|
+
}, l.prototype.removePath = function(e) {
|
|
3904
4052
|
var n = this.paths.get(e);
|
|
3905
4053
|
if (!n)
|
|
3906
4054
|
return console.warn("DynamicPathLinePlugin: 路径 ".concat(e, " 不存在")), !1;
|
|
3907
4055
|
this.stopPathAnimation(e), this.disposePathResources(n), this.paths.delete(e);
|
|
3908
4056
|
var t = this.data, r = /* @__PURE__ */ new Map();
|
|
3909
|
-
return this.paths.forEach(function(
|
|
3910
|
-
r.set(
|
|
4057
|
+
return this.paths.forEach(function(s, i) {
|
|
4058
|
+
r.set(i, s.config);
|
|
3911
4059
|
}), this.data = { paths: r }, this.hooks.emit("dataChange", this.data, t), this.hooks.emit("pathRemove", e), !0;
|
|
3912
|
-
},
|
|
4060
|
+
}, l.prototype.enablePath = function(e) {
|
|
3913
4061
|
var n = this.paths.get(e);
|
|
3914
4062
|
return n ? (n.enabled = !0, this.hooks.emit("pathEnable", e), !0) : (console.warn("DynamicPathLinePlugin: 路径 ".concat(e, " 不存在")), !1);
|
|
3915
|
-
},
|
|
4063
|
+
}, l.prototype.disablePath = function(e) {
|
|
3916
4064
|
var n = this.paths.get(e);
|
|
3917
4065
|
return n ? (n.enabled = !1, this.hooks.emit("pathDisable", e), !0) : (console.warn("DynamicPathLinePlugin: 路径 ".concat(e, " 不存在")), !1);
|
|
3918
|
-
},
|
|
4066
|
+
}, l.prototype.showPath = function(e) {
|
|
3919
4067
|
var n = this.paths.get(e);
|
|
3920
4068
|
return n ? (n.visible = !0, n.lines.forEach(function(t) {
|
|
3921
4069
|
return t.visible = !0;
|
|
3922
4070
|
}), n.particles.visible = !0, n.subMesh.visible = !0, this.hooks.emit("pathShow", e), !0) : (console.warn("DynamicPathLinePlugin: 路径 ".concat(e, " 不存在")), !1);
|
|
3923
|
-
},
|
|
4071
|
+
}, l.prototype.hidePath = function(e) {
|
|
3924
4072
|
var n = this.paths.get(e);
|
|
3925
4073
|
return n ? (n.visible = !1, n.lines.forEach(function(t) {
|
|
3926
4074
|
return t.visible = !1;
|
|
3927
4075
|
}), n.particles.visible = !1, n.subMesh.visible = !1, this.hooks.emit("pathHide", e), !0) : (console.warn("DynamicPathLinePlugin: 路径 ".concat(e, " 不存在")), !1);
|
|
3928
|
-
},
|
|
4076
|
+
}, l.prototype.getPathIds = function() {
|
|
3929
4077
|
return Array.from(this.paths.keys());
|
|
3930
|
-
},
|
|
4078
|
+
}, l.prototype.getPathConfig = function(e) {
|
|
3931
4079
|
var n = this.paths.get(e);
|
|
3932
|
-
return n ?
|
|
3933
|
-
},
|
|
4080
|
+
return n ? N({}, n.config) : void 0;
|
|
4081
|
+
}, l.prototype.clearAllPaths = function() {
|
|
3934
4082
|
var e = this;
|
|
3935
|
-
this.paths.forEach(function(r,
|
|
3936
|
-
e.stopPathAnimation(
|
|
4083
|
+
this.paths.forEach(function(r, s) {
|
|
4084
|
+
e.stopPathAnimation(s), e.disposePathResources(r);
|
|
3937
4085
|
}), this.paths.clear();
|
|
3938
4086
|
var n = this.data, t = /* @__PURE__ */ new Map();
|
|
3939
|
-
this.paths.forEach(function(r,
|
|
3940
|
-
t.set(
|
|
4087
|
+
this.paths.forEach(function(r, s) {
|
|
4088
|
+
t.set(s, r.config);
|
|
3941
4089
|
}), this.data = { paths: t }, this.hooks.emit("dataChange", this.data, n);
|
|
3942
|
-
},
|
|
3943
|
-
for (var t = [], r = [],
|
|
3944
|
-
var c =
|
|
3945
|
-
|
|
4090
|
+
}, l.prototype.getPositions = function(e, n) {
|
|
4091
|
+
for (var t = [], r = [], s = 0, i = [], h = 0; h <= n; h++) {
|
|
4092
|
+
var c = h / n, v = e.getPoint(c);
|
|
4093
|
+
i.push(v.clone()), h > 0 && (s += v.distanceTo(i[h - 1]));
|
|
3946
4094
|
}
|
|
3947
|
-
for (var y = 0,
|
|
3948
|
-
|
|
3949
|
-
var M = y /
|
|
3950
|
-
t.push(
|
|
4095
|
+
for (var y = 0, h = 0; h < n; h++) {
|
|
4096
|
+
h > 0 && (y += i[h].distanceTo(i[h - 1]));
|
|
4097
|
+
var M = y / s;
|
|
4098
|
+
t.push(i[h].x, i[h].y, i[h].z), r.push(M);
|
|
3951
4099
|
}
|
|
3952
4100
|
return { positions: t, distanceProgress: r };
|
|
3953
|
-
},
|
|
3954
|
-
for (var r = this,
|
|
3955
|
-
var
|
|
3956
|
-
var
|
|
3957
|
-
return
|
|
3958
|
-
}),
|
|
3959
|
-
|
|
3960
|
-
var
|
|
4101
|
+
}, l.prototype.createLines = function(e, n, t) {
|
|
4102
|
+
for (var r = this, s, i, h = [], c = e.points.length * 40, v = this._config, y = v.lineCount, M = v.spacing, w = v.waveAmp, P = v.waveFreq, S = v.lineYOffset, _ = (s = e.lineWidth) !== null && s !== void 0 ? s : this._config.lineWidth, E = (i = e.color) !== null && i !== void 0 ? i : this._config.color, b = n.getLength(), T = t / b, f = function(F) {
|
|
4103
|
+
var V = (F - (y - 1) / 2) * M, Y = e.points.map(function(L, k) {
|
|
4104
|
+
var I = k / (e.points.length - 1), D = n.getTangent(I).normalize(), W = new p.Vector3().crossVectors(r.up, D).normalize(), $ = V * Math.abs((k - e.points.length / 2) / e.points.length - 0.5) * -1;
|
|
4105
|
+
return L.clone().addScaledVector(W, V + $).add(new p.Vector3(0, S + 0.02 * (F % 2 === 0 ? 1 : 0), 0));
|
|
4106
|
+
}), G = new p.CatmullRomCurve3(Y), q = C.getPositions(G, c).positions, Q = new nn();
|
|
4107
|
+
Q.setPositions(q);
|
|
4108
|
+
var R = new kt({
|
|
3961
4109
|
color: E,
|
|
3962
|
-
linewidth:
|
|
4110
|
+
linewidth: _ * (F % 2 === 0 ? 1 : 0.5),
|
|
3963
4111
|
transparent: !0,
|
|
3964
4112
|
opacity: 1,
|
|
3965
4113
|
depthWrite: !1
|
|
3966
4114
|
});
|
|
3967
|
-
|
|
4115
|
+
R.resolution.set(C.five.camera.resolution.x, C.five.camera.resolution.y), F === 0 ? R.waveDir = 1 : F === 1 ? R.waveDir = 2 : F === 2 ? R.waveDir = 0 : F === 3 ? R.waveDir = 3 : F === 4 && (R.waveDir = 1), R.waveAmp = w, R.waveFreq = P, Object.assign(R.uniforms, {
|
|
3968
4116
|
time: { value: 0 },
|
|
3969
4117
|
startOffset: { value: 0 },
|
|
3970
4118
|
range: { value: T }
|
|
3971
4119
|
});
|
|
3972
|
-
var
|
|
3973
|
-
|
|
3974
|
-
},
|
|
3975
|
-
f(
|
|
3976
|
-
return
|
|
3977
|
-
},
|
|
4120
|
+
var H = new tn(Q, R);
|
|
4121
|
+
H.computeLineDistances(), h.push(H), C.five.scene.add(H);
|
|
4122
|
+
}, C = this, x = 0; x < y; x++)
|
|
4123
|
+
f(x);
|
|
4124
|
+
return h;
|
|
4125
|
+
}, l.prototype.createParticleMaterial = function() {
|
|
3978
4126
|
return new p.ShaderMaterial({
|
|
3979
4127
|
transparent: !0,
|
|
3980
4128
|
blending: p.AdditiveBlending,
|
|
@@ -4000,9 +4148,9 @@ var Qn = (
|
|
|
4000
4148
|
}
|
|
4001
4149
|
`
|
|
4002
4150
|
});
|
|
4003
|
-
},
|
|
4004
|
-
for (var e = this._config.particleCount, n = new Float32Array(e * 3), t = new p.BufferGeometry(), r = this.createParticleMaterial(),
|
|
4005
|
-
n[c * 3] = 9999, n[c * 3 + 1] = 9999, n[c * 3 + 2] = 9999,
|
|
4151
|
+
}, l.prototype.createParticles = function() {
|
|
4152
|
+
for (var e = this._config.particleCount, n = new Float32Array(e * 3), t = new p.BufferGeometry(), r = this.createParticleMaterial(), s = new p.Points(t, r), i = new Float32Array(e), h = [], c = 0; c < e; c++)
|
|
4153
|
+
n[c * 3] = 9999, n[c * 3 + 1] = 9999, n[c * 3 + 2] = 9999, i[c] = p.MathUtils.randFloat(3, 9), h.push({
|
|
4006
4154
|
velocity: new p.Vector3(),
|
|
4007
4155
|
life: 3 + Math.random() * 2,
|
|
4008
4156
|
age: 0,
|
|
@@ -4010,35 +4158,35 @@ var Qn = (
|
|
|
4010
4158
|
alpha: 0,
|
|
4011
4159
|
startPos: new p.Vector3()
|
|
4012
4160
|
});
|
|
4013
|
-
return t.setAttribute("position", new p.BufferAttribute(n, 3)), t.setAttribute("size", new p.BufferAttribute(
|
|
4014
|
-
},
|
|
4015
|
-
for (var r = e.points.length * 40,
|
|
4016
|
-
M +=
|
|
4017
|
-
for (var
|
|
4018
|
-
var
|
|
4019
|
-
|
|
4020
|
-
var
|
|
4021
|
-
|
|
4161
|
+
return t.setAttribute("position", new p.BufferAttribute(n, 3)), t.setAttribute("size", new p.BufferAttribute(i, 1)), s.frustumCulled = !1, this.five.scene.add(s), { particles: s, particleGeometry: t, particleMaterial: r, particleInfos: h, particlePositions: n };
|
|
4162
|
+
}, l.prototype.createSubMeshGeometry = function(e, n, t) {
|
|
4163
|
+
for (var r = e.points.length * 40, s = new p.BufferGeometry(), i = n.getPoints(r), h = [], c = [], v = [], y = [], M = 0, w = [0], P = 1; P < i.length; P++)
|
|
4164
|
+
M += i[P].distanceTo(i[P - 1]), w.push(M);
|
|
4165
|
+
for (var S = M, P = 0; P < i.length; P++) {
|
|
4166
|
+
var _ = i[P], E = P / (i.length - 1), b = n.getTangent(E).normalize(), T = new p.Vector3().crossVectors(this.up, b).normalize(), f = t / 2, C = _.clone().addScaledVector(T, -f);
|
|
4167
|
+
h.push(C.x, C.y, C.z), c.push(0, w[P] / S), y.push(w[P] / S);
|
|
4168
|
+
var x = _.clone().addScaledVector(T, f);
|
|
4169
|
+
h.push(x.x, x.y, x.z), c.push(1, w[P] / S), y.push(w[P] / S);
|
|
4022
4170
|
}
|
|
4023
|
-
for (var
|
|
4024
|
-
var
|
|
4025
|
-
|
|
4171
|
+
for (var P = 0; P < i.length - 1; P++) {
|
|
4172
|
+
var F = P * 2;
|
|
4173
|
+
v.push(F, F + 1, F + 2), v.push(F + 1, F + 3, F + 2);
|
|
4026
4174
|
}
|
|
4027
|
-
return
|
|
4028
|
-
},
|
|
4029
|
-
for (var
|
|
4030
|
-
var
|
|
4031
|
-
if (f > 0.5 && (f = 1 - f), f <
|
|
4032
|
-
var
|
|
4033
|
-
T = r + (
|
|
4175
|
+
return s.setAttribute("position", new p.Float32BufferAttribute(h, 3)), s.setAttribute("uv", new p.Float32BufferAttribute(c, 2)), s.setAttribute("distanceProgress", new p.Float32BufferAttribute(y, 1)), s.setIndex(v), s.computeVertexNormals(), s;
|
|
4176
|
+
}, l.prototype.createAlphaMapTexture = function(e, n, t, r, s) {
|
|
4177
|
+
for (var i = 1024, h = 1, c = i * h, v = new Uint8Array(c), y = 1 / e, M = t / e, w = n / M, P = w / 2, S = 0; S < i; S++) {
|
|
4178
|
+
var _ = S / i, E = Math.floor(_ / y), b = (_ - E * y) / y, T = 0, f = b;
|
|
4179
|
+
if (f > 0.5 && (f = 1 - f), f < P) {
|
|
4180
|
+
var C = 1 - f / P, x = C;
|
|
4181
|
+
T = r + (s - r) * x;
|
|
4034
4182
|
} else
|
|
4035
4183
|
T = r;
|
|
4036
|
-
|
|
4184
|
+
v[S] = Math.floor(T * 255);
|
|
4037
4185
|
}
|
|
4038
|
-
var
|
|
4039
|
-
return
|
|
4040
|
-
},
|
|
4041
|
-
var
|
|
4186
|
+
var F = new p.DataTexture(v, i, h, p.RedFormat);
|
|
4187
|
+
return F.needsUpdate = !0, F.wrapS = p.RepeatWrapping, F.wrapT = p.ClampToEdgeWrapping, F.minFilter = p.LinearFilter, F.magFilter = p.LinearFilter, F;
|
|
4188
|
+
}, l.prototype.createSubMeshMaterial = function(e, n, t, r) {
|
|
4189
|
+
var s = this._config, i = s.subMeshSegmentInterval, h = s.subMeshHighlightWidth, c = s.subMeshMaxOpacity, v = Math.max(1, Math.round(t / i)), y = r / t, M = this.createAlphaMapTexture(v, h, t, n, c);
|
|
4042
4190
|
return new p.ShaderMaterial({
|
|
4043
4191
|
transparent: !0,
|
|
4044
4192
|
side: p.BackSide,
|
|
@@ -4127,135 +4275,135 @@ var Qn = (
|
|
|
4127
4275
|
}
|
|
4128
4276
|
`
|
|
4129
4277
|
});
|
|
4130
|
-
},
|
|
4131
|
-
for (var t = [], r = 0,
|
|
4132
|
-
var
|
|
4133
|
-
|
|
4134
|
-
var
|
|
4278
|
+
}, l.prototype.projectPointsToScreen = function(e, n) {
|
|
4279
|
+
for (var t = [], r = 0, s = 0; s < e.length; s++) {
|
|
4280
|
+
var i = e[s];
|
|
4281
|
+
s > 0 && (r += i.distanceTo(e[s - 1]));
|
|
4282
|
+
var h = i.clone().project(n), c = h.x < -1 || h.x > 1 || h.y < -1 || h.y > 1 || h.z < -1 || h.z > 1;
|
|
4135
4283
|
t.push({
|
|
4136
|
-
point:
|
|
4137
|
-
screenPos: new p.Vector2(
|
|
4284
|
+
point: i.clone(),
|
|
4285
|
+
screenPos: new p.Vector2(h.x, h.y),
|
|
4138
4286
|
distanceFromStart: r,
|
|
4139
4287
|
isOffscreen: c
|
|
4140
4288
|
});
|
|
4141
4289
|
}
|
|
4142
4290
|
return t;
|
|
4143
|
-
},
|
|
4144
|
-
for (var n = -1, t = 0, r = -1,
|
|
4145
|
-
if (!e[
|
|
4146
|
-
r =
|
|
4291
|
+
}, l.prototype.findNearestOffscreenPoint = function(e) {
|
|
4292
|
+
for (var n = -1, t = 0, r = -1, s = 0; s < e.length; s++)
|
|
4293
|
+
if (!e[s].isOffscreen) {
|
|
4294
|
+
r = s;
|
|
4147
4295
|
break;
|
|
4148
4296
|
}
|
|
4149
4297
|
if (r === -1)
|
|
4150
4298
|
return null;
|
|
4151
|
-
for (var
|
|
4152
|
-
if (e[
|
|
4153
|
-
n =
|
|
4299
|
+
for (var s = r - 1; s >= 0; s--)
|
|
4300
|
+
if (e[s].isOffscreen) {
|
|
4301
|
+
n = s, t = e[s].distanceFromStart;
|
|
4154
4302
|
break;
|
|
4155
4303
|
}
|
|
4156
4304
|
return n === -1 ? { index: 0, distance: 0 } : {
|
|
4157
4305
|
index: n,
|
|
4158
4306
|
distance: t
|
|
4159
4307
|
};
|
|
4160
|
-
},
|
|
4161
|
-
for (var n, t = ((n = e[e.length - 1]) === null || n === void 0 ? void 0 : n.distanceFromStart) || 0, r = -1,
|
|
4162
|
-
if (!e[
|
|
4163
|
-
r =
|
|
4308
|
+
}, l.prototype.findFarestOffscreenPoint = function(e) {
|
|
4309
|
+
for (var n, t = ((n = e[e.length - 1]) === null || n === void 0 ? void 0 : n.distanceFromStart) || 0, r = -1, s = e.length - 1; s >= 0; s--)
|
|
4310
|
+
if (!e[s].isOffscreen) {
|
|
4311
|
+
r = s;
|
|
4164
4312
|
break;
|
|
4165
4313
|
}
|
|
4166
4314
|
if (r === -1)
|
|
4167
4315
|
return null;
|
|
4168
|
-
var
|
|
4169
|
-
return
|
|
4170
|
-
index:
|
|
4171
|
-
distance: e[
|
|
4316
|
+
var i = r + 1;
|
|
4317
|
+
return i < e.length && e[i].isOffscreen ? {
|
|
4318
|
+
index: i,
|
|
4319
|
+
distance: e[i].distanceFromStart,
|
|
4172
4320
|
totalLength: t
|
|
4173
4321
|
} : { index: e.length - 1, distance: t, totalLength: t };
|
|
4174
|
-
},
|
|
4322
|
+
}, l.prototype.updatePathAnimation = function(e) {
|
|
4175
4323
|
var n, t, r = this.paths.get(e);
|
|
4176
4324
|
if (!(!r || !r.enabled)) {
|
|
4177
|
-
var
|
|
4325
|
+
var s = performance.now() / 1e3, i = this._config, h = i.particleCount, c = i.maxDistance, v = ((n = r.lines[0]) === null || n === void 0 ? void 0 : n.material.uniforms.totalLength.value) || 1, y = Math.max(0.01, v - r.startOffset - r.endOffset), M = r.speed, w = (s - r.cycleStartTime) * M / y % 1;
|
|
4178
4326
|
if (r.isInitialAnimation) {
|
|
4179
|
-
var
|
|
4180
|
-
if (r.enableSubMesh &&
|
|
4181
|
-
var
|
|
4182
|
-
r.subMeshUnfoldProgress = Math.min(1,
|
|
4327
|
+
var P = w * y;
|
|
4328
|
+
if (r.enableSubMesh && P >= 1 && !r.subMeshUnfoldStarted && (r.subMeshUnfoldStarted = !0, r.subMeshUnfoldStartTime = s), r.enableSubMesh && r.subMeshUnfoldStarted && r.subMeshUnfoldProgress < 1 && !r.isPaused) {
|
|
4329
|
+
var S = (t = r.config.range) !== null && t !== void 0 ? t : this._config.range, _ = s - r.subMeshUnfoldStartTime;
|
|
4330
|
+
r.subMeshUnfoldProgress = Math.min(1, _ * M / (y - 2 * S)), r.subMeshMaterial.uniforms.unfoldProgress.value = r.subMeshUnfoldProgress;
|
|
4183
4331
|
}
|
|
4184
4332
|
w < r.lastAnimationProgress && (r.isPathlineInitialAnimation = !1, (!r.enableSubMesh || r.subMeshUnfoldProgress >= 1) && (r.isInitialAnimation = !1));
|
|
4185
4333
|
} else
|
|
4186
4334
|
r.enableSubMesh && (r.subMeshMaterial.uniforms.unfoldProgress.value = 1);
|
|
4187
|
-
if (r.lastAnimationProgress = w, r.lastUpdateTime =
|
|
4188
|
-
|
|
4335
|
+
if (r.lastAnimationProgress = w, r.lastUpdateTime = s, r.isPathlineInitialAnimation && r.lines.forEach(function(G) {
|
|
4336
|
+
G.material.uniforms.time.value = s, G.material.uniforms.animationProgress.value = w;
|
|
4189
4337
|
}), r.isPathlineInitialAnimation) {
|
|
4190
4338
|
var E = null, b = 1 / 0;
|
|
4191
|
-
if (r.lines.forEach(function(
|
|
4192
|
-
for (var
|
|
4193
|
-
var
|
|
4194
|
-
if (w >=
|
|
4195
|
-
var
|
|
4196
|
-
|
|
4339
|
+
if (r.lines.forEach(function(G) {
|
|
4340
|
+
for (var q = G.geometry, Q = q.attributes.instanceDistanceStart, R = q.attributes.instanceDistanceEnd, H = Q.count, L = 0; L < H; L++) {
|
|
4341
|
+
var k = Q.getX(L) / G.material.uniforms.totalLength.value, I = R.getX(L) / G.material.uniforms.totalLength.value;
|
|
4342
|
+
if (w >= k && w <= I) {
|
|
4343
|
+
var D = (w - k) / (I - k), W = new p.Vector3().fromBufferAttribute(q.attributes.instanceStart, L), $ = new p.Vector3().fromBufferAttribute(q.attributes.instanceEnd, L), Z = new p.Vector3().lerpVectors(W, $, D), B = Math.abs(w - (k + I) / 2);
|
|
4344
|
+
B < b && (b = B, E = Z);
|
|
4197
4345
|
}
|
|
4198
4346
|
}
|
|
4199
4347
|
}), E)
|
|
4200
|
-
for (var T = 0; T <
|
|
4348
|
+
for (var T = 0; T < h; T++) {
|
|
4201
4349
|
var f = r.particleInfos[T];
|
|
4202
4350
|
!f.active && Math.random() < 0.05 && (f.active = !0, f.age = 0, f.life = 3 + Math.random() * 2, f.velocity.set((Math.random() - 0.5) * 1e-4, (Math.random() - 0.5) * 1e-4, (Math.random() - 0.5) * 1e-4), r.particlePositions[T * 3] = E.x, r.particlePositions[T * 3 + 1] = E.y, r.particlePositions[T * 3 + 2] = E.z, f.startPos.copy(E), f.alpha = 0);
|
|
4203
4351
|
}
|
|
4204
|
-
for (var T = 0; T <
|
|
4352
|
+
for (var T = 0; T < h; T++) {
|
|
4205
4353
|
var f = r.particleInfos[T];
|
|
4206
4354
|
if (f.active) {
|
|
4207
4355
|
f.age += 0.016;
|
|
4208
|
-
var
|
|
4209
|
-
(
|
|
4210
|
-
var
|
|
4211
|
-
|
|
4356
|
+
var C = r.particlePositions[T * 3] - f.startPos.x, x = r.particlePositions[T * 3 + 1] - f.startPos.y, F = r.particlePositions[T * 3 + 2] - f.startPos.z, V = Math.sqrt(C * C + x * x + F * F);
|
|
4357
|
+
(V >= c || f.age >= f.life) && (f.active = !1, r.particlePositions[T * 3] = 9999, r.particlePositions[T * 3 + 1] = 9999, r.particlePositions[T * 3 + 2] = 9999, f.alpha = 0), f.velocity.x += (Math.random() - 0.5) * 1e-4, f.velocity.z += (Math.random() - 0.5) * 1e-4, f.velocity.y += 1e-4, f.velocity.multiplyScalar(0.99), r.particlePositions[T * 3] += f.velocity.x, r.particlePositions[T * 3 + 1] += f.velocity.y, r.particlePositions[T * 3 + 2] += f.velocity.z;
|
|
4358
|
+
var Y = f.age / f.life;
|
|
4359
|
+
Y < 0.2 ? f.alpha = Y / 0.2 : Y > 0.8 ? f.alpha = (1 - Y) / 0.2 : f.alpha = 1;
|
|
4212
4360
|
}
|
|
4213
4361
|
}
|
|
4214
4362
|
r.particleGeometry.attributes.position.needsUpdate = !0, r.particleMaterial.opacity = 0.6;
|
|
4215
4363
|
}
|
|
4216
4364
|
r.enableSubMesh && (r.subMeshMaterial.uniforms.animationProgress.value = w), this.five.needsRender = !0;
|
|
4217
4365
|
}
|
|
4218
|
-
},
|
|
4219
|
-
var t = this, r,
|
|
4220
|
-
if (!
|
|
4366
|
+
}, l.prototype.startPathAnimation = function(e, n) {
|
|
4367
|
+
var t = this, r, s, i = this.paths.get(e);
|
|
4368
|
+
if (!i)
|
|
4221
4369
|
return console.warn("DynamicPathLinePlugin: 路径 ".concat(e, " 不存在")), !1;
|
|
4222
|
-
if (
|
|
4370
|
+
if (i.animationId !== null)
|
|
4223
4371
|
return !1;
|
|
4224
|
-
var
|
|
4225
|
-
if (!
|
|
4226
|
-
var
|
|
4372
|
+
var h = (r = n == null ? void 0 : n.startPointIndex) !== null && r !== void 0 ? r : 0, c = (s = n == null ? void 0 : n.fromStart) !== null && s !== void 0 ? s : !1;
|
|
4373
|
+
if (!i.isPaused || c) {
|
|
4374
|
+
var v = 0, y = h;
|
|
4227
4375
|
if (y > 0) {
|
|
4228
|
-
var M =
|
|
4376
|
+
var M = i.config.points;
|
|
4229
4377
|
y >= M.length && (console.warn("DynamicPathLinePlugin: startPointIndex ".concat(y, " 超出范围,路径只有 ").concat(M.length, " 个点")), y = M.length - 1);
|
|
4230
4378
|
for (var w = 0; w < y; w++)
|
|
4231
|
-
|
|
4379
|
+
v += M[w].distanceTo(M[w + 1]);
|
|
4232
4380
|
}
|
|
4233
|
-
|
|
4234
|
-
T.material.uniforms.startOffset.value =
|
|
4235
|
-
}),
|
|
4381
|
+
i.startOffset = v, i.lines.forEach(function(T) {
|
|
4382
|
+
T.material.uniforms.startOffset.value = v;
|
|
4383
|
+
}), i.enableSubMesh && (i.subMeshMaterial.uniforms.startOffset.value = v);
|
|
4236
4384
|
}
|
|
4237
|
-
var
|
|
4238
|
-
if (!c &&
|
|
4239
|
-
var
|
|
4240
|
-
if (
|
|
4241
|
-
var b =
|
|
4242
|
-
|
|
4385
|
+
var P = performance.now() / 1e3;
|
|
4386
|
+
if (!c && i.isPaused && i.pausedProgress > 0) {
|
|
4387
|
+
var S = i.curve.getLength(), _ = Math.max(0.01, S - i.startOffset - i.endOffset), E = i.speed;
|
|
4388
|
+
if (i.cycleStartTime = P - i.pausedProgress * _ / E, i.subMeshUnfoldStarted && i.subMeshUnfoldProgress < 1) {
|
|
4389
|
+
var b = i.pausedTime - i.subMeshUnfoldStartTime;
|
|
4390
|
+
i.subMeshUnfoldStartTime = P - b;
|
|
4243
4391
|
}
|
|
4244
|
-
|
|
4392
|
+
i.isPaused = !1;
|
|
4245
4393
|
} else
|
|
4246
|
-
|
|
4247
|
-
return
|
|
4394
|
+
i.cycleStartTime = P, i.isPaused = !1, i.pausedProgress = 0;
|
|
4395
|
+
return i.lastUpdateTime = P, this.highlightPath(e, !0), i.animationId = Ie.shared.add(function() {
|
|
4248
4396
|
t.updatePathAnimation(e);
|
|
4249
4397
|
}), !0;
|
|
4250
|
-
},
|
|
4398
|
+
}, l.prototype.stopPathAnimation = function(e, n) {
|
|
4251
4399
|
n === void 0 && (n = !1);
|
|
4252
4400
|
var t = this.paths.get(e);
|
|
4253
4401
|
if (!t)
|
|
4254
4402
|
return console.warn("DynamicPathLinePlugin: 路径 ".concat(e, " 不存在")), !1;
|
|
4255
4403
|
if (this.highlightPath(e, !1), t.animationId !== null) {
|
|
4256
4404
|
if (n) {
|
|
4257
|
-
var r = performance.now() / 1e3,
|
|
4258
|
-
if (t.pausedProgress = (r - t.cycleStartTime) *
|
|
4405
|
+
var r = performance.now() / 1e3, s = t.curve.getLength(), i = Math.max(0.01, s - t.startOffset - t.endOffset), h = t.speed;
|
|
4406
|
+
if (t.pausedProgress = (r - t.cycleStartTime) * h / i % 1, t.pausedTime = r, t.isPaused = !0, t.subMeshUnfoldStarted && t.subMeshUnfoldProgress < 1) {
|
|
4259
4407
|
var c = r - t.subMeshUnfoldStartTime;
|
|
4260
4408
|
t.subMeshUnfoldStartTime = r - c;
|
|
4261
4409
|
}
|
|
@@ -4264,108 +4412,108 @@ var Qn = (
|
|
|
4264
4412
|
t.animationId(), t.animationId = null;
|
|
4265
4413
|
}
|
|
4266
4414
|
return !0;
|
|
4267
|
-
},
|
|
4415
|
+
}, l.prototype._enable = function(e) {
|
|
4268
4416
|
this.paths.size > 0 && this.state.playing && this.play();
|
|
4269
|
-
},
|
|
4417
|
+
}, l.prototype._disable = function(e) {
|
|
4270
4418
|
this.pause();
|
|
4271
|
-
},
|
|
4419
|
+
}, l.prototype.enable = function(e) {
|
|
4272
4420
|
var n;
|
|
4273
4421
|
if (!this.state.enabled) {
|
|
4274
4422
|
var t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
4275
4423
|
this.updateState({ enabled: !0 }, t), this._enable({ userAction: t });
|
|
4276
4424
|
}
|
|
4277
|
-
},
|
|
4425
|
+
}, l.prototype.disable = function(e) {
|
|
4278
4426
|
var n;
|
|
4279
4427
|
if (this.state.enabled !== !1) {
|
|
4280
4428
|
var t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
4281
4429
|
this.updateState({ enabled: !1 }, t), this._disable({ userAction: t });
|
|
4282
4430
|
}
|
|
4283
|
-
},
|
|
4431
|
+
}, l.prototype.show = function(e) {
|
|
4284
4432
|
var n, t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
4285
4433
|
this.paths.forEach(function(r) {
|
|
4286
|
-
r.lines.forEach(function(
|
|
4287
|
-
return
|
|
4434
|
+
r.lines.forEach(function(s) {
|
|
4435
|
+
return s.visible = !0;
|
|
4288
4436
|
}), r.particles.visible = !0, r.subMesh.visible = !0;
|
|
4289
4437
|
}), this.updateState({ visible: !0 }, t);
|
|
4290
|
-
},
|
|
4438
|
+
}, l.prototype.hide = function(e) {
|
|
4291
4439
|
var n, t = (n = e == null ? void 0 : e.userAction) !== null && n !== void 0 ? n : !0;
|
|
4292
4440
|
this.paths.forEach(function(r) {
|
|
4293
|
-
r.lines.forEach(function(
|
|
4294
|
-
return
|
|
4441
|
+
r.lines.forEach(function(s) {
|
|
4442
|
+
return s.visible = !1;
|
|
4295
4443
|
}), r.particles.visible = !1, r.subMesh.visible = !1;
|
|
4296
4444
|
}), this.updateState({ visible: !1 }, t);
|
|
4297
|
-
},
|
|
4445
|
+
}, l.prototype.setState = function(e, n) {
|
|
4298
4446
|
var t;
|
|
4299
4447
|
t = n == null ? void 0 : n.userAction, e.enabled !== void 0 && e.enabled !== this.state.enabled && (e.enabled ? this.enable(n) : this.disable(n)), e.visible !== void 0 && e.visible !== this.state.visible && (e.visible ? this.show(n) : this.hide(n));
|
|
4300
|
-
},
|
|
4448
|
+
}, l.prototype.play = function(e) {
|
|
4301
4449
|
var n = this;
|
|
4302
4450
|
e === void 0 && (e = !1), this.paths.forEach(function(t, r) {
|
|
4303
4451
|
n.startPathAnimation(r, { fromStart: e });
|
|
4304
4452
|
}), this.updateState({ playing: !0 }, !1), this.hooks.emit("animationStart");
|
|
4305
|
-
},
|
|
4453
|
+
}, l.prototype.pause = function() {
|
|
4306
4454
|
var e = this;
|
|
4307
4455
|
this.paths.forEach(function(n, t) {
|
|
4308
4456
|
e.stopPathAnimation(t, !0);
|
|
4309
4457
|
}), this.updateState({ playing: !1 }, !1), this.hooks.emit("animationStop");
|
|
4310
|
-
},
|
|
4458
|
+
}, l.prototype.reset = function() {
|
|
4311
4459
|
var e = this;
|
|
4312
4460
|
this.paths.forEach(function(n, t) {
|
|
4313
4461
|
e.stopPathAnimation(t);
|
|
4314
4462
|
}), this.paths.forEach(function(n) {
|
|
4315
|
-
n.isInitialAnimation = !0, n.isPathlineInitialAnimation = !0, n.subMeshUnfoldProgress = 0, n.subMeshUnfoldStarted = !1, n.subMeshUnfoldStartTime = 0, n.lastAnimationProgress = 0, n.cycleStartTime = performance.now() / 1e3, n.lastUpdateTime = performance.now() / 1e3, n.startOffset = 0, n.endOffset = 0, n.isPaused = !1, n.pausedProgress = 0, n.pausedTime = 0, n.lines.forEach(function(
|
|
4316
|
-
|
|
4463
|
+
n.isInitialAnimation = !0, n.isPathlineInitialAnimation = !0, n.subMeshUnfoldProgress = 0, n.subMeshUnfoldStarted = !1, n.subMeshUnfoldStartTime = 0, n.lastAnimationProgress = 0, n.cycleStartTime = performance.now() / 1e3, n.lastUpdateTime = performance.now() / 1e3, n.startOffset = 0, n.endOffset = 0, n.isPaused = !1, n.pausedProgress = 0, n.pausedTime = 0, n.lines.forEach(function(i) {
|
|
4464
|
+
i.visible = !0, i.material.uniforms.time.value = 0, i.material.uniforms.animationProgress.value = 0, i.material.uniforms.startOffset.value = 0, i.material.uniforms.endOffset.value = 0;
|
|
4317
4465
|
}), n.particles.visible = !0;
|
|
4318
4466
|
for (var t = e._config.particleCount, r = 0; r < t; r++) {
|
|
4319
|
-
var
|
|
4320
|
-
|
|
4467
|
+
var s = n.particleInfos[r];
|
|
4468
|
+
s.active = !1, s.age = 0, s.alpha = 0, n.particlePositions[r * 3] = 9999, n.particlePositions[r * 3 + 1] = 9999, n.particlePositions[r * 3 + 2] = 9999;
|
|
4321
4469
|
}
|
|
4322
4470
|
n.particleGeometry.attributes.position.needsUpdate = !0, n.subMeshMaterial && (n.subMeshMaterial.uniforms.unfoldProgress.value = 0, n.subMeshMaterial.uniforms.animationProgress.value = 0, n.subMeshMaterial.uniforms.startOffset.value = 0, n.subMeshMaterial.uniforms.endOffset.value = 0);
|
|
4323
4471
|
});
|
|
4324
|
-
},
|
|
4472
|
+
}, l.prototype.highlightPath = function(e, n) {
|
|
4325
4473
|
var t = this, r = this.paths.get(e);
|
|
4326
4474
|
if (r)
|
|
4327
|
-
var
|
|
4328
|
-
|
|
4329
|
-
M.material.uniforms.opacity.value = 0.3 +
|
|
4330
|
-
}), r.particleMaterial.opacity = 0.3 +
|
|
4331
|
-
M.material.uniforms.opacity.value = 1 -
|
|
4332
|
-
}), r.particleMaterial.opacity = 0.6 * (1 -
|
|
4475
|
+
var s = r.lines, i = 0, h = 250, c = Ie.shared.add(function(v, y) {
|
|
4476
|
+
i = Math.min(1, i + y / h), n ? (s.forEach(function(M) {
|
|
4477
|
+
M.material.uniforms.opacity.value = 0.3 + i * 0.7;
|
|
4478
|
+
}), r.particleMaterial.opacity = 0.3 + i * 0.7, r.enableSubMesh && (r.subMeshMaterial.uniforms.globalOpacity.value = 0.3 + i * 0.7)) : (s.forEach(function(M) {
|
|
4479
|
+
M.material.uniforms.opacity.value = 1 - i * 0.7;
|
|
4480
|
+
}), r.particleMaterial.opacity = 0.6 * (1 - i * 0.7), r.enableSubMesh && (r.subMeshMaterial.uniforms.globalOpacity.value = 1 - i * 0.7)), t.five.needsRender = !0, i === 1 && c();
|
|
4333
4481
|
});
|
|
4334
|
-
},
|
|
4335
|
-
var n = this, t = function(
|
|
4336
|
-
var
|
|
4337
|
-
|
|
4338
|
-
var c = n.findFarestOffscreenPoint(
|
|
4339
|
-
c && (
|
|
4340
|
-
|
|
4341
|
-
}),
|
|
4482
|
+
}, l.prototype.updateScreenProjection = function(e) {
|
|
4483
|
+
var n = this, t = function(s) {
|
|
4484
|
+
var i = n.projectPointsToScreen(s.config.points, n.five.camera), h = n.findNearestOffscreenPoint(i);
|
|
4485
|
+
h && (s.startOffset = h.distance);
|
|
4486
|
+
var c = n.findFarestOffscreenPoint(i);
|
|
4487
|
+
c && (s.endOffset = c.totalLength - c.distance), s.lines.forEach(function(v) {
|
|
4488
|
+
v.material.uniforms.startOffset.value = s.startOffset, v.material.uniforms.endOffset.value = s.endOffset;
|
|
4489
|
+
}), s.subMeshMaterial.uniforms.startOffset.value = s.startOffset, s.subMeshMaterial.uniforms.endOffset.value = s.endOffset, s.cycleStartTime = performance.now() / 1e3, s.lastAnimationProgress = 0;
|
|
4342
4490
|
};
|
|
4343
4491
|
if (e) {
|
|
4344
4492
|
var r = this.paths.get(e);
|
|
4345
4493
|
r && t(r);
|
|
4346
4494
|
} else
|
|
4347
|
-
this.paths.forEach(function(
|
|
4348
|
-
|
|
4495
|
+
this.paths.forEach(function(s) {
|
|
4496
|
+
s.enabled && t(s);
|
|
4349
4497
|
});
|
|
4350
|
-
},
|
|
4498
|
+
}, l.prototype.disposePathResources = function(e) {
|
|
4351
4499
|
var n = this;
|
|
4352
4500
|
e.lines.forEach(function(t) {
|
|
4353
4501
|
n.five.scene.remove(t), t.geometry.dispose(), t.material.dispose();
|
|
4354
4502
|
}), this.five.scene.remove(e.particles), e.particleGeometry.dispose(), e.particleMaterial.dispose(), this.five.scene.remove(e.subMesh), e.subMeshGeometry.dispose(), e.subMeshMaterial.dispose();
|
|
4355
|
-
},
|
|
4503
|
+
}, l.prototype.dispose = function() {
|
|
4356
4504
|
this.pause(), this.clearAllPaths(), this.hooks.emit("dispose");
|
|
4357
|
-
},
|
|
4358
|
-
})(
|
|
4359
|
-
), or = function(
|
|
4360
|
-
return new Qn(
|
|
4505
|
+
}, l;
|
|
4506
|
+
})(_t.Controller)
|
|
4507
|
+
), or = function(d, l) {
|
|
4508
|
+
return new Qn(d, l);
|
|
4361
4509
|
};
|
|
4362
4510
|
export {
|
|
4363
4511
|
rr as BackgroundPlugin,
|
|
4364
|
-
|
|
4365
|
-
|
|
4512
|
+
Xe as BasePlugin,
|
|
4513
|
+
Vn as CSS3DRenderer,
|
|
4366
4514
|
or as DynamicPathLinePlugin,
|
|
4367
4515
|
tr as ItemMaskPlugin,
|
|
4368
|
-
|
|
4516
|
+
qe as OrbitControls,
|
|
4369
4517
|
nr as OrientationPlugin,
|
|
4370
4518
|
ir as PanoAnimePlugin,
|
|
4371
4519
|
jn as RoundedBoxGeometry,
|