@realsee/dnalogel 3.77.2 → 3.77.3
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/CHANGELOG.md +3 -0
- package/dist/CruisePlugin/Work.d.ts +4 -0
- package/dist/CruisePlugin/typing.d.ts +7 -0
- package/dist/CruisePlugin/utils/coordinatesAngle.d.ts +19 -3
- package/dist/index.cjs.js +68 -68
- package/dist/index.js +4813 -4736
- package/dist/index.umd.js +63 -63
- package/libs/CruisePlugin/BaseController.js +8 -1
- package/libs/CruisePlugin/Work.d.ts +4 -0
- package/libs/CruisePlugin/Work.js +297 -213
- package/libs/CruisePlugin/typing.d.ts +7 -0
- package/libs/CruisePlugin/utils/coordinatesAngle.d.ts +19 -3
- package/libs/CruisePlugin/utils/coordinatesAngle.js +10 -5
- package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +7 -10
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var t in
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var t of
|
|
10
|
-
|
|
1
|
+
var K = Object.defineProperty, L = Object.defineProperties;
|
|
2
|
+
var A = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var F = Object.getOwnPropertySymbols;
|
|
4
|
+
var T = Object.prototype.hasOwnProperty, D = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var E = (h, f, t) => f in h ? K(h, f, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[f] = t, I = (h, f) => {
|
|
6
|
+
for (var t in f || (f = {}))
|
|
7
|
+
T.call(f, t) && E(h, t, f[t]);
|
|
8
|
+
if (F)
|
|
9
|
+
for (var t of F(f))
|
|
10
|
+
D.call(f, t) && E(h, t, f[t]);
|
|
11
11
|
return h;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
12
|
+
}, k = (h, f) => L(h, A(f));
|
|
13
|
+
var C = (h, f, t) => (E(h, typeof f != "symbol" ? f + "" : f, t), t);
|
|
14
|
+
var g = (h, f, t) => new Promise((i, r) => {
|
|
15
|
+
var o = (m) => {
|
|
16
16
|
try {
|
|
17
|
-
s(t.next(
|
|
18
|
-
} catch (
|
|
19
|
-
e
|
|
17
|
+
s(t.next(m));
|
|
18
|
+
} catch (e) {
|
|
19
|
+
r(e);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, n = (m) => {
|
|
22
22
|
try {
|
|
23
|
-
s(t.throw(
|
|
24
|
-
} catch (
|
|
25
|
-
e
|
|
23
|
+
s(t.throw(m));
|
|
24
|
+
} catch (e) {
|
|
25
|
+
r(e);
|
|
26
26
|
}
|
|
27
|
-
}, s = (
|
|
28
|
-
s((t = t.apply(h,
|
|
27
|
+
}, s = (m) => m.done ? i(m.value) : Promise.resolve(m.value).then(o, n);
|
|
28
|
+
s((t = t.apply(h, f)).next());
|
|
29
29
|
});
|
|
30
|
-
import { GuideLinePlugin as
|
|
31
|
-
import { uuid as
|
|
32
|
-
import {
|
|
33
|
-
import { safeCall as
|
|
34
|
-
import * as
|
|
35
|
-
import { sleep as
|
|
36
|
-
import { waitFiveLoaded as
|
|
37
|
-
import { vectorToCoordinates as
|
|
38
|
-
import
|
|
30
|
+
import { GuideLinePlugin as U } from "../GuideLinePlugin/index.js";
|
|
31
|
+
import { uuid as x } from "../shared-utils/uuid.js";
|
|
32
|
+
import { coordinatesRotation as M } from "./utils/coordinatesAngle.js";
|
|
33
|
+
import { safeCall as O } from "./utils/safeCall.js";
|
|
34
|
+
import * as G from "three";
|
|
35
|
+
import { sleep as Q } from "./utils/sleep.js";
|
|
36
|
+
import { waitFiveLoaded as R } from "../shared-utils/five/fiveLoaded.js";
|
|
37
|
+
import { vectorToCoordinates as _ } from "../shared-utils/vectorToCoordinate.js";
|
|
38
|
+
import V from "./BaseController.js";
|
|
39
39
|
import "../shared-utils/tag.js";
|
|
40
40
|
import "../vendor/hammerjs/hammer.js";
|
|
41
41
|
import "../shared-utils/three/PointSelector/index.js";
|
|
42
42
|
import "../shared-utils/three/CSS3DRenderer/index.js";
|
|
43
43
|
import "../CSS3DRenderPlugin/utils/generateBehindFiveElement.js";
|
|
44
44
|
import "@realsee/five/line";
|
|
45
|
-
import { notNil as
|
|
45
|
+
import { notNil as W } from "../shared-utils/isNil.js";
|
|
46
46
|
import "../shared-utils/three/core/Five_LineMaterial2.js";
|
|
47
47
|
import "../shared-utils/three/core/Sphere.js";
|
|
48
48
|
import "../shared-utils/three/blink.js";
|
|
@@ -366,10 +366,10 @@ import "../CSS3DRenderPlugin/utils/getAllCSS3DObject.js";
|
|
|
366
366
|
import "../CSS3DRenderPlugin/utils/three/CSS3DGroup.js";
|
|
367
367
|
import "./Work.js";
|
|
368
368
|
import "./utils/coordinatesToVector.js";
|
|
369
|
-
class
|
|
369
|
+
class am extends V {
|
|
370
370
|
constructor(t, i) {
|
|
371
371
|
super(t, i);
|
|
372
|
-
|
|
372
|
+
C(this, "state", {
|
|
373
373
|
visible: !0,
|
|
374
374
|
enabled: !0,
|
|
375
375
|
disposed: !1,
|
|
@@ -384,7 +384,7 @@ class ia extends G {
|
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
});
|
|
387
|
-
|
|
387
|
+
C(this, "privateState", {
|
|
388
388
|
playing: !1,
|
|
389
389
|
currentPlayQueue: [],
|
|
390
390
|
currentPlayKeyframe: null,
|
|
@@ -396,30 +396,30 @@ class ia extends G {
|
|
|
396
396
|
/**
|
|
397
397
|
* @description Load Data and State
|
|
398
398
|
*/
|
|
399
|
-
load(t, i,
|
|
400
|
-
return
|
|
401
|
-
var
|
|
399
|
+
load(t, i, r) {
|
|
400
|
+
return g(this, null, function* () {
|
|
401
|
+
var a, p;
|
|
402
402
|
this.clear();
|
|
403
|
-
const
|
|
404
|
-
this.data =
|
|
405
|
-
let s = [],
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
var
|
|
409
|
-
return
|
|
410
|
-
}).map((
|
|
411
|
-
var
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
414
|
-
if (
|
|
415
|
-
const
|
|
416
|
-
s[
|
|
403
|
+
const o = this.data ? JSON.parse(JSON.stringify(this.data)) : void 0, n = yield this.formatData(t);
|
|
404
|
+
this.data = I({ id: n.keyframesId }, n), this.hooks.emit("dataChange", n, o);
|
|
405
|
+
let s = [], m;
|
|
406
|
+
const e = this.data.keyframes.filter((u) => u.data.panoIndex !== void 0);
|
|
407
|
+
e.filter((u, l) => {
|
|
408
|
+
var d;
|
|
409
|
+
return u.data.panoIndex !== ((d = e[l - 1]) == null ? void 0 : d.data.panoIndex);
|
|
410
|
+
}).map((u) => u.data.panoIndex).forEach((u) => {
|
|
411
|
+
var d, c;
|
|
412
|
+
const l = (d = this.workUtil.getObserver(u)) == null ? void 0 : d.floorIndex;
|
|
413
|
+
if (l !== void 0)
|
|
414
|
+
if (m === l) {
|
|
415
|
+
const v = s.length - 1;
|
|
416
|
+
s[v] = [...(c = s[v]) != null ? c : [], u];
|
|
417
417
|
} else {
|
|
418
|
-
|
|
419
|
-
const
|
|
420
|
-
s[
|
|
418
|
+
m = l;
|
|
419
|
+
const v = s.length;
|
|
420
|
+
s[v] = [u];
|
|
421
421
|
}
|
|
422
|
-
}), !this.GuideLine && ((
|
|
422
|
+
}), !this.GuideLine && ((a = this.config) == null ? void 0 : a.useGuideLine) !== !1 && n.useGuildLine !== !1 && (this.GuideLine = U(this.five, this.config)), (p = this.GuideLine) == null || p.load({ routes: s.map((u) => ({ panoIndexList: u })), config: n.guildPluginOptions }), i ? this.setState(i, { userAction: r }) : (this.setState({ playing: !1 }, { userAction: !1 }), this.handleVisible(this.state.visible), this.handleEnable(this.state.enabled), this.changePlayState(this.state.playing, { userAction: !1 }), this.changeSpeed(this.state.speed)), this.clearPauseData(), console.debug("WORKPLUGIN loaded", n), this.hooks.emit("dataLoaded", n);
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
425
|
/**
|
|
@@ -428,57 +428,57 @@ class ia extends G {
|
|
|
428
428
|
* @param {string} options.id play from keyframes id
|
|
429
429
|
*/
|
|
430
430
|
playFrom(t) {
|
|
431
|
-
const { index: i, id:
|
|
432
|
-
this.state.playing && this.setState({ playing: !1 }, { userAction:
|
|
431
|
+
const { index: i, id: r, userAction: o } = t;
|
|
432
|
+
this.state.playing && this.setState({ playing: !1 }, { userAction: o }), this.setState({ playing: !0 }, { userAction: o, playFromIndex: i, playFromId: r });
|
|
433
433
|
}
|
|
434
434
|
/**
|
|
435
435
|
* @description Play from first keyframe
|
|
436
436
|
*/
|
|
437
437
|
playFromStart(t) {
|
|
438
|
-
return this.playFrom(
|
|
438
|
+
return this.playFrom(k(I({}, t), { index: 0 }));
|
|
439
439
|
}
|
|
440
440
|
/**
|
|
441
441
|
* @description Format data
|
|
442
442
|
*/
|
|
443
443
|
formatData(t) {
|
|
444
|
-
return
|
|
445
|
-
this.five.work || (yield
|
|
444
|
+
return g(this, null, function* () {
|
|
445
|
+
this.five.work || (yield R(this.five));
|
|
446
446
|
const i = (() => {
|
|
447
|
-
const
|
|
448
|
-
return typeof
|
|
447
|
+
const r = t;
|
|
448
|
+
return typeof r == "object" && r !== null && W(r.version) && r.data ? r.data : r;
|
|
449
449
|
})();
|
|
450
450
|
if (i.keyframes)
|
|
451
451
|
return {
|
|
452
|
-
keyframesId:
|
|
453
|
-
keyframes: i.keyframes.map((
|
|
454
|
-
var
|
|
455
|
-
const
|
|
456
|
-
return
|
|
452
|
+
keyframesId: x(),
|
|
453
|
+
keyframes: i.keyframes.map((r, o) => {
|
|
454
|
+
var m;
|
|
455
|
+
const n = i.keyframes[o + 1], s = (() => !n || n.start === void 0 || r.end === void 0 ? 0 : n.start - r.end)();
|
|
456
|
+
return k(I({ id: (m = r.uuid) != null ? m : x(), moveIndex: o, stay: s, index: o }, r), { guildPluginOptions: i.guildPluginOptions });
|
|
457
457
|
})
|
|
458
458
|
};
|
|
459
459
|
if (i.panoIndexList) {
|
|
460
|
-
let
|
|
461
|
-
const { moveEffect:
|
|
462
|
-
return this.privateState.moveToFirstPanoEffect =
|
|
463
|
-
const
|
|
464
|
-
var
|
|
465
|
-
const
|
|
466
|
-
if (
|
|
460
|
+
let r = [];
|
|
461
|
+
const { moveEffect: o, moveToFirstPanoEffect: n, moveToFirstPanoDuration: s } = i;
|
|
462
|
+
return this.privateState.moveToFirstPanoEffect = n, this.privateState.moveToFirstPanoDuration = s, i.panoIndexList.forEach((m, e) => {
|
|
463
|
+
const a = (() => {
|
|
464
|
+
var c, v;
|
|
465
|
+
const p = i.panoIndexList.slice(e).find((w) => w !== m);
|
|
466
|
+
if (p === void 0)
|
|
467
467
|
return;
|
|
468
|
-
const
|
|
469
|
-
if (!
|
|
468
|
+
const u = this.workUtil.getObserverPosition(m), l = this.workUtil.getObserverPosition(p);
|
|
469
|
+
if (!l || !u || ((c = this.workUtil.getObserver(m)) == null ? void 0 : c.floorIndex) !== ((v = this.workUtil.getObserver(p)) == null ? void 0 : v.floorIndex))
|
|
470
470
|
return;
|
|
471
|
-
const
|
|
472
|
-
return
|
|
471
|
+
const d = new G.Vector3().subVectors(l, u);
|
|
472
|
+
return _(d.normalize());
|
|
473
473
|
})();
|
|
474
|
-
i.moveType === void 0 || i.moveType === "justMove" ?
|
|
475
|
-
moveIndex:
|
|
474
|
+
i.moveType === void 0 || i.moveType === "justMove" ? r.push({
|
|
475
|
+
moveIndex: e,
|
|
476
476
|
stay: i.stay,
|
|
477
|
-
data:
|
|
478
|
-
}) : i.moveType === "moveAndRotate" && (
|
|
477
|
+
data: I({ effect: "Move", panoIndex: m, moveEffect: o }, a != null ? a : {})
|
|
478
|
+
}) : i.moveType === "moveAndRotate" && (r.push({ moveIndex: e, stay: i.stay, data: { effect: "Move", panoIndex: m, moveEffect: o } }), a && r.push({ moveIndex: e, stay: i.stay, data: I({ effect: "Rotate", panoIndex: m }, a) }));
|
|
479
479
|
}), {
|
|
480
|
-
keyframesId:
|
|
481
|
-
keyframes:
|
|
480
|
+
keyframesId: x(),
|
|
481
|
+
keyframes: r.map((m, e) => I({ id: x(), index: e }, m)),
|
|
482
482
|
guildPluginOptions: i.guildPluginOptions,
|
|
483
483
|
useGuildLine: i.useGuildLine
|
|
484
484
|
};
|
|
@@ -493,74 +493,84 @@ class ia extends G {
|
|
|
493
493
|
*/
|
|
494
494
|
// eslint-disable-next-line complexity
|
|
495
495
|
handlePlay(t) {
|
|
496
|
-
return
|
|
497
|
-
var d;
|
|
498
|
-
const { data: i, state:
|
|
499
|
-
if (
|
|
496
|
+
return g(this, null, function* () {
|
|
497
|
+
var d, c, v, w;
|
|
498
|
+
const { data: i, state: r, privateState: o, hooks: n } = this;
|
|
499
|
+
if (o.playing || !(i != null && i.keyframes) || (i == null ? void 0 : i.keyframes.length) === 0)
|
|
500
500
|
return;
|
|
501
|
-
const s =
|
|
502
|
-
|
|
503
|
-
const
|
|
504
|
-
(t == null ? void 0 : t.notEmitEvent) !== !0 &&
|
|
505
|
-
let
|
|
506
|
-
const
|
|
507
|
-
var
|
|
501
|
+
const s = x();
|
|
502
|
+
o.playId = s, o.audio && o.audio.paused && (((c = this.data) == null ? void 0 : c.keyframes[(d = t == null ? void 0 : t.playFromIndex) != null ? d : 0]).data.effect === "Move" ? this.privateState.audio && (this.privateState.audio.pause(), this.privateState.audio.currentTime = 0, this.privateState.audio = null) : o.audio.play()), o.playing = !0, o.broke = !1;
|
|
503
|
+
const m = i.keyframes, e = this.getPauseData();
|
|
504
|
+
(t == null ? void 0 : t.notEmitEvent) !== !0 && n.emit("play", { userAction: (v = t == null ? void 0 : t.userAction) != null ? v : !0 });
|
|
505
|
+
let a = !1;
|
|
506
|
+
const u = yield (() => g(this, null, function* () {
|
|
507
|
+
var y, S;
|
|
508
508
|
if ((t == null ? void 0 : t.playFromIndex) !== void 0)
|
|
509
509
|
return t.playFromIndex;
|
|
510
510
|
if ((t == null ? void 0 : t.playFromId) !== void 0)
|
|
511
|
-
return (
|
|
512
|
-
if (
|
|
513
|
-
const
|
|
514
|
-
if (
|
|
515
|
-
moveEffect:
|
|
516
|
-
duration:
|
|
517
|
-
})),
|
|
518
|
-
if (
|
|
519
|
-
return
|
|
520
|
-
if (
|
|
521
|
-
const
|
|
522
|
-
return yield this.playKeyframe(
|
|
511
|
+
return (y = this.data) == null ? void 0 : y.keyframes.findIndex((P) => P.id === t.playFromId);
|
|
512
|
+
if (e != null && e.id) {
|
|
513
|
+
const P = (S = this.data) == null ? void 0 : S.keyframes.find((b) => b.id === e.id);
|
|
514
|
+
if (e != null && e.fiveState && (yield this.move(e.fiveState, {
|
|
515
|
+
moveEffect: o.moveToFirstPanoEffect,
|
|
516
|
+
duration: o.moveToFirstPanoDuration
|
|
517
|
+
})), P) {
|
|
518
|
+
if (P.data.effect === "Move")
|
|
519
|
+
return P.index;
|
|
520
|
+
if (P.data.effect === "Rotate") {
|
|
521
|
+
const b = e.duration !== void 0 ? e.duration * (1 - e.playedProgress) : void 0;
|
|
522
|
+
return yield this.playKeyframe(P, { duration: b }), a = !0, P.index + 1;
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
526
|
}))();
|
|
527
|
+
if ((t == null ? void 0 : t.userAction) !== !1) {
|
|
528
|
+
this.privateState.audioCache || (this.privateState.audioCache = /* @__PURE__ */ new Map());
|
|
529
|
+
for (let y = u; y < m.length; y++) {
|
|
530
|
+
const S = m[y];
|
|
531
|
+
if ((w = S == null ? void 0 : S.data) != null && w.audio && !this.privateState.audioCache.has(S.data.audio.url)) {
|
|
532
|
+
const P = new Audio(S.data.audio.url);
|
|
533
|
+
P.preload = "auto", this.privateState.audioCache.set(S.data.audio.url, P);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
527
537
|
this.clearPauseData();
|
|
528
|
-
for (const
|
|
529
|
-
if (
|
|
538
|
+
for (const y of m) {
|
|
539
|
+
if (o.broke || !r.playing || !o.playing || s !== o.playId)
|
|
530
540
|
return;
|
|
531
|
-
if (!(
|
|
541
|
+
if (!(u !== void 0 && y.index < u))
|
|
532
542
|
try {
|
|
533
|
-
|
|
534
|
-
moveEffect:
|
|
535
|
-
duration:
|
|
536
|
-
}),
|
|
537
|
-
} catch (
|
|
543
|
+
n.emit("playIndexChange", y.index, y), yield this.playKeyframe(y, {
|
|
544
|
+
moveEffect: a === !1 ? o.moveToFirstPanoEffect : void 0,
|
|
545
|
+
duration: a === !1 && typeof o.moveToFirstPanoDuration == "number" ? o.moveToFirstPanoDuration : void 0
|
|
546
|
+
}), y.stay && (yield Q(y.stay)), a === !1 && (a = !0);
|
|
547
|
+
} catch (S) {
|
|
538
548
|
return Promise.resolve("broke");
|
|
539
549
|
}
|
|
540
550
|
}
|
|
541
|
-
|
|
551
|
+
r.playing && s === o.playId && (this.setState({ playing: !1 }, { userAction: !1 }), n.emit("end"), this.clearPauseData());
|
|
542
552
|
});
|
|
543
553
|
}
|
|
544
554
|
/**
|
|
545
555
|
* @description: Pause and record pause state
|
|
546
556
|
*/
|
|
547
557
|
handlePause(t) {
|
|
548
|
-
var
|
|
549
|
-
const { state: i, privateState:
|
|
550
|
-
i.playing = !1,
|
|
558
|
+
var n;
|
|
559
|
+
const { state: i, privateState: r, hooks: o } = this;
|
|
560
|
+
i.playing = !1, r.playing !== !1 && (r.playing = !1, r.audio && r.audio.pause(), (t == null ? void 0 : t.userAction) !== !1 && this.setPauseData(), r.broke || this.forceInteruptUpdateCamera(), (t == null ? void 0 : t.notEmitEvent) !== !0 && o.emit("pause", { userAction: (n = t == null ? void 0 : t.userAction) != null ? n : !0 }));
|
|
551
561
|
}
|
|
552
562
|
/**
|
|
553
563
|
* @description: Change play speed
|
|
554
564
|
*/
|
|
555
565
|
changeSpeed(t, i = !0) {
|
|
556
|
-
var
|
|
557
|
-
const { state:
|
|
558
|
-
if (
|
|
566
|
+
var m;
|
|
567
|
+
const { state: r, privateState: o, hooks: n } = this, { currentPlayKeyframe: s } = o;
|
|
568
|
+
if (n.emit("speedChange", t, { userAction: i }), r.playing && s)
|
|
559
569
|
try {
|
|
560
|
-
const
|
|
561
|
-
((
|
|
562
|
-
} catch (
|
|
563
|
-
console.error(
|
|
570
|
+
const e = s.originDuration !== void 0 ? s.originDuration * (1 - this.getProgress()) : void 0, a = s.keyframe, { privateState: p } = this;
|
|
571
|
+
((m = this.privateState.currentPlayKeyframe) == null ? void 0 : m.keyframe.id) !== a.id && (this.privateState.currentPlayKeyframe = { keyframe: a }), p.currentPlayQueue.push(this.getPlayPromise(a, { duration: e }));
|
|
572
|
+
} catch (e) {
|
|
573
|
+
console.error(e);
|
|
564
574
|
}
|
|
565
575
|
}
|
|
566
576
|
/**
|
|
@@ -573,12 +583,12 @@ class ia extends G {
|
|
|
573
583
|
* @description Set pause data
|
|
574
584
|
*/
|
|
575
585
|
setPauseData() {
|
|
576
|
-
var t, i,
|
|
586
|
+
var t, i, r;
|
|
577
587
|
if ((t = this.data) != null && t.id)
|
|
578
588
|
return this.pauseDataMap.set(this.data.id, {
|
|
579
589
|
id: (i = this.privateState.currentPlayKeyframe) == null ? void 0 : i.keyframe.id,
|
|
580
590
|
fiveState: this.five.getCurrentState(),
|
|
581
|
-
duration: (
|
|
591
|
+
duration: (r = this.privateState.currentPlayKeyframe) == null ? void 0 : r.originDuration,
|
|
582
592
|
playedProgress: this.getProgress()
|
|
583
593
|
});
|
|
584
594
|
}
|
|
@@ -592,43 +602,43 @@ class ia extends G {
|
|
|
592
602
|
* @description Play single keyframe
|
|
593
603
|
*/
|
|
594
604
|
playKeyframe(t, i) {
|
|
595
|
-
return
|
|
596
|
-
var
|
|
597
|
-
const { privateState:
|
|
598
|
-
return ((
|
|
605
|
+
return g(this, null, function* () {
|
|
606
|
+
var o;
|
|
607
|
+
const { privateState: r } = this;
|
|
608
|
+
return ((o = this.privateState.currentPlayKeyframe) == null ? void 0 : o.keyframe.id) !== t.id && (this.privateState.currentPlayKeyframe = { keyframe: t }), r.currentPlayQueue.push(this.getPlayPromise(t, i)), this.actionPromiseQueue();
|
|
599
609
|
});
|
|
600
610
|
}
|
|
601
611
|
/**
|
|
602
612
|
* @description: getPlayPromise
|
|
603
613
|
*/
|
|
604
|
-
getPlayPromise(
|
|
605
|
-
return
|
|
606
|
-
var
|
|
607
|
-
const
|
|
608
|
-
if (i.duration = (
|
|
609
|
-
return new Promise((s,
|
|
610
|
-
let
|
|
614
|
+
getPlayPromise(r) {
|
|
615
|
+
return g(this, arguments, function* (t, i = {}) {
|
|
616
|
+
var n;
|
|
617
|
+
const o = t.data;
|
|
618
|
+
if (i.duration = (n = i.duration) != null ? n : t.start !== void 0 && t.end !== void 0 ? t.end - t.start : void 0, !!o)
|
|
619
|
+
return new Promise((s, m) => {
|
|
620
|
+
let e = !1;
|
|
611
621
|
this.addInterruptListener(() => {
|
|
612
|
-
if (!
|
|
613
|
-
return this.hooks.emit("broke"), this.privateState.broke = !0, this.setState({ playing: !1 }),
|
|
622
|
+
if (!e)
|
|
623
|
+
return this.hooks.emit("broke"), this.privateState.broke = !0, this.setState({ playing: !1 }), e = !0, m(new Error("play is interupted"));
|
|
614
624
|
});
|
|
615
625
|
try {
|
|
616
|
-
if (
|
|
626
|
+
if (e)
|
|
617
627
|
return;
|
|
618
|
-
const
|
|
619
|
-
s(),
|
|
628
|
+
const a = () => {
|
|
629
|
+
s(), e = !0;
|
|
620
630
|
};
|
|
621
|
-
switch (
|
|
631
|
+
switch (o.effect) {
|
|
622
632
|
case "Move":
|
|
623
|
-
this.move(
|
|
633
|
+
this.move(o, i).then(a);
|
|
624
634
|
break;
|
|
625
635
|
case "Rotate":
|
|
626
|
-
this.rotate(
|
|
636
|
+
this.rotate(o, i).then(a);
|
|
627
637
|
break;
|
|
628
638
|
default:
|
|
629
|
-
this.rotate(
|
|
639
|
+
this.rotate(o, i).then(a);
|
|
630
640
|
}
|
|
631
|
-
} catch (
|
|
641
|
+
} catch (a) {
|
|
632
642
|
}
|
|
633
643
|
});
|
|
634
644
|
});
|
|
@@ -637,19 +647,19 @@ class ia extends G {
|
|
|
637
647
|
* @description Action promise queue in sequence
|
|
638
648
|
*/
|
|
639
649
|
actionPromiseQueue() {
|
|
640
|
-
return
|
|
650
|
+
return g(this, null, function* () {
|
|
641
651
|
const { privateState: t } = this;
|
|
642
|
-
return new Promise((i,
|
|
652
|
+
return new Promise((i, r) => {
|
|
643
653
|
if (t.currentPlayQueue.length === 0) {
|
|
644
654
|
i();
|
|
645
655
|
return;
|
|
646
656
|
}
|
|
647
|
-
const
|
|
648
|
-
if (!
|
|
657
|
+
const o = t.currentPlayQueue.shift();
|
|
658
|
+
if (!o) {
|
|
649
659
|
i();
|
|
650
660
|
return;
|
|
651
661
|
}
|
|
652
|
-
|
|
662
|
+
o.then(i, r);
|
|
653
663
|
}).then(() => t.currentPlayQueue.length === 0 ? Promise.resolve() : this.actionPromiseQueue());
|
|
654
664
|
});
|
|
655
665
|
}
|
|
@@ -657,52 +667,103 @@ class ia extends G {
|
|
|
657
667
|
* @description Action move keyframe
|
|
658
668
|
*/
|
|
659
669
|
move(t, i) {
|
|
660
|
-
return
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
else if (t.panoIndex !== this.five.panoIndex)
|
|
664
|
-
yield this.changePano(t, i);
|
|
665
|
-
else
|
|
666
|
-
return Promise.resolve();
|
|
670
|
+
return g(this, null, function* () {
|
|
671
|
+
var r;
|
|
672
|
+
return this.privateState.audio && (this.privateState.audio.pause(), this.privateState.audio.currentTime = 0, this.privateState.audio = null), t.mode && t.mode !== this.five.currentMode ? yield this.changeMode(t) : t.panoIndex !== this.five.panoIndex && (yield this.changePano(t, i)), (r = this.privateState.audio) != null && r.pause || (this.loadAudio(t.audio), yield this.playAudio()), Promise.resolve();
|
|
667
673
|
});
|
|
668
674
|
}
|
|
669
675
|
/**
|
|
670
676
|
* @description Action rotate keyframe
|
|
671
677
|
*/
|
|
672
678
|
rotate(t, i) {
|
|
673
|
-
return
|
|
674
|
-
|
|
679
|
+
return g(this, null, function* () {
|
|
680
|
+
var r;
|
|
681
|
+
if (t.audio && this.privateState.audio && (this.privateState.audio.pause(), this.privateState.audio.currentTime = 0, this.privateState.audio = null), t.mode && t.mode !== this.five.currentMode)
|
|
675
682
|
yield this.changeMode({ mode: t.mode, panoIndex: t.panoIndex });
|
|
676
683
|
else if (t.panoIndex && t.panoIndex !== this.five.panoIndex)
|
|
677
684
|
return yield this.changePano(t, i);
|
|
678
|
-
yield this.updateCamera(t, i);
|
|
685
|
+
yield this.updateCamera(t, i), t.audio && !((r = this.privateState.audio) != null && r.pause) && (this.loadAudio(t.audio), yield this.playAudio());
|
|
679
686
|
});
|
|
680
687
|
}
|
|
681
688
|
/**
|
|
682
689
|
* @description Update five camera
|
|
683
690
|
*/
|
|
684
|
-
updateCamera(
|
|
685
|
-
return
|
|
686
|
-
const { five:
|
|
687
|
-
var
|
|
688
|
-
const
|
|
689
|
-
if ((
|
|
690
|
-
return
|
|
691
|
-
if (
|
|
692
|
-
return
|
|
693
|
-
})(),
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
691
|
+
updateCamera(r) {
|
|
692
|
+
return g(this, arguments, function* (t, i = {}) {
|
|
693
|
+
const { five: o, privateState: n, state: s } = this, m = (() => {
|
|
694
|
+
var v, w;
|
|
695
|
+
const d = (v = s.config) == null ? void 0 : v.speedConfig, c = (w = t.rotateSpeed) != null ? w : d == null ? void 0 : d.rotateSpeed;
|
|
696
|
+
if ((d == null ? void 0 : d.rotateSpeedUnit) === void 0)
|
|
697
|
+
return c;
|
|
698
|
+
if (c !== void 0)
|
|
699
|
+
return d.rotateSpeedUnit === "rad/ms" ? c : c / 1e3;
|
|
700
|
+
})(), e = this.five.getCurrentState(), a = Math.PI * 2;
|
|
701
|
+
let p = t.longitude;
|
|
702
|
+
p !== void 0 && (p = (p % a + a) % a, t.direction === "left" ? p <= e.longitude && (p += a) : t.direction === "right" && p >= e.longitude && (p -= a));
|
|
703
|
+
const u = (() => i.duration ? i.duration : m ? M(e, k(I({}, t), { longitude: p })) / m : 800)();
|
|
704
|
+
n.currentPlayKeyframe && (n.currentPlayKeyframe.originDuration = u);
|
|
705
|
+
const l = this.getSpeededDuration(u);
|
|
706
|
+
return new Promise((d) => {
|
|
707
|
+
O(
|
|
708
|
+
() => {
|
|
709
|
+
var c;
|
|
710
|
+
return o.updateCameraWithKeyframes(
|
|
711
|
+
[
|
|
712
|
+
{
|
|
713
|
+
progress: 0,
|
|
714
|
+
value: {
|
|
715
|
+
longitude: e.longitude,
|
|
716
|
+
latitude: e.latitude,
|
|
717
|
+
fov: e.fov,
|
|
718
|
+
offset: e.offset.clone(),
|
|
719
|
+
distance: e.distance
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
progress: 0.25,
|
|
724
|
+
value: {
|
|
725
|
+
longitude: p !== void 0 ? (e.longitude + (p + e.longitude) / 2) / 2 : e.longitude,
|
|
726
|
+
latitude: e.latitude,
|
|
727
|
+
fov: e.fov,
|
|
728
|
+
offset: e.offset.clone(),
|
|
729
|
+
distance: e.distance
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
progress: 0.5,
|
|
734
|
+
value: {
|
|
735
|
+
longitude: p !== void 0 ? (p + e.longitude) / 2 : e.longitude,
|
|
736
|
+
latitude: t.latitude !== void 0 ? (t.latitude + e.latitude) / 2 : e.latitude,
|
|
737
|
+
fov: e.fov,
|
|
738
|
+
offset: e.offset.clone(),
|
|
739
|
+
distance: e.distance
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
{
|
|
743
|
+
progress: 0.75,
|
|
744
|
+
value: {
|
|
745
|
+
longitude: p !== void 0 ? (p + (p + e.longitude) / 2) / 2 : e.longitude,
|
|
746
|
+
latitude: e.latitude,
|
|
747
|
+
fov: e.fov,
|
|
748
|
+
offset: e.offset.clone(),
|
|
749
|
+
distance: e.distance
|
|
750
|
+
}
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
progress: 1,
|
|
754
|
+
value: {
|
|
755
|
+
longitude: p !== void 0 ? p : (c = t.longitude) != null ? c : e.longitude,
|
|
756
|
+
latitude: t.latitude !== void 0 ? t.latitude : e.latitude,
|
|
757
|
+
fov: e.fov,
|
|
758
|
+
offset: e.offset.clone(),
|
|
759
|
+
distance: e.distance
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
],
|
|
763
|
+
l
|
|
764
|
+
);
|
|
765
|
+
}
|
|
766
|
+
), setTimeout(() => d(), l);
|
|
706
767
|
});
|
|
707
768
|
});
|
|
708
769
|
}
|
|
@@ -710,40 +771,40 @@ class ia extends G {
|
|
|
710
771
|
* @description: Change five pano
|
|
711
772
|
*/
|
|
712
773
|
changePano(t, i) {
|
|
713
|
-
return
|
|
714
|
-
const { five:
|
|
715
|
-
if (typeof t.panoIndex != "number" || t.panoIndex ===
|
|
774
|
+
return g(this, null, function* () {
|
|
775
|
+
const { five: r, privateState: o, state: n } = this;
|
|
776
|
+
if (typeof t.panoIndex != "number" || t.panoIndex === r.panoIndex)
|
|
716
777
|
return;
|
|
717
|
-
const s =
|
|
778
|
+
const s = r.getCurrentState().mode !== "Panorama";
|
|
718
779
|
s && (this.privateState.modeChanging = !0);
|
|
719
|
-
const
|
|
720
|
-
var
|
|
721
|
-
const
|
|
722
|
-
if ((
|
|
723
|
-
return
|
|
724
|
-
if (
|
|
725
|
-
return
|
|
726
|
-
})(),
|
|
780
|
+
const m = (() => {
|
|
781
|
+
var u, l;
|
|
782
|
+
const a = (u = n.config) == null ? void 0 : u.speedConfig, p = (l = t.moveSpeed) != null ? l : a == null ? void 0 : a.moveSpeed;
|
|
783
|
+
if ((a == null ? void 0 : a.moveSpeedUnit) === void 0)
|
|
784
|
+
return p;
|
|
785
|
+
if (p !== void 0)
|
|
786
|
+
return a.moveSpeedUnit === "m/ms" ? p : p / 1e3;
|
|
787
|
+
})(), e = (() => {
|
|
727
788
|
if (i != null && i.duration)
|
|
728
789
|
return i.duration;
|
|
729
|
-
if (
|
|
730
|
-
const
|
|
731
|
-
return
|
|
790
|
+
if (m && typeof r.panoIndex == "number" && typeof t.panoIndex == "number") {
|
|
791
|
+
const a = this.workUtil.getObserverPosition(r.panoIndex), p = this.workUtil.getObserverPosition(t.panoIndex);
|
|
792
|
+
return a && p ? a.distanceTo(p) / m : 800;
|
|
732
793
|
}
|
|
733
794
|
return 800;
|
|
734
795
|
})();
|
|
735
|
-
|
|
736
|
-
var
|
|
737
|
-
const
|
|
796
|
+
o.currentPlayKeyframe && (o.currentPlayKeyframe.originDuration = e), yield new Promise((a) => {
|
|
797
|
+
var u, l, d;
|
|
798
|
+
const p = this.fiveUtil.moveToPano(t.panoIndex, {
|
|
738
799
|
latitude: t.latitude,
|
|
739
800
|
longitude: t.longitude,
|
|
740
801
|
fov: t.fov,
|
|
741
|
-
duration: this.getSpeededDuration(
|
|
742
|
-
effect: (
|
|
743
|
-
moveCancelCallback: () =>
|
|
744
|
-
moveEndCallback: () =>
|
|
802
|
+
duration: this.getSpeededDuration(e),
|
|
803
|
+
effect: (d = (l = i == null ? void 0 : i.moveEffect) != null ? l : (u = this.state.config) == null ? void 0 : u.moveEffect) != null ? d : t.moveEffect,
|
|
804
|
+
moveCancelCallback: () => a(),
|
|
805
|
+
moveEndCallback: () => a()
|
|
745
806
|
});
|
|
746
|
-
|
|
807
|
+
p instanceof Promise && p.then(() => a()), s && r.once("panoArrived", () => a());
|
|
747
808
|
}), s && (this.privateState.modeChanging = !1);
|
|
748
809
|
});
|
|
749
810
|
}
|
|
@@ -751,11 +812,34 @@ class ia extends G {
|
|
|
751
812
|
* @description Change five mode
|
|
752
813
|
*/
|
|
753
814
|
changeMode(t, i) {
|
|
754
|
-
return
|
|
815
|
+
return g(this, null, function* () {
|
|
755
816
|
t.mode && t.mode !== this.five.currentMode && (this.privateState.modeChanging = !0, yield this.five.changeMode(t.mode, t, i), this.privateState.modeChanging = !1);
|
|
756
817
|
});
|
|
757
818
|
}
|
|
819
|
+
loadAudio(t) {
|
|
820
|
+
if (t) {
|
|
821
|
+
let i;
|
|
822
|
+
this.privateState.audioCache && (i = this.privateState.audioCache.get(t.url)), i || (i = new Audio(t.url), i.preload = "auto", i.load()), this.privateState.audio && (this.privateState.audio.pause(), this.privateState.audio.currentTime = 0, this.privateState.audio = null), this.privateState.audio = i;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
playAudio() {
|
|
826
|
+
return g(this, null, function* () {
|
|
827
|
+
const t = this.privateState.audio;
|
|
828
|
+
t && (yield new Promise((i, r) => {
|
|
829
|
+
const o = () => {
|
|
830
|
+
m(), i();
|
|
831
|
+
}, n = () => {
|
|
832
|
+
m(), r(new Error("Audio failed to play"));
|
|
833
|
+
}, s = () => {
|
|
834
|
+
this.privateState.audio && (this.privateState.audio.pause(), this.privateState.audio.currentTime = 0, this.privateState.audio = null);
|
|
835
|
+
}, m = () => {
|
|
836
|
+
t.removeEventListener("playing", o), t.removeEventListener("error", n);
|
|
837
|
+
};
|
|
838
|
+
t.addEventListener("playing", o), t.addEventListener("error", n), t.addEventListener("ended", s), t.play().catch(r);
|
|
839
|
+
}));
|
|
840
|
+
});
|
|
841
|
+
}
|
|
758
842
|
}
|
|
759
843
|
export {
|
|
760
|
-
|
|
844
|
+
am as default
|
|
761
845
|
};
|