@realsee/dnalogel 3.77.2-alpha.0 → 3.77.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/CHANGELOG.md +12 -0
- package/dist/CruisePlugin/Work.d.ts +0 -4
- package/dist/CruisePlugin/typing.d.ts +0 -7
- package/dist/CruisePlugin/utils/coordinatesAngle.d.ts +3 -19
- package/dist/Sculpt/Objects/Base/Editor.d.ts +20 -1
- package/dist/Sculpt/Objects/Box/index.d.ts +5 -2
- package/dist/Sculpt/Objects/Rectangle/index.d.ts +7 -4
- package/dist/floorplan/MapviewFloorplanPlugin/Controller.d.ts +21 -0
- package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +16 -0
- package/dist/floorplan/typings/index.d.ts +3 -0
- package/dist/index.cjs.js +75 -75
- package/dist/index.js +7373 -7319
- package/dist/index.umd.js +73 -73
- package/dist/shared-utils/Object3DHelper/typings/Hooks.d.ts +4 -3
- package/dist/shared-utils/three/PointSelector/index.d.ts +1 -1
- package/libs/CruisePlugin/BaseController.js +1 -8
- package/libs/CruisePlugin/Work.d.ts +0 -4
- package/libs/CruisePlugin/Work.js +213 -297
- package/libs/CruisePlugin/typing.d.ts +0 -7
- package/libs/CruisePlugin/utils/coordinatesAngle.d.ts +3 -19
- package/libs/CruisePlugin/utils/coordinatesAngle.js +5 -10
- package/libs/Sculpt/Objects/Base/Editor.d.ts +20 -1
- package/libs/Sculpt/Objects/Base/Editor.js +91 -35
- package/libs/Sculpt/Objects/Box/index.d.ts +5 -2
- package/libs/Sculpt/Objects/Box/index.js +61 -55
- package/libs/Sculpt/Objects/Prism/index.js +48 -47
- package/libs/Sculpt/Objects/Rectangle/index.d.ts +7 -4
- package/libs/Sculpt/Objects/Rectangle/index.js +119 -117
- package/libs/Sculpt/utils/Modules/Global.js +24 -24
- package/libs/base/BasePlugin.js +5 -5
- package/libs/floorplan/MapviewFloorplanPlugin/Controller.d.ts +21 -0
- package/libs/floorplan/MapviewFloorplanPlugin/Controller.js +132 -91
- package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +16 -0
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +132 -104
- package/libs/floorplan/ModelFloorplanPlugin/index.js +1 -1
- package/libs/floorplan/index.js +1 -1
- package/libs/floorplan/typings/index.d.ts +3 -0
- package/libs/shared-utils/Object3DHelper/Controller/MoveController.js +1 -1
- package/libs/shared-utils/Object3DHelper/Controller/RectangleScaleController.js +18 -18
- package/libs/shared-utils/Object3DHelper/Controller/RotateController.js +1 -1
- package/libs/shared-utils/Object3DHelper/typings/Hooks.d.ts +4 -3
- package/libs/shared-utils/logger.js +1 -1
- package/libs/shared-utils/three/PointSelector/index.d.ts +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 b = Object.defineProperty, F = Object.defineProperties;
|
|
2
|
+
var E = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var w = Object.getOwnPropertySymbols;
|
|
4
|
+
var D = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var I = (h, l, t) => l in h ? b(h, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[l] = t, g = (h, l) => {
|
|
6
|
+
for (var t in l || (l = {}))
|
|
7
|
+
D.call(l, t) && I(h, t, l[t]);
|
|
8
|
+
if (w)
|
|
9
|
+
for (var t of w(l))
|
|
10
|
+
C.call(l, t) && I(h, t, l[t]);
|
|
11
11
|
return h;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
12
|
+
}, x = (h, l) => F(h, E(l));
|
|
13
|
+
var k = (h, l, t) => (I(h, typeof l != "symbol" ? l + "" : l, t), t);
|
|
14
|
+
var y = (h, l, t) => new Promise((i, e) => {
|
|
15
|
+
var r = (a) => {
|
|
16
16
|
try {
|
|
17
|
-
s(t.next(
|
|
18
|
-
} catch (
|
|
19
|
-
|
|
17
|
+
s(t.next(a));
|
|
18
|
+
} catch (m) {
|
|
19
|
+
e(m);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, p = (a) => {
|
|
22
22
|
try {
|
|
23
|
-
s(t.throw(
|
|
24
|
-
} catch (
|
|
25
|
-
|
|
23
|
+
s(t.throw(a));
|
|
24
|
+
} catch (m) {
|
|
25
|
+
e(m);
|
|
26
26
|
}
|
|
27
|
-
}, s = (
|
|
28
|
-
s((t = t.apply(h,
|
|
27
|
+
}, s = (a) => a.done ? i(a.value) : Promise.resolve(a.value).then(r, p);
|
|
28
|
+
s((t = t.apply(h, l)).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 K } from "../GuideLinePlugin/index.js";
|
|
31
|
+
import { uuid as S } from "../shared-utils/uuid.js";
|
|
32
|
+
import { coordinatesAngle as L } from "./utils/coordinatesAngle.js";
|
|
33
|
+
import { safeCall as T } from "./utils/safeCall.js";
|
|
34
|
+
import * as U from "three";
|
|
35
|
+
import { sleep as O } from "./utils/sleep.js";
|
|
36
|
+
import { waitFiveLoaded as M } from "../shared-utils/five/fiveLoaded.js";
|
|
37
|
+
import { vectorToCoordinates as A } from "../shared-utils/vectorToCoordinate.js";
|
|
38
|
+
import G 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 Q } 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 ia extends G {
|
|
370
370
|
constructor(t, i) {
|
|
371
371
|
super(t, i);
|
|
372
|
-
|
|
372
|
+
k(this, "state", {
|
|
373
373
|
visible: !0,
|
|
374
374
|
enabled: !0,
|
|
375
375
|
disposed: !1,
|
|
@@ -384,7 +384,7 @@ class am extends V {
|
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
});
|
|
387
|
-
|
|
387
|
+
k(this, "privateState", {
|
|
388
388
|
playing: !1,
|
|
389
389
|
currentPlayQueue: [],
|
|
390
390
|
currentPlayKeyframe: null,
|
|
@@ -396,30 +396,30 @@ class am extends V {
|
|
|
396
396
|
/**
|
|
397
397
|
* @description Load Data and State
|
|
398
398
|
*/
|
|
399
|
-
load(t, i,
|
|
400
|
-
return
|
|
401
|
-
var
|
|
399
|
+
load(t, i, e) {
|
|
400
|
+
return y(this, null, function* () {
|
|
401
|
+
var o, n;
|
|
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 r = this.data ? JSON.parse(JSON.stringify(this.data)) : void 0, p = yield this.formatData(t);
|
|
404
|
+
this.data = g({ id: p.keyframesId }, p), this.hooks.emit("dataChange", p, r);
|
|
405
|
+
let s = [], a;
|
|
406
|
+
const m = this.data.keyframes.filter((f) => f.data.panoIndex !== void 0);
|
|
407
|
+
m.filter((f, d) => {
|
|
408
|
+
var u;
|
|
409
|
+
return f.data.panoIndex !== ((u = m[d - 1]) == null ? void 0 : u.data.panoIndex);
|
|
410
|
+
}).map((f) => f.data.panoIndex).forEach((f) => {
|
|
411
|
+
var u, v;
|
|
412
|
+
const d = (u = this.workUtil.getObserver(f)) == null ? void 0 : u.floorIndex;
|
|
413
|
+
if (d !== void 0)
|
|
414
|
+
if (a === d) {
|
|
415
|
+
const c = s.length - 1;
|
|
416
|
+
s[c] = [...(v = s[c]) != null ? v : [], f];
|
|
417
417
|
} else {
|
|
418
|
-
|
|
419
|
-
const
|
|
420
|
-
s[
|
|
418
|
+
a = d;
|
|
419
|
+
const c = s.length;
|
|
420
|
+
s[c] = [f];
|
|
421
421
|
}
|
|
422
|
-
}), !this.GuideLine && ((
|
|
422
|
+
}), !this.GuideLine && ((o = this.config) == null ? void 0 : o.useGuideLine) !== !1 && p.useGuildLine !== !1 && (this.GuideLine = K(this.five, this.config)), (n = this.GuideLine) == null || n.load({ routes: s.map((f) => ({ panoIndexList: f })), config: p.guildPluginOptions }), i ? this.setState(i, { userAction: e }) : (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", p), this.hooks.emit("dataLoaded", p);
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
425
|
/**
|
|
@@ -428,57 +428,57 @@ class am extends V {
|
|
|
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: e, userAction: r } = t;
|
|
432
|
+
this.state.playing && this.setState({ playing: !1 }, { userAction: r }), this.setState({ playing: !0 }, { userAction: r, playFromIndex: i, playFromId: e });
|
|
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(x(g({}, 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 y(this, null, function* () {
|
|
445
|
+
this.five.work || (yield M(this.five));
|
|
446
446
|
const i = (() => {
|
|
447
|
-
const
|
|
448
|
-
return typeof
|
|
447
|
+
const e = t;
|
|
448
|
+
return typeof e == "object" && e !== null && Q(e.version) && e.data ? e.data : e;
|
|
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: S(),
|
|
453
|
+
keyframes: i.keyframes.map((e, r) => {
|
|
454
|
+
var a;
|
|
455
|
+
const p = i.keyframes[r + 1], s = (() => !p || p.start === void 0 || e.end === void 0 ? 0 : p.start - e.end)();
|
|
456
|
+
return x(g({ id: (a = e.uuid) != null ? a : S(), moveIndex: r, stay: s, index: r }, e), { 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 e = [];
|
|
461
|
+
const { moveEffect: r, moveToFirstPanoEffect: p, moveToFirstPanoDuration: s } = i;
|
|
462
|
+
return this.privateState.moveToFirstPanoEffect = p, this.privateState.moveToFirstPanoDuration = s, i.panoIndexList.forEach((a, m) => {
|
|
463
|
+
const o = (() => {
|
|
464
|
+
var v, c;
|
|
465
|
+
const n = i.panoIndexList.slice(m).find((P) => P !== a);
|
|
466
|
+
if (n === void 0)
|
|
467
467
|
return;
|
|
468
|
-
const
|
|
469
|
-
if (!
|
|
468
|
+
const f = this.workUtil.getObserverPosition(a), d = this.workUtil.getObserverPosition(n);
|
|
469
|
+
if (!d || !f || ((v = this.workUtil.getObserver(a)) == null ? void 0 : v.floorIndex) !== ((c = this.workUtil.getObserver(n)) == null ? void 0 : c.floorIndex))
|
|
470
470
|
return;
|
|
471
|
-
const
|
|
472
|
-
return
|
|
471
|
+
const u = new U.Vector3().subVectors(d, f);
|
|
472
|
+
return A(u.normalize());
|
|
473
473
|
})();
|
|
474
|
-
i.moveType === void 0 || i.moveType === "justMove" ?
|
|
475
|
-
moveIndex:
|
|
474
|
+
i.moveType === void 0 || i.moveType === "justMove" ? e.push({
|
|
475
|
+
moveIndex: m,
|
|
476
476
|
stay: i.stay,
|
|
477
|
-
data:
|
|
478
|
-
}) : i.moveType === "moveAndRotate" && (
|
|
477
|
+
data: g({ effect: "Move", panoIndex: a, moveEffect: r }, o != null ? o : {})
|
|
478
|
+
}) : i.moveType === "moveAndRotate" && (e.push({ moveIndex: m, stay: i.stay, data: { effect: "Move", panoIndex: a, moveEffect: r } }), o && e.push({ moveIndex: m, stay: i.stay, data: g({ effect: "Rotate", panoIndex: a }, o) }));
|
|
479
479
|
}), {
|
|
480
|
-
keyframesId:
|
|
481
|
-
keyframes:
|
|
480
|
+
keyframesId: S(),
|
|
481
|
+
keyframes: e.map((a, m) => g({ id: S(), index: m }, a)),
|
|
482
482
|
guildPluginOptions: i.guildPluginOptions,
|
|
483
483
|
useGuildLine: i.useGuildLine
|
|
484
484
|
};
|
|
@@ -493,84 +493,74 @@ class am extends V {
|
|
|
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 y(this, null, function* () {
|
|
497
|
+
var d;
|
|
498
|
+
const { data: i, state: e, privateState: r, hooks: p } = this;
|
|
499
|
+
if (r.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 = S();
|
|
502
|
+
r.playId = s, r.playing = !0, r.broke = !1;
|
|
503
|
+
const a = i.keyframes, m = this.getPauseData();
|
|
504
|
+
(t == null ? void 0 : t.notEmitEvent) !== !0 && p.emit("play", { userAction: (d = t == null ? void 0 : t.userAction) != null ? d : !0 });
|
|
505
|
+
let o = !1;
|
|
506
|
+
const f = yield (() => y(this, null, function* () {
|
|
507
|
+
var u, v;
|
|
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 (u = this.data) == null ? void 0 : u.keyframes.findIndex((c) => c.id === t.playFromId);
|
|
512
|
+
if (m != null && m.id) {
|
|
513
|
+
const c = (v = this.data) == null ? void 0 : v.keyframes.find((P) => P.id === m.id);
|
|
514
|
+
if (m != null && m.fiveState && (yield this.move(m.fiveState, {
|
|
515
|
+
moveEffect: r.moveToFirstPanoEffect,
|
|
516
|
+
duration: r.moveToFirstPanoDuration
|
|
517
|
+
})), c) {
|
|
518
|
+
if (c.data.effect === "Move")
|
|
519
|
+
return c.index;
|
|
520
|
+
if (c.data.effect === "Rotate") {
|
|
521
|
+
const P = m.duration !== void 0 ? m.duration * (1 - m.playedProgress) : void 0;
|
|
522
|
+
return yield this.playKeyframe(c, { duration: P }), o = !0, c.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
|
-
}
|
|
537
527
|
this.clearPauseData();
|
|
538
|
-
for (const
|
|
539
|
-
if (
|
|
528
|
+
for (const u of a) {
|
|
529
|
+
if (r.broke || !e.playing || !r.playing || s !== r.playId)
|
|
540
530
|
return;
|
|
541
|
-
if (!(
|
|
531
|
+
if (!(f !== void 0 && u.index < f))
|
|
542
532
|
try {
|
|
543
|
-
|
|
544
|
-
moveEffect:
|
|
545
|
-
duration:
|
|
546
|
-
}),
|
|
547
|
-
} catch (
|
|
533
|
+
p.emit("playIndexChange", u.index, u), yield this.playKeyframe(u, {
|
|
534
|
+
moveEffect: o === !1 ? r.moveToFirstPanoEffect : void 0,
|
|
535
|
+
duration: o === !1 && typeof r.moveToFirstPanoDuration == "number" ? r.moveToFirstPanoDuration : void 0
|
|
536
|
+
}), u.stay && (yield O(u.stay)), o === !1 && (o = !0);
|
|
537
|
+
} catch (v) {
|
|
548
538
|
return Promise.resolve("broke");
|
|
549
539
|
}
|
|
550
540
|
}
|
|
551
|
-
|
|
541
|
+
e.playing && s === r.playId && (this.setState({ playing: !1 }, { userAction: !1 }), p.emit("end"), this.clearPauseData());
|
|
552
542
|
});
|
|
553
543
|
}
|
|
554
544
|
/**
|
|
555
545
|
* @description: Pause and record pause state
|
|
556
546
|
*/
|
|
557
547
|
handlePause(t) {
|
|
558
|
-
var
|
|
559
|
-
const { state: i, privateState:
|
|
560
|
-
i.playing = !1,
|
|
548
|
+
var p;
|
|
549
|
+
const { state: i, privateState: e, hooks: r } = this;
|
|
550
|
+
i.playing = !1, e.playing !== !1 && (e.playing = !1, (t == null ? void 0 : t.userAction) !== !1 && this.setPauseData(), e.broke || this.forceInteruptUpdateCamera(), (t == null ? void 0 : t.notEmitEvent) !== !0 && r.emit("pause", { userAction: (p = t == null ? void 0 : t.userAction) != null ? p : !0 }));
|
|
561
551
|
}
|
|
562
552
|
/**
|
|
563
553
|
* @description: Change play speed
|
|
564
554
|
*/
|
|
565
555
|
changeSpeed(t, i = !0) {
|
|
566
|
-
var
|
|
567
|
-
const { state:
|
|
568
|
-
if (
|
|
556
|
+
var a;
|
|
557
|
+
const { state: e, privateState: r, hooks: p } = this, { currentPlayKeyframe: s } = r;
|
|
558
|
+
if (p.emit("speedChange", t, { userAction: i }), e.playing && s)
|
|
569
559
|
try {
|
|
570
|
-
const
|
|
571
|
-
((
|
|
572
|
-
} catch (
|
|
573
|
-
console.error(
|
|
560
|
+
const m = s.originDuration !== void 0 ? s.originDuration * (1 - this.getProgress()) : void 0, o = s.keyframe, { privateState: n } = this;
|
|
561
|
+
((a = this.privateState.currentPlayKeyframe) == null ? void 0 : a.keyframe.id) !== o.id && (this.privateState.currentPlayKeyframe = { keyframe: o }), n.currentPlayQueue.push(this.getPlayPromise(o, { duration: m }));
|
|
562
|
+
} catch (m) {
|
|
563
|
+
console.error(m);
|
|
574
564
|
}
|
|
575
565
|
}
|
|
576
566
|
/**
|
|
@@ -583,12 +573,12 @@ class am extends V {
|
|
|
583
573
|
* @description Set pause data
|
|
584
574
|
*/
|
|
585
575
|
setPauseData() {
|
|
586
|
-
var t, i,
|
|
576
|
+
var t, i, e;
|
|
587
577
|
if ((t = this.data) != null && t.id)
|
|
588
578
|
return this.pauseDataMap.set(this.data.id, {
|
|
589
579
|
id: (i = this.privateState.currentPlayKeyframe) == null ? void 0 : i.keyframe.id,
|
|
590
580
|
fiveState: this.five.getCurrentState(),
|
|
591
|
-
duration: (
|
|
581
|
+
duration: (e = this.privateState.currentPlayKeyframe) == null ? void 0 : e.originDuration,
|
|
592
582
|
playedProgress: this.getProgress()
|
|
593
583
|
});
|
|
594
584
|
}
|
|
@@ -602,43 +592,43 @@ class am extends V {
|
|
|
602
592
|
* @description Play single keyframe
|
|
603
593
|
*/
|
|
604
594
|
playKeyframe(t, i) {
|
|
605
|
-
return
|
|
606
|
-
var
|
|
607
|
-
const { privateState:
|
|
608
|
-
return ((
|
|
595
|
+
return y(this, null, function* () {
|
|
596
|
+
var r;
|
|
597
|
+
const { privateState: e } = this;
|
|
598
|
+
return ((r = this.privateState.currentPlayKeyframe) == null ? void 0 : r.keyframe.id) !== t.id && (this.privateState.currentPlayKeyframe = { keyframe: t }), e.currentPlayQueue.push(this.getPlayPromise(t, i)), this.actionPromiseQueue();
|
|
609
599
|
});
|
|
610
600
|
}
|
|
611
601
|
/**
|
|
612
602
|
* @description: getPlayPromise
|
|
613
603
|
*/
|
|
614
|
-
getPlayPromise(
|
|
615
|
-
return
|
|
616
|
-
var
|
|
617
|
-
const
|
|
618
|
-
if (i.duration = (
|
|
619
|
-
return new Promise((s,
|
|
620
|
-
let
|
|
604
|
+
getPlayPromise(e) {
|
|
605
|
+
return y(this, arguments, function* (t, i = {}) {
|
|
606
|
+
var p;
|
|
607
|
+
const r = t.data;
|
|
608
|
+
if (i.duration = (p = i.duration) != null ? p : t.start !== void 0 && t.end !== void 0 ? t.end - t.start : void 0, !!r)
|
|
609
|
+
return new Promise((s, a) => {
|
|
610
|
+
let m = !1;
|
|
621
611
|
this.addInterruptListener(() => {
|
|
622
|
-
if (!
|
|
623
|
-
return this.hooks.emit("broke"), this.privateState.broke = !0, this.setState({ playing: !1 }),
|
|
612
|
+
if (!m)
|
|
613
|
+
return this.hooks.emit("broke"), this.privateState.broke = !0, this.setState({ playing: !1 }), m = !0, a(new Error("play is interupted"));
|
|
624
614
|
});
|
|
625
615
|
try {
|
|
626
|
-
if (
|
|
616
|
+
if (m)
|
|
627
617
|
return;
|
|
628
|
-
const
|
|
629
|
-
s(),
|
|
618
|
+
const o = () => {
|
|
619
|
+
s(), m = !0;
|
|
630
620
|
};
|
|
631
|
-
switch (
|
|
621
|
+
switch (r.effect) {
|
|
632
622
|
case "Move":
|
|
633
|
-
this.move(
|
|
623
|
+
this.move(r, i).then(o);
|
|
634
624
|
break;
|
|
635
625
|
case "Rotate":
|
|
636
|
-
this.rotate(
|
|
626
|
+
this.rotate(r, i).then(o);
|
|
637
627
|
break;
|
|
638
628
|
default:
|
|
639
|
-
this.rotate(
|
|
629
|
+
this.rotate(r, i).then(o);
|
|
640
630
|
}
|
|
641
|
-
} catch (
|
|
631
|
+
} catch (o) {
|
|
642
632
|
}
|
|
643
633
|
});
|
|
644
634
|
});
|
|
@@ -647,19 +637,19 @@ class am extends V {
|
|
|
647
637
|
* @description Action promise queue in sequence
|
|
648
638
|
*/
|
|
649
639
|
actionPromiseQueue() {
|
|
650
|
-
return
|
|
640
|
+
return y(this, null, function* () {
|
|
651
641
|
const { privateState: t } = this;
|
|
652
|
-
return new Promise((i,
|
|
642
|
+
return new Promise((i, e) => {
|
|
653
643
|
if (t.currentPlayQueue.length === 0) {
|
|
654
644
|
i();
|
|
655
645
|
return;
|
|
656
646
|
}
|
|
657
|
-
const
|
|
658
|
-
if (!
|
|
647
|
+
const r = t.currentPlayQueue.shift();
|
|
648
|
+
if (!r) {
|
|
659
649
|
i();
|
|
660
650
|
return;
|
|
661
651
|
}
|
|
662
|
-
|
|
652
|
+
r.then(i, e);
|
|
663
653
|
}).then(() => t.currentPlayQueue.length === 0 ? Promise.resolve() : this.actionPromiseQueue());
|
|
664
654
|
});
|
|
665
655
|
}
|
|
@@ -667,103 +657,52 @@ class am extends V {
|
|
|
667
657
|
* @description Action move keyframe
|
|
668
658
|
*/
|
|
669
659
|
move(t, i) {
|
|
670
|
-
return
|
|
671
|
-
|
|
672
|
-
|
|
660
|
+
return y(this, null, function* () {
|
|
661
|
+
if (t.mode && t.mode !== this.five.currentMode)
|
|
662
|
+
yield this.changeMode(t);
|
|
663
|
+
else if (t.panoIndex !== this.five.panoIndex)
|
|
664
|
+
yield this.changePano(t, i);
|
|
665
|
+
else
|
|
666
|
+
return Promise.resolve();
|
|
673
667
|
});
|
|
674
668
|
}
|
|
675
669
|
/**
|
|
676
670
|
* @description Action rotate keyframe
|
|
677
671
|
*/
|
|
678
672
|
rotate(t, i) {
|
|
679
|
-
return
|
|
680
|
-
|
|
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)
|
|
673
|
+
return y(this, null, function* () {
|
|
674
|
+
if (t.mode && t.mode !== this.five.currentMode)
|
|
682
675
|
yield this.changeMode({ mode: t.mode, panoIndex: t.panoIndex });
|
|
683
676
|
else if (t.panoIndex && t.panoIndex !== this.five.panoIndex)
|
|
684
677
|
return yield this.changePano(t, i);
|
|
685
|
-
yield this.updateCamera(t, i)
|
|
678
|
+
yield this.updateCamera(t, i);
|
|
686
679
|
});
|
|
687
680
|
}
|
|
688
681
|
/**
|
|
689
682
|
* @description Update five camera
|
|
690
683
|
*/
|
|
691
|
-
updateCamera(
|
|
692
|
-
return
|
|
693
|
-
const { five:
|
|
694
|
-
var
|
|
695
|
-
const
|
|
696
|
-
if ((
|
|
697
|
-
return
|
|
698
|
-
if (
|
|
699
|
-
return
|
|
700
|
-
})(),
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
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);
|
|
684
|
+
updateCamera(e) {
|
|
685
|
+
return y(this, arguments, function* (t, i = {}) {
|
|
686
|
+
const { five: r, privateState: p, state: s } = this, a = (() => {
|
|
687
|
+
var d, u;
|
|
688
|
+
const n = (d = s.config) == null ? void 0 : d.speedConfig, f = (u = t.rotateSpeed) != null ? u : n == null ? void 0 : n.rotateSpeed;
|
|
689
|
+
if ((n == null ? void 0 : n.rotateSpeedUnit) === void 0)
|
|
690
|
+
return f;
|
|
691
|
+
if (f !== void 0)
|
|
692
|
+
return n.rotateSpeedUnit === "rad/ms" ? f : f / 1e3;
|
|
693
|
+
})(), m = (() => {
|
|
694
|
+
if (i.duration)
|
|
695
|
+
return i.duration;
|
|
696
|
+
if (a) {
|
|
697
|
+
const n = this.five.getCurrentState();
|
|
698
|
+
return L(n, t) / a;
|
|
699
|
+
}
|
|
700
|
+
return 800;
|
|
701
|
+
})();
|
|
702
|
+
p.currentPlayKeyframe && (p.currentPlayKeyframe.originDuration = m);
|
|
703
|
+
const o = this.getSpeededDuration(m);
|
|
704
|
+
return new Promise((n) => {
|
|
705
|
+
T(() => r.updateCamera(t, o)), setTimeout(() => n(), o);
|
|
767
706
|
});
|
|
768
707
|
});
|
|
769
708
|
}
|
|
@@ -771,40 +710,40 @@ class am extends V {
|
|
|
771
710
|
* @description: Change five pano
|
|
772
711
|
*/
|
|
773
712
|
changePano(t, i) {
|
|
774
|
-
return
|
|
775
|
-
const { five:
|
|
776
|
-
if (typeof t.panoIndex != "number" || t.panoIndex ===
|
|
713
|
+
return y(this, null, function* () {
|
|
714
|
+
const { five: e, privateState: r, state: p } = this;
|
|
715
|
+
if (typeof t.panoIndex != "number" || t.panoIndex === e.panoIndex)
|
|
777
716
|
return;
|
|
778
|
-
const s =
|
|
717
|
+
const s = e.getCurrentState().mode !== "Panorama";
|
|
779
718
|
s && (this.privateState.modeChanging = !0);
|
|
780
|
-
const
|
|
781
|
-
var
|
|
782
|
-
const
|
|
783
|
-
if ((
|
|
784
|
-
return
|
|
785
|
-
if (
|
|
786
|
-
return
|
|
787
|
-
})(),
|
|
719
|
+
const a = (() => {
|
|
720
|
+
var f, d;
|
|
721
|
+
const o = (f = p.config) == null ? void 0 : f.speedConfig, n = (d = t.moveSpeed) != null ? d : o == null ? void 0 : o.moveSpeed;
|
|
722
|
+
if ((o == null ? void 0 : o.moveSpeedUnit) === void 0)
|
|
723
|
+
return n;
|
|
724
|
+
if (n !== void 0)
|
|
725
|
+
return o.moveSpeedUnit === "m/ms" ? n : n / 1e3;
|
|
726
|
+
})(), m = (() => {
|
|
788
727
|
if (i != null && i.duration)
|
|
789
728
|
return i.duration;
|
|
790
|
-
if (
|
|
791
|
-
const
|
|
792
|
-
return
|
|
729
|
+
if (a && typeof e.panoIndex == "number" && typeof t.panoIndex == "number") {
|
|
730
|
+
const o = this.workUtil.getObserverPosition(e.panoIndex), n = this.workUtil.getObserverPosition(t.panoIndex);
|
|
731
|
+
return o && n ? o.distanceTo(n) / a : 800;
|
|
793
732
|
}
|
|
794
733
|
return 800;
|
|
795
734
|
})();
|
|
796
|
-
|
|
797
|
-
var
|
|
798
|
-
const
|
|
735
|
+
r.currentPlayKeyframe && (r.currentPlayKeyframe.originDuration = m), yield new Promise((o) => {
|
|
736
|
+
var f, d, u;
|
|
737
|
+
const n = this.fiveUtil.moveToPano(t.panoIndex, {
|
|
799
738
|
latitude: t.latitude,
|
|
800
739
|
longitude: t.longitude,
|
|
801
740
|
fov: t.fov,
|
|
802
|
-
duration: this.getSpeededDuration(
|
|
803
|
-
effect: (
|
|
804
|
-
moveCancelCallback: () =>
|
|
805
|
-
moveEndCallback: () =>
|
|
741
|
+
duration: this.getSpeededDuration(m),
|
|
742
|
+
effect: (u = (d = i == null ? void 0 : i.moveEffect) != null ? d : (f = this.state.config) == null ? void 0 : f.moveEffect) != null ? u : t.moveEffect,
|
|
743
|
+
moveCancelCallback: () => o(),
|
|
744
|
+
moveEndCallback: () => o()
|
|
806
745
|
});
|
|
807
|
-
|
|
746
|
+
n instanceof Promise && n.then(() => o()), s && e.once("panoArrived", () => o());
|
|
808
747
|
}), s && (this.privateState.modeChanging = !1);
|
|
809
748
|
});
|
|
810
749
|
}
|
|
@@ -812,34 +751,11 @@ class am extends V {
|
|
|
812
751
|
* @description Change five mode
|
|
813
752
|
*/
|
|
814
753
|
changeMode(t, i) {
|
|
815
|
-
return
|
|
754
|
+
return y(this, null, function* () {
|
|
816
755
|
t.mode && t.mode !== this.five.currentMode && (this.privateState.modeChanging = !0, yield this.five.changeMode(t.mode, t, i), this.privateState.modeChanging = !1);
|
|
817
756
|
});
|
|
818
757
|
}
|
|
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
|
-
}
|
|
842
758
|
}
|
|
843
759
|
export {
|
|
844
|
-
|
|
760
|
+
ia as default
|
|
845
761
|
};
|