@realsee/dnalogel 3.6.0 → 3.7.0

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.
Files changed (46) hide show
  1. package/dist/CruisePlugin/BaseController.d.ts +159 -0
  2. package/dist/CruisePlugin/Move.d.ts +40 -0
  3. package/dist/CruisePlugin/Work.d.ts +120 -0
  4. package/dist/CruisePlugin/index.d.ts +6 -4
  5. package/dist/CruisePlugin/typing.d.ts +2 -2
  6. package/dist/CruisePlugin/utils/getFiveStateOnCurve.d.ts +11 -0
  7. package/dist/GuideLinePlugin/Controller.d.ts +1 -6
  8. package/dist/index.cjs.js +54 -54
  9. package/dist/index.js +3565 -3466
  10. package/dist/index.umd.js +47 -47
  11. package/dist/shared-utils/five/fiveLoaded.d.ts +2 -0
  12. package/dist/shared-utils/five/fiveReady.d.ts +2 -0
  13. package/libs/CruisePlugin/BaseController.d.ts +159 -0
  14. package/libs/CruisePlugin/BaseController.js +231 -0
  15. package/libs/CruisePlugin/Move.d.ts +40 -0
  16. package/libs/CruisePlugin/Move.js +137 -0
  17. package/libs/CruisePlugin/Work.d.ts +120 -0
  18. package/libs/CruisePlugin/Work.js +598 -0
  19. package/libs/CruisePlugin/index.d.ts +6 -4
  20. package/libs/CruisePlugin/index.js +19 -12
  21. package/libs/CruisePlugin/typing.d.ts +2 -2
  22. package/libs/CruisePlugin/utils/getFiveStateOnCurve.d.ts +11 -0
  23. package/libs/CruisePlugin/utils/getFiveStateOnCurve.js +11 -0
  24. package/libs/GuideLinePlugin/Controller.d.ts +1 -6
  25. package/libs/GuideLinePlugin/Controller.js +49 -62
  26. package/libs/GuideLinePlugin/GuideLineItem/index.js +53 -43
  27. package/libs/GuideLinePlugin/GuideLineItem.js +14 -10
  28. package/libs/GuideLinePlugin/index.js +21 -17
  29. package/libs/base/BasePlugin.js +1 -1
  30. package/libs/index.js +126 -119
  31. package/libs/shared-utils/five/fiveLoaded.d.ts +2 -0
  32. package/libs/shared-utils/five/fiveLoaded.js +30 -0
  33. package/libs/shared-utils/five/fiveReady.d.ts +2 -0
  34. package/libs/shared-utils/five/fiveReady.js +28 -0
  35. package/libs/shared-utils/formatRad.d.ts +7 -0
  36. package/libs/shared-utils/formatRad.js +7 -0
  37. package/libs/shared-utils/logger.js +1 -1
  38. package/package.json +3 -3
  39. package/dist/CruisePlugin/Controller.d.ts +0 -171
  40. package/dist/CruisePlugin/utils/linerValue.d.ts +0 -1
  41. package/libs/CruisePlugin/Controller.d.ts +0 -171
  42. package/libs/CruisePlugin/Controller.js +0 -760
  43. /package/dist/{CruisePlugin/utils → shared-utils}/formatRad.d.ts +0 -0
  44. /package/dist/{CruisePlugin/utils/vectorToCoordinates.d.ts → shared-utils/vectorToCoordinate.d.ts} +0 -0
  45. /package/libs/{CruisePlugin/utils/vectorToCoordinates.d.ts → shared-utils/vectorToCoordinate.d.ts} +0 -0
  46. /package/libs/{CruisePlugin/utils/vectorToCoordinates.js → shared-utils/vectorToCoordinate.js} +0 -0
@@ -1,760 +0,0 @@
1
- var T = Object.defineProperty, K = Object.defineProperties;
2
- var A = Object.getOwnPropertyDescriptors;
3
- var F = Object.getOwnPropertySymbols;
4
- var O = Object.prototype.hasOwnProperty, U = Object.prototype.propertyIsEnumerable;
5
- var L = (c, l, e) => l in c ? T(c, l, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[l] = e, P = (c, l) => {
6
- for (var e in l || (l = {}))
7
- O.call(l, e) && L(c, e, l[e]);
8
- if (F)
9
- for (var e of F(l))
10
- U.call(l, e) && L(c, e, l[e]);
11
- return c;
12
- }, C = (c, l) => K(c, A(l));
13
- var I = (c, l, e) => (L(c, typeof l != "symbol" ? l + "" : l, e), e);
14
- var v = (c, l, e) => new Promise((t, r) => {
15
- var i = (d) => {
16
- try {
17
- s(e.next(d));
18
- } catch (a) {
19
- r(a);
20
- }
21
- }, n = (d) => {
22
- try {
23
- s(e.throw(d));
24
- } catch (a) {
25
- r(a);
26
- }
27
- }, s = (d) => d.done ? t(d.value) : Promise.resolve(d.value).then(i, n);
28
- s((e = e.apply(c, l)).next());
29
- });
30
- import { Controller as V } from "../base/BasePluginWithData.js";
31
- import { GuideLinePlugin as $ } from "../GuideLinePlugin/index.js";
32
- import { uuid as w } from "../shared-utils/uuid.js";
33
- import { coordinatesAngle as Q } from "./utils/coordinatesAngle.js";
34
- import { safeCall as _ } from "./utils/safeCall.js";
35
- import { equal as R } from "../shared-utils/equal.js";
36
- import { vectorToCoordinates as N } from "./utils/vectorToCoordinates.js";
37
- import * as j from "three";
38
- import H from "./utils/linerValue.js";
39
- import { sleep as J } from "./utils/sleep.js";
40
- import "../base/BasePlugin.js";
41
- import "../shared-utils/Subscribe.js";
42
- import "hammerjs";
43
- import "@realsee/five";
44
- import "../vendor/@tweenjs/tween/dist/tween.esm.js.js";
45
- import "../CSS3DRenderPlugin/utils/three/CSS3DRender.js";
46
- import "../shared-utils/positionToVector3.js";
47
- import "../CSS3DRenderPlugin/utils/three/CSS3DRenderer.js";
48
- import "three/examples/jsm/renderers/CSS3DRenderer";
49
- import "../CSS3DRenderPlugin/utils/getAllCSS3DObject.js";
50
- import "../shared-utils/util.js";
51
- import "../CSS3DRenderPlugin/utils/createResizeObserver.js";
52
- import "../CSS3DRenderPlugin/utils/even.js";
53
- import "../CSS3DRenderPlugin/utils/three/CSS3DObject.js";
54
- import "../CSS3DRenderPlugin/utils/three/OpacityMesh.js";
55
- import "../shared-utils/three/centerPoint.js";
56
- import "../shared-utils/three/getObjectVisible.js";
57
- import "../CSS3DRenderPlugin/utils/three/CSS3DScene.js";
58
- import "../CSS3DRenderPlugin/utils/three/CSS3DGroup.js";
59
- import "../CSS3DRenderPlugin/utils/generateBehindFiveElement.js";
60
- import "../shared-utils/url/absoluteUrl.js";
61
- import "../GuideLinePlugin/Controller.js";
62
- import "../GuideLinePlugin/GuideLineItem/index.js";
63
- import "../GuideLinePlugin/GuideLineModeItem/index.js";
64
- import "../shared-utils/log.js";
65
- import "../GuideLinePlugin/utils/createLineGeometry.js";
66
- import "../vendor/polyline-normals/index.js";
67
- import "../vendor/polyline-miter-util/index.js";
68
- import "../vendor/gl-vec2/add.js";
69
- import "../vendor/gl-vec2/set.js";
70
- import "../vendor/gl-vec2/normalize.js";
71
- import "../vendor/gl-vec2/subtract.js";
72
- import "../vendor/gl-vec2/dot.js";
73
- import "../shared-utils/five/mode.js";
74
- import "../shared-utils/animationFrame/BetterTween.js";
75
- import "../shared-utils/animationFrame/index.js";
76
- import "../shared-utils/three/loadTexture.js";
77
- import "../PanoTagPlugin/controller/index.js";
78
- import "../vendor/object-assign-deep/objectAssignDeep.js";
79
- import "../PanoTagPlugin/utils/addDebugPoints.js";
80
- import "../PanoTagPlugin/utils/tag/tagCheck.js";
81
- import "../PanoTagPlugin/utils/debounce.js";
82
- import "../PanoTagPlugin/utils/throttle.js";
83
- import "../PanoTagPlugin/utils/resizeObserver.js";
84
- import "../PanoTagPlugin/utils/tag/format.js";
85
- import "../shared-utils/audio.js";
86
- import "../PanoTagPlugin/controller/TagRender.js";
87
- import "../PanoTagPlugin/controller/TagComputer.js";
88
- import "../PanoTagPlugin/utils/tagPosition.js";
89
- import "../PanoTagPlugin/utils/checkRange.js";
90
- import "../shared-utils/isNil.js";
91
- import "../PanoTagPlugin/controller/TagUtil.js";
92
- import "../PanoTagPlugin/typings/tag/TagConfig.js";
93
- import "../PanoTagPlugin/tag.config.js";
94
- import "../PanoTagPlugin/utils/planeNormal.js";
95
- import "../PanoTagPlugin/utils/normalPositionToPositions.js";
96
- import "../PanoTagPlugin/controller/TagCache.js";
97
- import "../vendor/svelte/store/index.js";
98
- import "../vendor/svelte/internal/index.js";
99
- import "../shared-utils/device.js";
100
- import "../PanoTagPlugin/utils/model/mediaPlane.js";
101
- import "../shared-utils/three/Quadrangle.js";
102
- import "../shared-utils/math/pointIsRectangle.js";
103
- import "../shared-utils/three/loadVideoTexture.js";
104
- import "../PanoTagPlugin/Assets/Icon.js";
105
- import "../shared-utils/three/getPositionsByObjectFit.js";
106
- import "../shared-utils/three/FragmentTransparencyMaterial.js";
107
- import "../shared-utils/three/getNormal.js";
108
- import "../shared-utils/five/FiveDomEvents.js";
109
- import "../shared-utils/five/calculateThreeMouse.js";
110
- import "../PanoTagPlugin/utils/tag/adaptConfig.js";
111
- import "../shared-utils/typescript/entries.js";
112
- import "../shared-utils/url/getUrl.js";
113
- import "../shared-utils/five/transformPosition.js";
114
- import "../shared-utils/five/getFloorIndex.js";
115
- import "../shared-utils/safeObj.js";
116
- import "../PanoTagPlugin/Components/TagContainer.js";
117
- import "../PanoTagPlugin/Components/TagItem.js";
118
- import "../PanoTagPlugin/Components/Tag/index.js";
119
- import "../PanoTagPlugin/Components/Tag/TextTag/index.js";
120
- import "../PanoTagPlugin/Components/Tag/TextTag/TextTag.js";
121
- import "../PanoTagPlugin/Components/Common/Line/Straight.js";
122
- import "../vendor/svelte/transition/index.js";
123
- import "../vendor/svelte/easing/index.js";
124
- import "../PanoTagPlugin/Components/Common/Shadow.js";
125
- import "../PanoTagPlugin/Components/Common/Text/FlyMText.js";
126
- import "../PanoTagPlugin/Components/Common/Text/FlyText.js";
127
- import "animejs";
128
- import "../PanoTagPlugin/utils/search.js";
129
- import "../PanoTagPlugin/utils/constants.js";
130
- import "../PanoTagPlugin/Components/Common/Arrow.js";
131
- import "../PanoTagPlugin/utils/doUtil.js";
132
- import "../shared-utils/svelte/resizeObserver.js";
133
- import "../vendor/resize-observer-polyfill/dist/ResizeObserver.es.js";
134
- import "../PanoTagPlugin/Components/Tag/TextTag/TextPlaneTag.js";
135
- import "../PanoTagPlugin/Components/Common/Text/MText.js";
136
- import "../PanoTagPlugin/utils/px2rem.js";
137
- import "../PanoTagPlugin/Components/Tag/ImageTextTag.js";
138
- import "../PanoTagPlugin/Components/Common/Line/Polyline.js";
139
- import "../PanoTagPlugin/Components/Common/Media.js";
140
- import "../vendor/svelte-carousel/src/components/Carousel/Carousel.js";
141
- import "../vendor/svelte-carousel/src/components/Dots/Dots.js";
142
- import "../vendor/svelte-carousel/src/components/Dot/Dot.js";
143
- import "../vendor/svelte-carousel/src/components/Arrow/Arrow.js";
144
- import "../vendor/svelte-carousel/src/direction.js";
145
- import "../vendor/svelte-carousel/src/components/Progress/Progress.js";
146
- import "../vendor/svelte-carousel/src/actions/swipeable/swipeable.js";
147
- import "../vendor/svelte-carousel/src/actions/swipeable/event.js";
148
- import "../vendor/svelte-carousel/src/utils/event.js";
149
- import "../vendor/svelte-carousel/src/units.js";
150
- import "../vendor/svelte-carousel/src/actions/hoverable/hoverable.js";
151
- import "../vendor/svelte-carousel/src/actions/hoverable/event.js";
152
- import "../vendor/svelte-carousel/src/actions/tappable/tappable.js";
153
- import "../vendor/svelte-carousel/src/utils/math.js";
154
- import "../vendor/svelte-carousel/src/actions/tappable/event.js";
155
- import "../vendor/svelte-carousel/src/utils/page.js";
156
- import "../vendor/svelte-carousel/src/utils/clones.js";
157
- import "../vendor/svelte-carousel/src/utils/object.js";
158
- import "../vendor/svelte-carousel/src/components/Carousel/createCarousel.js";
159
- import "../vendor/easy-reactive/src/simply-reactive.js";
160
- import "../vendor/lodash.get/index.js";
161
- import "../_commonjsHelpers.js";
162
- import "../vendor/lodash.clonedeep/index.js";
163
- import "../vendor/easy-reactive/src/utils/subscription.js";
164
- import "../vendor/easy-reactive/src/utils/object.js";
165
- import "../vendor/lodash.isequal/index.js";
166
- import "../vendor/easy-reactive/src/utils/watcher.js";
167
- import "../vendor/svelte-carousel/src/utils/lazy.js";
168
- import "../vendor/svelte-carousel/src/utils/ProgressManager.js";
169
- import "../vendor/svelte-carousel/src/utils/interval.js";
170
- import "../PanoTagPlugin/Components/Common/MediaItem.js";
171
- import "../PanoTagPlugin/Components/Tag/MarketingTag.js";
172
- import "../PanoTagPlugin/utils/noTypecheck.js";
173
- import "../PanoTagPlugin/Components/Tag/AudioTag/index.js";
174
- import "../PanoTagPlugin/Components/Tag/AudioTag/AudioTag.js";
175
- import "../PanoTagPlugin/Components/Common/Audio.js";
176
- import "../PanoTagPlugin/utils/audio/SharedAudio.js";
177
- import "../PanoTagPlugin/Components/Common/Icon/audioIcon.js";
178
- import "../PanoTagPlugin/Components/Tag/AudioTag/AudioPlaneTag.js";
179
- import "../PanoTagPlugin/Components/Tag/MediaPlane.js";
180
- import "../PanoTagPlugin/Components/Tag/LinkTag.js";
181
- import "../PanoTagPlugin/Components/Common/Icon/Icon.js";
182
- import "../PanoTagPlugin/utils/getImageInfo.js";
183
- import "../PanoTagPlugin/Components/Tag/PanoramaTag.js";
184
- import "../PanoTagPlugin/Components/Tag/CustomTag.js";
185
- import "../vendor/classnames/index.js";
186
- import "../PanoTagPlugin/Components/Common/TagPoint.js";
187
- import "../CSS3DRenderPlugin/index.js";
188
- import "../CSS3DRenderPlugin/Controller.js";
189
- import "../CSS3DRenderPlugin/utils/waitFiveModelLoaded.js";
190
- import "../shared-utils/three/GLTFLoader.js";
191
- import "@realsee/five/gltf-loader";
192
- import "../shared-utils/five/fiveModelLoad.js";
193
- import "../GuideLinePlugin/Components/Tag.js";
194
- import "../GuideLinePlugin/utils/index.js";
195
- import "./Controller.js";
196
- import "../shared-utils/to.js";
197
- import "../shared-utils/five/changeMode.js";
198
- import "../shared-utils/nearlyEqual.js";
199
- import "./utils/coordinatesToVector.js";
200
- import "../shared-utils/isTruelyObject.js";
201
- import "./utils/formatRad.js";
202
- const M = "v1.0.6", G = "CruisePlugin", x = `${G}@${M}`, sr = (c) => `${x}--${c}`, D = () => {
203
- console.error(`${x} is disposed`);
204
- }, W = () => {
205
- console.warn(`${x} is disabled`);
206
- }, q = () => {
207
- console.error(`${x} is disabled`);
208
- }, E = /* @__PURE__ */ new Map();
209
- class z extends V {
210
- constructor(e, t) {
211
- super(e, t);
212
- I(this, "state", {
213
- visible: !0,
214
- enabled: !0,
215
- disposed: !1,
216
- playing: !1,
217
- speed: 1,
218
- config: {
219
- speedConfig: {
220
- rotateSpeed: 1e-3,
221
- rotateSpeedUnit: "rad/ms",
222
- moveSpeed: 2e-3,
223
- moveSpeedUnit: "m/ms"
224
- }
225
- }
226
- });
227
- I(this, "data");
228
- I(this, "config");
229
- I(this, "privateState", {
230
- playing: !1,
231
- currentPlayQueue: [],
232
- currentPlayKeyframe: null,
233
- broke: !1,
234
- disposers: [],
235
- modeChanging: !1
236
- });
237
- I(this, "GuideLine");
238
- this.config = t, Object.assign(window, { [`__${G}_DEBUG__`]: this });
239
- const r = this.setFiveLinearUpdateCamera.bind(this), i = this.setFiveOriginUpdateCamera.bind(this);
240
- this.hooks.on("play", r), this.hooks.on("broke", i), this.hooks.on("end", i), this.hooks.on("pause", i), this.privateState.disposers.push(() => {
241
- this.hooks.off("play", r), this.hooks.off("broke", i), this.hooks.off("end", i), this.hooks.off("pause", i);
242
- });
243
- }
244
- /**
245
- * @description Load Data and State
246
- */
247
- load(e, t, r) {
248
- return v(this, null, function* () {
249
- var o, m, f, u, h, g;
250
- if (this.state.disposed)
251
- return D();
252
- this.privateState.fiveOriginGetProgress || (m = (o = this.five.controller) == null ? void 0 : o.cameraMotion) != null && m.getProgress || (yield this.waitFiveLoaded(), this.privateState.fiveOriginGetProgress = (u = (f = this.five.controller) == null ? void 0 : f.cameraMotion) == null ? void 0 : u.getProgress), this.clear();
253
- const i = this.data ? JSON.parse(JSON.stringify(this.data)) : void 0, n = yield this.formatData(e);
254
- this.data = n, this.hooks.emit("dataChange", n, i);
255
- let s = [], d;
256
- const a = this.data.keyframes.filter((p) => p.data.panoIndex !== void 0);
257
- a.filter((p, y) => {
258
- var S;
259
- return p.data.panoIndex !== ((S = a[y - 1]) == null ? void 0 : S.data.panoIndex);
260
- }).map((p) => p.data.panoIndex).forEach((p) => {
261
- var S, k;
262
- const y = (S = this.five.work.observers[p]) == null ? void 0 : S.floorIndex;
263
- if (y !== void 0)
264
- if (d === y) {
265
- const b = s.length - 1;
266
- s[b] = [...(k = s[b]) != null ? k : [], p];
267
- } else {
268
- d = y;
269
- const b = s.length;
270
- s[b] = [p];
271
- }
272
- }), !this.GuideLine && ((h = this.config) == null ? void 0 : h.useGuideLine) !== !1 && n.useGuildLine !== !1 && (this.GuideLine = $(this.five, this.config)), (g = this.GuideLine) == null || g.load({ routes: s.map((p) => ({ panoIndexList: p })), config: n.guildPluginOptions }), t ? this.setState(t, { 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(`${x} loaded`, n), this.hooks.emit("dataLoaded", n);
273
- });
274
- }
275
- /**
276
- * @description Play | Continue play. if have been paused, continue play from the pause position; if playing, do nothing
277
- */
278
- play(e) {
279
- this.setState({ playing: !0 }, e);
280
- }
281
- /**
282
- * @description If playing, first pause, then play from keyframes index/id
283
- * @param {number} options.index play from keyframes index
284
- * @param {string} options.id play from keyframes id
285
- */
286
- playFrom(e) {
287
- const { index: t, id: r, userAction: i } = e;
288
- this.state.playing && this.setState({ playing: !1 }, { userAction: i }), this.setState({ playing: !0 }, { userAction: i, playFromIndex: t, playFromId: r });
289
- }
290
- /**
291
- * @description Play from first keyframe
292
- */
293
- playFromStart(e) {
294
- return this.playFrom(C(P({}, e), { index: 0 }));
295
- }
296
- /**
297
- * @description Pause
298
- */
299
- pause(e) {
300
- this.setState({ playing: !1 }, e);
301
- }
302
- /**
303
- * @description Show guide line
304
- */
305
- show(e) {
306
- return v(this, null, function* () {
307
- this.setState({ visible: !0 }, e);
308
- });
309
- }
310
- /**
311
- * @description Hide guide line
312
- */
313
- hide(e) {
314
- return v(this, null, function* () {
315
- this.setState({ visible: !1 }, e);
316
- });
317
- }
318
- /**
319
- * @description Enable
320
- */
321
- enable(e) {
322
- this.setState({ enabled: !0 }, e);
323
- }
324
- /**
325
- * @description Disable
326
- */
327
- disable(e) {
328
- this.setState({ enabled: !1 }, e);
329
- }
330
- /**
331
- * @description Dispose
332
- */
333
- dispose() {
334
- this.setState({ disposed: !0 });
335
- }
336
- /**
337
- * @description Set state
338
- */
339
- setState(e, t) {
340
- var i;
341
- if (this.state.disposed)
342
- return D();
343
- if (!this.state.enabled && e.enabled !== !0 && e.disposed !== !0)
344
- return q();
345
- const r = P({}, this.state);
346
- this.state = P(P({}, this.state), e), e.disposed !== void 0 && e.disposed !== r.disposed && e.disposed && this.handleDispose(), e.visible !== void 0 && e.visible !== r.visible && this.handleVisible(e.visible, t == null ? void 0 : t.userAction), e.enabled !== void 0 && e.enabled !== r.enabled && this.handleEnable(e.enabled, t == null ? void 0 : t.userAction), e.playing !== void 0 && e.playing !== r.playing && this.changePlayState(e.playing, t), e.speed !== void 0 && e.speed !== r.speed && this.changeSpeed(e.speed, t == null ? void 0 : t.userAction), R(r, this.state, { deep: !0 }) || this.hooks.emit("stateChange", { state: this.state, prevState: r, userAction: (i = t == null ? void 0 : t.userAction) != null ? i : !0 });
347
- }
348
- /**
349
- * @description Format data
350
- */
351
- formatData(e) {
352
- return v(this, null, function* () {
353
- this.five.work || (yield this.waitFiveLoaded());
354
- const t = this.five.work.observers, r = (() => {
355
- const i = e;
356
- return typeof i == "object" && i !== null && i.version && i.data ? i.data : i;
357
- })();
358
- if (r.keyframes)
359
- return {
360
- keyframesId: w(),
361
- keyframes: r.keyframes.map((i, n) => {
362
- var a;
363
- const s = r.keyframes[n + 1], d = (() => !s || s.start === void 0 || i.end === void 0 ? 0 : s.start - i.end)();
364
- return C(P({ id: (a = i.uuid) != null ? a : w(), moveIndex: n, stay: d, index: n }, i), { guildPluginOptions: r.guildPluginOptions });
365
- })
366
- };
367
- if (r.panoIndexList) {
368
- let i = [];
369
- const { moveEffect: n, moveToFirstPanoEffect: s, moveToFirstPanoDuration: d } = r;
370
- return this.privateState.moveToFirstPanoEffect = s, this.privateState.moveToFirstPanoDuration = d, r.panoIndexList.forEach((a, o) => {
371
- const m = (() => {
372
- var p, y, S, k;
373
- const f = r.panoIndexList.slice(o).find((b) => b !== a);
374
- if (f === void 0)
375
- return;
376
- const u = (p = t[a]) == null ? void 0 : p.position, h = (y = t[f]) == null ? void 0 : y.position;
377
- if (!h || !u || ((S = t[a]) == null ? void 0 : S.floorIndex) !== ((k = t[f]) == null ? void 0 : k.floorIndex))
378
- return;
379
- const g = new j.Vector3().subVectors(h, u);
380
- return N(g.normalize());
381
- })();
382
- r.moveType === void 0 || r.moveType === "justMove" ? i.push({
383
- moveIndex: o,
384
- stay: r.stay,
385
- data: P({ effect: "Move", panoIndex: a, moveEffect: n }, m != null ? m : {})
386
- }) : r.moveType === "moveAndRotate" && (i.push({ moveIndex: o, stay: r.stay, data: { effect: "Move", panoIndex: a, moveEffect: n } }), m && i.push({ moveIndex: o, stay: r.stay, data: P({ effect: "Rotate", panoIndex: a }, m) }));
387
- }), {
388
- keyframesId: w(),
389
- keyframes: i.map((a, o) => P({ id: w(), index: o }, a)),
390
- guildPluginOptions: r.guildPluginOptions,
391
- useGuildLine: r.useGuildLine
392
- };
393
- } else
394
- throw new Error("format error: data no keyframes or no panoIndexList");
395
- });
396
- }
397
- handleEnable(e, t = !0) {
398
- var r, i;
399
- e ? ((r = this.GuideLine) == null || r.enable(), this.hooks.emit("enable", { userAction: t })) : ((i = this.GuideLine) == null || i.disable(), this.changePlayState(!1, { userAction: t }), this.hooks.emit("disable", { userAction: t })), this.state.enabled = e;
400
- }
401
- handleVisible(e, t = !0) {
402
- var r, i;
403
- e ? ((r = this.GuideLine) == null || r.show(), this.actionIfStateIsEnabled(() => this.hooks.emit("show", { userAction: t }))) : ((i = this.GuideLine) == null || i.hide(), this.actionIfStateIsEnabled(() => this.hooks.emit("hide", { userAction: t }))), this.state.visible = e;
404
- }
405
- changePlayState(e, t) {
406
- this.actionIfStateIsEnabled(
407
- () => {
408
- var r;
409
- return this.hooks.emit("playStateChange", e ? "playing" : "pause", { userAction: (r = t == null ? void 0 : t.userAction) != null ? r : !0 });
410
- }
411
- ), e ? this.handlePlay(t) : this.handlePause(t), this.state.playing = e;
412
- }
413
- /**
414
- * @description Play | Continue play. if have been paused, continue play from the pause position; if playing, do nothing
415
- * @param {number} options.playFromIndex play from keyframes index
416
- * @param {string} options.playFromId play from keyframes id
417
- */
418
- // eslint-disable-next-line complexity
419
- handlePlay(e) {
420
- return v(this, null, function* () {
421
- var u;
422
- const { data: t, state: r, privateState: i, hooks: n } = this;
423
- if (i.playing || !(t != null && t.keyframes) || (t == null ? void 0 : t.keyframes.length) === 0)
424
- return;
425
- const s = w();
426
- i.playId = s, i.playing = !0, i.broke = !1;
427
- const d = t.keyframes, a = this.getPauseData();
428
- (e == null ? void 0 : e.notEmitEvent) !== !0 && n.emit("play", { userAction: (u = e == null ? void 0 : e.userAction) != null ? u : !0 });
429
- let o = !1;
430
- const f = yield (() => v(this, null, function* () {
431
- var h, g;
432
- if ((e == null ? void 0 : e.playFromIndex) !== void 0)
433
- return e.playFromIndex;
434
- if ((e == null ? void 0 : e.playFromId) !== void 0)
435
- return (h = this.data) == null ? void 0 : h.keyframes.findIndex((p) => p.id === e.playFromId);
436
- if (a != null && a.keyframeId) {
437
- const p = (g = this.data) == null ? void 0 : g.keyframes.find((y) => y.id === a.keyframeId);
438
- if (a != null && a.fiveState && (yield this.move(a.fiveState, {
439
- moveEffect: i.moveToFirstPanoEffect,
440
- duration: i.moveToFirstPanoDuration
441
- })), p) {
442
- if (p.data.effect === "Move")
443
- return p.index;
444
- if (p.data.effect === "Rotate") {
445
- const y = a.duration !== void 0 ? a.duration * (1 - a.playedProgress) : void 0;
446
- return yield this.playKeyframe(p, { duration: y }), o = !0, p.index + 1;
447
- }
448
- }
449
- }
450
- }))();
451
- this.clearPauseData();
452
- for (const h of d) {
453
- if (i.broke || !r.playing || !i.playing || s !== i.playId)
454
- return;
455
- if (!(f !== void 0 && h.index < f))
456
- try {
457
- n.emit("playIndexChange", h.index, h), yield this.playKeyframe(h, {
458
- moveEffect: o === !1 ? i.moveToFirstPanoEffect : void 0,
459
- duration: o === !1 && typeof i.moveToFirstPanoDuration == "number" ? i.moveToFirstPanoDuration : void 0
460
- }), h.stay && (yield J(h.stay)), o === !1 && (o = !0);
461
- } catch (g) {
462
- return console.error(g), Promise.resolve("broke");
463
- }
464
- }
465
- r.playing && s === i.playId && (this.setState({ playing: !1 }, { userAction: !1 }), n.emit("end"), this.clearPauseData());
466
- });
467
- }
468
- /**
469
- * @description: Pause and record pause state
470
- */
471
- handlePause(e) {
472
- var n;
473
- const { state: t, privateState: r, hooks: i } = this;
474
- t.playing = !1, r.playing !== !1 && (r.playing = !1, (e == null ? void 0 : e.userAction) !== !1 && this.setPauseData(), r.broke || this.forceInteruptUpdateCamera(), (e == null ? void 0 : e.notEmitEvent) !== !0 && i.emit("pause", { userAction: (n = e == null ? void 0 : e.userAction) != null ? n : !0 }));
475
- }
476
- /**
477
- * @description Play single keyframe
478
- */
479
- playKeyframe(e, t) {
480
- return v(this, null, function* () {
481
- var i;
482
- const { privateState: r } = this;
483
- return ((i = this.privateState.currentPlayKeyframe) == null ? void 0 : i.keyframe.id) !== e.id && (this.privateState.currentPlayKeyframe = { keyframe: e }), r.currentPlayQueue.push(this.getPlayPromise(e, t)), this.actionPromiseQueue();
484
- });
485
- }
486
- /**
487
- * @description: listen interupted by five gesture
488
- */
489
- addInterruptListener(e) {
490
- const t = () => {
491
- this.privateState.modeChanging || e();
492
- }, r = (i) => {
493
- i !== "mouseMove" && e();
494
- };
495
- return this.five.once("gesture", r), this.five.once("wantsChangeMode", t), () => {
496
- this.five.off("gesture", r), this.five.once("wantsChangeMode", t);
497
- };
498
- }
499
- /**
500
- * @description: getPlayPromise
501
- */
502
- getPlayPromise(r) {
503
- return v(this, arguments, function* (e, t = {}) {
504
- var n;
505
- const i = e.data;
506
- if (t.duration = (n = t.duration) != null ? n : e.start !== void 0 && e.end !== void 0 ? e.end - e.start : void 0, !!i)
507
- return new Promise((s, d) => {
508
- let a = !1;
509
- this.addInterruptListener(() => {
510
- if (!a)
511
- return this.hooks.emit("broke"), this.privateState.broke = !0, this.setState({ playing: !1 }), a = !0, d(new Error("play is interupted"));
512
- });
513
- try {
514
- if (a)
515
- return;
516
- const o = () => {
517
- s(), a = !0;
518
- };
519
- switch (i.effect) {
520
- case "Move":
521
- this.move(i, t).then(o);
522
- break;
523
- case "Rotate":
524
- this.rotate(i, t).then(o);
525
- break;
526
- default:
527
- this.rotate(i, t).then(o);
528
- }
529
- } catch (o) {
530
- }
531
- });
532
- });
533
- }
534
- /**
535
- * @description Action promise queue in sequence
536
- */
537
- actionPromiseQueue() {
538
- return v(this, null, function* () {
539
- const { privateState: e } = this;
540
- return new Promise((t, r) => {
541
- if (e.currentPlayQueue.length === 0) {
542
- t();
543
- return;
544
- }
545
- const i = e.currentPlayQueue.shift();
546
- if (!i) {
547
- t();
548
- return;
549
- }
550
- i.then(t, r);
551
- }).then(() => e.currentPlayQueue.length === 0 ? Promise.resolve() : this.actionPromiseQueue());
552
- });
553
- }
554
- /**
555
- * @description Action move keyframe
556
- */
557
- move(e, t) {
558
- return v(this, null, function* () {
559
- if (e.mode && e.mode !== this.five.currentMode)
560
- yield this.changeMode(e);
561
- else if (e.panoIndex !== this.five.panoIndex)
562
- yield this.changePano(e, t);
563
- else
564
- return Promise.resolve();
565
- });
566
- }
567
- /**
568
- * @description Action rotate keyframe
569
- */
570
- rotate(e, t) {
571
- return v(this, null, function* () {
572
- if (e.mode && e.mode !== this.five.currentMode)
573
- yield this.changeMode({ mode: e.mode, panoIndex: e.panoIndex });
574
- else if (e.panoIndex && e.panoIndex !== this.five.panoIndex)
575
- return yield this.changePano(e, t);
576
- yield this.updateCamera(e, t);
577
- });
578
- }
579
- /**
580
- * @description Update five camera
581
- */
582
- updateCamera(r) {
583
- return v(this, arguments, function* (e, t = {}) {
584
- const { five: i, privateState: n, state: s } = this, d = (() => {
585
- var u, h;
586
- const m = (u = s.config) == null ? void 0 : u.speedConfig, f = (h = e.rotateSpeed) != null ? h : m == null ? void 0 : m.rotateSpeed;
587
- if ((m == null ? void 0 : m.rotateSpeedUnit) === void 0)
588
- return f;
589
- if (f !== void 0)
590
- return m.rotateSpeedUnit === "rad/ms" ? f : f / 1e3;
591
- })(), a = (() => {
592
- if (t.duration)
593
- return t.duration;
594
- if (d) {
595
- const m = this.five.getCurrentState();
596
- return Q(m, e) / d;
597
- }
598
- return 800;
599
- })();
600
- n.currentPlayKeyframe && (n.currentPlayKeyframe.originDuration = a);
601
- const o = this.getSpeededDuration(a);
602
- return new Promise((m) => {
603
- _(() => i.updateCamera(e, o)), setTimeout(() => m(), o);
604
- });
605
- });
606
- }
607
- /**
608
- * @description: Change five pano
609
- */
610
- changePano(e, t) {
611
- return v(this, null, function* () {
612
- const { five: r, privateState: i, state: n } = this;
613
- if (typeof e.panoIndex != "number" || e.panoIndex === r.panoIndex)
614
- return;
615
- const s = r.getCurrentState().mode !== "Panorama";
616
- s && (this.privateState.modeChanging = !0);
617
- const d = (() => {
618
- var f, u;
619
- const o = (f = n.config) == null ? void 0 : f.speedConfig, m = (u = e.moveSpeed) != null ? u : o == null ? void 0 : o.moveSpeed;
620
- if ((o == null ? void 0 : o.moveSpeedUnit) === void 0)
621
- return m;
622
- if (m !== void 0)
623
- return o.moveSpeedUnit === "m/ms" ? m : m / 1e3;
624
- })(), a = (() => {
625
- if (t != null && t.duration)
626
- return t.duration;
627
- if (d && typeof r.panoIndex == "number" && typeof e.panoIndex == "number") {
628
- const o = r.work.observers[r.panoIndex].position, m = r.work.observers[e.panoIndex].position;
629
- return o.distanceTo(m) / d;
630
- }
631
- return 800;
632
- })();
633
- i.currentPlayKeyframe && (i.currentPlayKeyframe.originDuration = a), yield new Promise((o) => {
634
- var m, f, u;
635
- r.moveToPano(e.panoIndex, {
636
- latitude: e.latitude,
637
- longitude: e.longitude,
638
- fov: e.fov,
639
- duration: this.getSpeededDuration(a),
640
- effect: (u = (f = t == null ? void 0 : t.moveEffect) != null ? f : (m = this.state.config) == null ? void 0 : m.moveEffect) != null ? u : e.moveEffect,
641
- moveCancelCallback: () => o(),
642
- moveEndCallback: () => o()
643
- }), s && r.once("panoArrived", () => o());
644
- }), s && (this.privateState.modeChanging = !1);
645
- });
646
- }
647
- /**
648
- * @description: Change play speed
649
- */
650
- changeSpeed(e, t = !0) {
651
- const { state: r, privateState: i, hooks: n } = this, { currentPlayKeyframe: s } = i;
652
- if (n.emit("speedChange", e, { userAction: t }), r.playing && s)
653
- try {
654
- const d = s.originDuration !== void 0 ? s.originDuration * (1 - this.getProgress()) : void 0, a = this.playKeyframe(s.keyframe, { duration: d });
655
- i.currentPlayQueue.push(a);
656
- } catch (d) {
657
- }
658
- }
659
- /**
660
- * @description Get duration by speed
661
- */
662
- getSpeededDuration(e) {
663
- return e / this.state.speed;
664
- }
665
- /**
666
- * @description Get ratate progress
667
- */
668
- getProgress() {
669
- return this.five.controller.cameraMotion.progress;
670
- }
671
- /**
672
- * @description Change five mode
673
- */
674
- changeMode(e, t) {
675
- return v(this, null, function* () {
676
- e.mode && e.mode !== this.five.currentMode && (this.privateState.modeChanging = !0, yield this.five.changeMode(e.mode, e, t), this.privateState.modeChanging = !1);
677
- });
678
- }
679
- /**
680
- * @description Force interupt five updateCamera
681
- */
682
- forceInteruptUpdateCamera() {
683
- this.five.updateCamera({}, 0);
684
- }
685
- getPauseData() {
686
- var e, t;
687
- if ((e = this.data) != null && e.keyframesId)
688
- return E.get((t = this.data) == null ? void 0 : t.keyframesId);
689
- }
690
- /**
691
- * @description Set pause data
692
- */
693
- setPauseData() {
694
- var e, t, r, i;
695
- if ((e = this.data) != null && e.keyframesId)
696
- return E.set((t = this.data) == null ? void 0 : t.keyframesId, {
697
- keyframeId: (r = this.privateState.currentPlayKeyframe) == null ? void 0 : r.keyframe.id,
698
- fiveState: this.five.getCurrentState(),
699
- duration: (i = this.privateState.currentPlayKeyframe) == null ? void 0 : i.originDuration,
700
- playedProgress: this.getProgress()
701
- });
702
- }
703
- /**
704
- * @description Clear pause data
705
- */
706
- clearPauseData() {
707
- var e, t;
708
- if ((e = this.data) != null && e.keyframesId)
709
- return E.delete((t = this.data) == null ? void 0 : t.keyframesId);
710
- }
711
- /**
712
- * @description: Restore state that before loaded
713
- */
714
- clear() {
715
- this.clearPauseData(), this.privateState.currentPlayKeyframe = null;
716
- }
717
- // TODO
718
- handleDispose() {
719
- var e, t;
720
- this.setState({ playing: !1 }), this.clearPauseData(), this.clear(), (e = this.GuideLine) == null || e.dispose(), this.GuideLine = void 0, (t = this.privateState.disposers) == null || t.forEach((r) => r == null ? void 0 : r());
721
- }
722
- /**
723
- * @description Action function if plugin is enable
724
- */
725
- actionIfStateIsEnabled(e, t) {
726
- if (this.state.enabled)
727
- return e();
728
- t != null && t.warnLog && W();
729
- }
730
- /**
731
- * @description: Wait for five work ready
732
- */
733
- waitFiveLoaded() {
734
- return v(this, null, function* () {
735
- return new Promise((e) => {
736
- if (this.five.work) {
737
- e();
738
- return;
739
- }
740
- this.five.once("loaded", () => {
741
- e();
742
- });
743
- });
744
- });
745
- }
746
- setFiveLinearUpdateCamera() {
747
- this.privateState.fiveOriginGetProgress && (this.five.controller.cameraMotion.getProgress = (e) => {
748
- const t = this.five.controller.cameraMotion, r = e - t.startTime;
749
- return r < 0 ? 0 : r >= t.duration ? 1 : 1 - H(1, t.startVelocity, t.duration, r);
750
- });
751
- }
752
- setFiveOriginUpdateCamera() {
753
- this.privateState.fiveOriginGetProgress && (this.five.controller.cameraMotion.getProgress = this.privateState.fiveOriginGetProgress);
754
- }
755
- }
756
- I(z, "PluginVersion", M);
757
- export {
758
- z as default,
759
- sr as pluginFlag
760
- };