@realsee/dnalogel 3.11.0 → 3.12.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.
- package/dist/CruisePlugin/BaseController.d.ts +5 -0
- package/dist/CruisePlugin/Work.d.ts +1 -5
- package/dist/GuideLinePlugin/Controller.d.ts +4 -0
- package/dist/PanoTagPlugin/controller/TagUtil.d.ts +2 -3
- package/dist/PanoTagPlugin/controller/index.d.ts +1 -0
- package/dist/PanoTagPlugin/utils/DebugUtil.d.ts +6 -0
- package/dist/base/BasePlugin.d.ts +1 -1
- package/dist/index.cjs.js +52 -52
- package/dist/index.js +3178 -3067
- package/dist/index.umd.js +44 -44
- package/dist/shared-utils/Utils/BaseUtil.d.ts +5 -0
- package/dist/shared-utils/Utils/FiveUtil.d.ts +10 -0
- package/dist/shared-utils/Utils/WorkUtil.d.ts +33 -0
- package/libs/CruisePlugin/BaseController.d.ts +5 -0
- package/libs/CruisePlugin/BaseController.js +66 -54
- package/libs/CruisePlugin/Move.js +29 -25
- package/libs/CruisePlugin/Work.d.ts +1 -5
- package/libs/CruisePlugin/Work.js +133 -129
- package/libs/CruisePlugin/index.js +10 -6
- package/libs/GuideLinePlugin/Controller.d.ts +4 -0
- package/libs/GuideLinePlugin/Controller.js +41 -30
- package/libs/GuideLinePlugin/GuideLineItem.js +6 -2
- package/libs/GuideLinePlugin/GuideLineModeItem/index.js +61 -61
- package/libs/GuideLinePlugin/GuideLineModeItem.js +5 -2
- package/libs/GuideLinePlugin/index.js +12 -8
- package/libs/PanoTagPlugin/controller/TagComputer.js +24 -22
- package/libs/PanoTagPlugin/controller/TagRender.js +4 -2
- package/libs/PanoTagPlugin/controller/TagUtil.d.ts +2 -3
- package/libs/PanoTagPlugin/controller/TagUtil.js +92 -100
- package/libs/PanoTagPlugin/controller/index.d.ts +1 -0
- package/libs/PanoTagPlugin/controller/index.js +32 -26
- package/libs/PanoTagPlugin/index.js +14 -11
- package/libs/PanoTagPlugin/utils/DebugUtil.d.ts +6 -0
- package/libs/PanoTagPlugin/utils/DebugUtil.js +25 -0
- package/libs/base/BasePlugin.d.ts +1 -1
- package/libs/base/BasePlugin.js +2 -2
- package/libs/index.js +125 -121
- package/libs/shared-utils/Utils/BaseUtil.d.ts +5 -0
- package/libs/shared-utils/Utils/BaseUtil.js +12 -0
- package/libs/shared-utils/Utils/FiveUtil.d.ts +10 -0
- package/libs/shared-utils/Utils/FiveUtil.js +27 -0
- package/libs/shared-utils/Utils/WorkUtil.d.ts +33 -0
- package/libs/shared-utils/Utils/WorkUtil.js +68 -0
- package/libs/shared-utils/logger.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Five } from '@realsee/five';
|
|
2
|
+
import { BaseUtil } from './BaseUtil';
|
|
3
|
+
import { WorkUtil } from './WorkUtil';
|
|
4
|
+
export declare class FiveUtil extends BaseUtil {
|
|
5
|
+
workUtil: WorkUtil;
|
|
6
|
+
get version(): string;
|
|
7
|
+
get majorVersion(): number;
|
|
8
|
+
constructor(five: Five);
|
|
9
|
+
moveToPano(panoNumber: number, movePanoOptions: Parameters<Five['moveToPano']>[1]): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Five } from '@realsee/five';
|
|
2
|
+
import { BaseUtil } from './BaseUtil';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
export declare class WorkUtil extends BaseUtil {
|
|
5
|
+
private _workCode;
|
|
6
|
+
/**
|
|
7
|
+
* @description: 设置插件当前的 workCode
|
|
8
|
+
*/
|
|
9
|
+
set workCode(workCode: string);
|
|
10
|
+
/**
|
|
11
|
+
* @description: 获取插件当前的 workCode
|
|
12
|
+
*/
|
|
13
|
+
get workCode(): string;
|
|
14
|
+
/**
|
|
15
|
+
* @description: 获取当前的 work
|
|
16
|
+
*/
|
|
17
|
+
get work(): import("@realsee/five").Work;
|
|
18
|
+
get observers(): import("@realsee/five").WorkObserver[];
|
|
19
|
+
get transform(): THREE.Matrix4;
|
|
20
|
+
constructor(five: Five);
|
|
21
|
+
/**
|
|
22
|
+
* @description: 获取全景点坐标
|
|
23
|
+
*/
|
|
24
|
+
getObserverPosition(observerIndex: number): THREE.Vector3 | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* @description: 获取全景点位和模型的地面坐标
|
|
27
|
+
*/
|
|
28
|
+
getObserverStandingPosition(observerIndex: number): THREE.Vector3 | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* @description: 获取observer
|
|
31
|
+
*/
|
|
32
|
+
getObserver(observerIndex: number): import("@realsee/five").WorkObserver;
|
|
33
|
+
}
|
|
@@ -4,9 +4,14 @@ import type { GuideLinePluginExportType } from '../GuideLinePlugin';
|
|
|
4
4
|
import * as BasePlugin from '../base/BasePlugin';
|
|
5
5
|
import type { PluginState, EventMap, MoveEffect } from './typing';
|
|
6
6
|
import type { PartialDeep } from 'type-fest';
|
|
7
|
+
import { FiveUtil } from '../shared-utils/Utils/FiveUtil';
|
|
7
8
|
export declare const pluginFlag: (name: string) => string;
|
|
8
9
|
export default abstract class CruiseController<PluginData, Config = unknown> extends BasePlugin.Controller<PluginState, EventMap> {
|
|
9
10
|
state: PluginState;
|
|
11
|
+
set workCode(workCode: string);
|
|
12
|
+
get workCode(): string;
|
|
13
|
+
protected fiveUtil: FiveUtil;
|
|
14
|
+
protected workUtil: import("../shared-utils/Utils/WorkUtil").WorkUtil;
|
|
10
15
|
protected data?: PluginData & {
|
|
11
16
|
id: string | number;
|
|
12
17
|
};
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
var c = Object.defineProperty;
|
|
2
2
|
var f = Object.getOwnPropertySymbols;
|
|
3
3
|
var v = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable;
|
|
4
|
-
var
|
|
4
|
+
var p = (a, s, e) => s in a ? c(a, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[s] = e, g = (a, s) => {
|
|
5
5
|
for (var e in s || (s = {}))
|
|
6
|
-
v.call(s, e) &&
|
|
6
|
+
v.call(s, e) && p(a, e, s[e]);
|
|
7
7
|
if (f)
|
|
8
8
|
for (var e of f(s))
|
|
9
|
-
S.call(s, e) &&
|
|
9
|
+
S.call(s, e) && p(a, e, s[e]);
|
|
10
10
|
return a;
|
|
11
11
|
};
|
|
12
|
-
var d = (a, s, e) => (
|
|
13
|
-
var
|
|
14
|
-
var r = (
|
|
12
|
+
var d = (a, s, e) => (p(a, typeof s != "symbol" ? s + "" : s, e), e);
|
|
13
|
+
var u = (a, s, e) => new Promise((i, t) => {
|
|
14
|
+
var r = (l) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
|
|
16
|
+
o(e.next(l));
|
|
17
|
+
} catch (n) {
|
|
18
|
+
t(n);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, b = (l) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
|
|
22
|
+
o(e.throw(l));
|
|
23
|
+
} catch (n) {
|
|
24
|
+
t(n);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, o = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(r, b);
|
|
27
|
+
o((e = e.apply(a, s)).next());
|
|
28
28
|
});
|
|
29
|
-
import { Controller as
|
|
30
|
-
import { equal as
|
|
31
|
-
import { objectAssignDeepExports as
|
|
29
|
+
import { Controller as w } from "../base/BasePlugin.js";
|
|
30
|
+
import { equal as C } from "../shared-utils/equal.js";
|
|
31
|
+
import { objectAssignDeepExports as y } from "../vendor/object-assign-deep/objectAssignDeep.js";
|
|
32
|
+
import { FiveUtil as L } from "../shared-utils/Utils/FiveUtil.js";
|
|
32
33
|
import "../shared-utils/Subscribe.js";
|
|
33
34
|
import "hammerjs";
|
|
34
35
|
import "three";
|
|
@@ -51,10 +52,13 @@ import "../CSS3DRenderPlugin/utils/three/CSS3DGroup.js";
|
|
|
51
52
|
import "../CSS3DRenderPlugin/utils/generateBehindFiveElement.js";
|
|
52
53
|
import "../shared-utils/url/absoluteUrl.js";
|
|
53
54
|
import "../shared-utils/isTruelyObject.js";
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
import "../shared-utils/Utils/BaseUtil.js";
|
|
56
|
+
import "../shared-utils/Utils/WorkUtil.js";
|
|
57
|
+
import "../shared-utils/five/transformPosition.js";
|
|
58
|
+
const m = "CruisePlugin", h = `${m}`, ee = (a) => `${h}--${a}`;
|
|
59
|
+
class ie extends w {
|
|
60
|
+
constructor(e, i) {
|
|
61
|
+
super(e, i);
|
|
58
62
|
d(this, "state", {
|
|
59
63
|
visible: !0,
|
|
60
64
|
enabled: !0,
|
|
@@ -62,6 +66,8 @@ class T extends y {
|
|
|
62
66
|
playing: !1,
|
|
63
67
|
speed: 1
|
|
64
68
|
});
|
|
69
|
+
d(this, "fiveUtil", new L(this.five));
|
|
70
|
+
d(this, "workUtil", this.fiveUtil.workUtil);
|
|
65
71
|
d(this, "data");
|
|
66
72
|
d(this, "config");
|
|
67
73
|
d(this, "pauseDataMap", /* @__PURE__ */ new Map());
|
|
@@ -72,15 +78,21 @@ class T extends y {
|
|
|
72
78
|
});
|
|
73
79
|
d(this, "GuideLine");
|
|
74
80
|
d(this, "disposedErrorLog", () => {
|
|
75
|
-
console.error(`${
|
|
81
|
+
console.error(`${h} is disposed`);
|
|
76
82
|
});
|
|
77
83
|
d(this, "disableWarnLog", () => {
|
|
78
|
-
console.warn(`${
|
|
84
|
+
console.warn(`${h} is disabled`);
|
|
79
85
|
});
|
|
80
86
|
d(this, "disableErrorLog", () => {
|
|
81
|
-
console.error(`${
|
|
87
|
+
console.error(`${h} is disabled`);
|
|
82
88
|
});
|
|
83
|
-
this.config =
|
|
89
|
+
this.config = i, Object.assign(window, { [`__${m}_DEBUG__`]: this });
|
|
90
|
+
}
|
|
91
|
+
set workCode(e) {
|
|
92
|
+
this.fiveUtil.workUtil.workCode = e;
|
|
93
|
+
}
|
|
94
|
+
get workCode() {
|
|
95
|
+
return this.fiveUtil.workUtil.workCode;
|
|
84
96
|
}
|
|
85
97
|
/**
|
|
86
98
|
* @description Play | Continue play. if have been paused, continue play from the pause position; if playing, do nothing
|
|
@@ -98,7 +110,7 @@ class T extends y {
|
|
|
98
110
|
* @description Show guide line
|
|
99
111
|
*/
|
|
100
112
|
show(e) {
|
|
101
|
-
return
|
|
113
|
+
return u(this, null, function* () {
|
|
102
114
|
this.setState({ visible: !0 }, e);
|
|
103
115
|
});
|
|
104
116
|
}
|
|
@@ -106,7 +118,7 @@ class T extends y {
|
|
|
106
118
|
* @description Hide guide line
|
|
107
119
|
*/
|
|
108
120
|
hide(e) {
|
|
109
|
-
return
|
|
121
|
+
return u(this, null, function* () {
|
|
110
122
|
this.setState({ visible: !1 }, e);
|
|
111
123
|
});
|
|
112
124
|
}
|
|
@@ -131,50 +143,50 @@ class T extends y {
|
|
|
131
143
|
/**
|
|
132
144
|
* @description Set state
|
|
133
145
|
*/
|
|
134
|
-
setState(e,
|
|
146
|
+
setState(e, i) {
|
|
135
147
|
var r;
|
|
136
148
|
if (this.state.disposed)
|
|
137
149
|
return this.disposedErrorLog();
|
|
138
150
|
if (!this.state.enabled && e.enabled !== !0 && e.disposed !== !0)
|
|
139
151
|
return this.disableErrorLog();
|
|
140
|
-
const
|
|
141
|
-
this.state =
|
|
152
|
+
const t = g({}, this.state);
|
|
153
|
+
this.state = y({}, this.state, e), e.disposed !== void 0 && e.disposed !== t.disposed && e.disposed && this.handleDispose(), e.visible !== void 0 && e.visible !== t.visible && this.handleVisible(e.visible, i == null ? void 0 : i.userAction), e.enabled !== void 0 && e.enabled !== t.enabled && this.handleEnable(e.enabled, i == null ? void 0 : i.userAction), e.playing !== void 0 && e.playing !== t.playing && this.changePlayState(e.playing, i), e.speed !== void 0 && e.speed !== t.speed && this.changeSpeed(e.speed), C(t, this.state, { deep: !0 }) || this.hooks.emit("stateChange", { state: this.state, prevState: t, userAction: (r = i == null ? void 0 : i.userAction) != null ? r : !0 });
|
|
142
154
|
}
|
|
143
155
|
/**
|
|
144
156
|
* @description Clear pause data
|
|
145
157
|
*/
|
|
146
158
|
clearPauseData() {
|
|
147
|
-
var e,
|
|
159
|
+
var e, i;
|
|
148
160
|
if ((e = this.data) != null && e.id)
|
|
149
|
-
return this.pauseDataMap.delete((
|
|
161
|
+
return this.pauseDataMap.delete((i = this.data) == null ? void 0 : i.id);
|
|
150
162
|
}
|
|
151
|
-
changePlayState(e,
|
|
163
|
+
changePlayState(e, i) {
|
|
152
164
|
this.actionIfStateIsEnabled(
|
|
153
165
|
() => {
|
|
154
|
-
var
|
|
155
|
-
return this.hooks.emit("playStateChange", e ? "playing" : "pause", { userAction: (
|
|
166
|
+
var t;
|
|
167
|
+
return this.hooks.emit("playStateChange", e ? "playing" : "pause", { userAction: (t = i == null ? void 0 : i.userAction) != null ? t : !0 });
|
|
156
168
|
}
|
|
157
|
-
), e ? this.handlePlay(
|
|
169
|
+
), e ? this.handlePlay(i) : this.handlePause(i), this.state.playing = e;
|
|
158
170
|
}
|
|
159
|
-
handleEnable(e,
|
|
160
|
-
var
|
|
161
|
-
e ? ((
|
|
171
|
+
handleEnable(e, i = !0) {
|
|
172
|
+
var t, r;
|
|
173
|
+
e ? ((t = this.GuideLine) == null || t.enable(), this.hooks.emit("enable", { userAction: i })) : ((r = this.GuideLine) == null || r.disable(), this.changePlayState(!1, { userAction: i }), this.hooks.emit("disable", { userAction: i })), this.state.enabled = e;
|
|
162
174
|
}
|
|
163
|
-
handleVisible(e,
|
|
164
|
-
var
|
|
165
|
-
e ? ((
|
|
175
|
+
handleVisible(e, i = !0) {
|
|
176
|
+
var t, r;
|
|
177
|
+
e ? ((t = this.GuideLine) == null || t.show(), this.actionIfStateIsEnabled(() => this.hooks.emit("show", { userAction: i }))) : ((r = this.GuideLine) == null || r.hide(), this.actionIfStateIsEnabled(() => this.hooks.emit("hide", { userAction: i }))), this.state.visible = e;
|
|
166
178
|
}
|
|
167
179
|
/**
|
|
168
180
|
* @description: listen interupted by five gesture
|
|
169
181
|
*/
|
|
170
182
|
addInterruptListener(e) {
|
|
171
|
-
const
|
|
183
|
+
const i = () => {
|
|
172
184
|
this.privateState.modeChanging || e();
|
|
173
|
-
},
|
|
174
|
-
r !== "mouseMove" && (e(), this.five.off("gesture",
|
|
185
|
+
}, t = (r) => {
|
|
186
|
+
r !== "mouseMove" && (e(), this.five.off("gesture", t));
|
|
175
187
|
};
|
|
176
|
-
return this.five.on("gesture",
|
|
177
|
-
this.five.off("gesture",
|
|
188
|
+
return this.five.on("gesture", t), this.five.once("wantsChangeMode", i), () => {
|
|
189
|
+
this.five.off("gesture", t), this.five.off("wantsChangeMode", i);
|
|
178
190
|
};
|
|
179
191
|
}
|
|
180
192
|
/**
|
|
@@ -198,8 +210,8 @@ class T extends y {
|
|
|
198
210
|
* @description Set pause data
|
|
199
211
|
*/
|
|
200
212
|
setPauseData() {
|
|
201
|
-
var
|
|
202
|
-
const e = (
|
|
213
|
+
var i;
|
|
214
|
+
const e = (i = this.data) == null ? void 0 : i.id;
|
|
203
215
|
if (e)
|
|
204
216
|
return this.pauseDataMap.set(e, {
|
|
205
217
|
fiveState: this.five.getCurrentState(),
|
|
@@ -220,13 +232,13 @@ class T extends y {
|
|
|
220
232
|
/**
|
|
221
233
|
* @description Action function if plugin is enable
|
|
222
234
|
*/
|
|
223
|
-
actionIfStateIsEnabled(e,
|
|
235
|
+
actionIfStateIsEnabled(e, i) {
|
|
224
236
|
if (this.state.enabled)
|
|
225
237
|
return e();
|
|
226
|
-
|
|
238
|
+
i != null && i.warnLog && this.disableWarnLog();
|
|
227
239
|
}
|
|
228
240
|
}
|
|
229
241
|
export {
|
|
230
|
-
|
|
231
|
-
|
|
242
|
+
ie as default,
|
|
243
|
+
ee as pluginFlag
|
|
232
244
|
};
|
|
@@ -2,30 +2,30 @@ var C = Object.defineProperty, P = Object.defineProperties;
|
|
|
2
2
|
var b = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var y = Object.getOwnPropertySymbols;
|
|
4
4
|
var k = Object.prototype.hasOwnProperty, O = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var u = (r,
|
|
6
|
-
for (var
|
|
7
|
-
k.call(
|
|
5
|
+
var u = (r, e, t) => e in r ? C(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, d = (r, e) => {
|
|
6
|
+
for (var t in e || (e = {}))
|
|
7
|
+
k.call(e, t) && u(r, t, e[t]);
|
|
8
8
|
if (y)
|
|
9
|
-
for (var
|
|
10
|
-
O.call(
|
|
9
|
+
for (var t of y(e))
|
|
10
|
+
O.call(e, t) && u(r, t, e[t]);
|
|
11
11
|
return r;
|
|
12
|
-
}, c = (r,
|
|
13
|
-
var f = (r,
|
|
14
|
-
var S = (r,
|
|
12
|
+
}, c = (r, e) => P(r, b(e));
|
|
13
|
+
var f = (r, e, t) => (u(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
14
|
+
var S = (r, e, t) => new Promise((s, h) => {
|
|
15
15
|
var o = (i) => {
|
|
16
16
|
try {
|
|
17
|
-
n(
|
|
17
|
+
n(t.next(i));
|
|
18
18
|
} catch (a) {
|
|
19
19
|
h(a);
|
|
20
20
|
}
|
|
21
21
|
}, p = (i) => {
|
|
22
22
|
try {
|
|
23
|
-
n(
|
|
23
|
+
n(t.throw(i));
|
|
24
24
|
} catch (a) {
|
|
25
25
|
h(a);
|
|
26
26
|
}
|
|
27
27
|
}, n = (i) => i.done ? s(i.value) : Promise.resolve(i.value).then(o, p);
|
|
28
|
-
n((
|
|
28
|
+
n((t = t.apply(r, e)).next());
|
|
29
29
|
});
|
|
30
30
|
import w from "./BaseController.js";
|
|
31
31
|
import { objectAssignDeepExports as l } from "../vendor/object-assign-deep/objectAssignDeep.js";
|
|
@@ -42,6 +42,10 @@ import "../shared-utils/Subscribe.js";
|
|
|
42
42
|
import "../shared-utils/url/absoluteUrl.js";
|
|
43
43
|
import "../shared-utils/equal.js";
|
|
44
44
|
import "../shared-utils/isTruelyObject.js";
|
|
45
|
+
import "../shared-utils/Utils/FiveUtil.js";
|
|
46
|
+
import "../shared-utils/Utils/BaseUtil.js";
|
|
47
|
+
import "../shared-utils/Utils/WorkUtil.js";
|
|
48
|
+
import "../shared-utils/five/transformPosition.js";
|
|
45
49
|
import "../shared-utils/positionToVector3.js";
|
|
46
50
|
import "../CSS3DRenderPlugin/utils/three/CSS3DRenderer.js";
|
|
47
51
|
import "three/examples/jsm/renderers/CSS3DRenderer";
|
|
@@ -57,17 +61,17 @@ import "../CSS3DRenderPlugin/utils/three/CSS3DScene.js";
|
|
|
57
61
|
import "../CSS3DRenderPlugin/utils/three/CSS3DGroup.js";
|
|
58
62
|
import "../shared-utils/vectorToCoordinate.js";
|
|
59
63
|
import "../shared-utils/formatRad.js";
|
|
60
|
-
class
|
|
61
|
-
constructor(
|
|
64
|
+
class nt extends w {
|
|
65
|
+
constructor(t, s) {
|
|
62
66
|
var p;
|
|
63
|
-
super(
|
|
67
|
+
super(t, s);
|
|
64
68
|
f(this, "curve");
|
|
65
69
|
f(this, "baseCurveOffset");
|
|
66
70
|
f(this, "curveOffset");
|
|
67
71
|
f(this, "playStartedTime", performance.now());
|
|
68
72
|
f(this, "duration");
|
|
69
|
-
f(this, "changeSpeed", (
|
|
70
|
-
this.state.speed =
|
|
73
|
+
f(this, "changeSpeed", (t, s = !0) => {
|
|
74
|
+
this.state.speed = t, this.hooks.emit("speedChange", t, { userAction: s });
|
|
71
75
|
});
|
|
72
76
|
f(this, "moveToStart", () => {
|
|
73
77
|
this.five.setState(c(d({}, g(this.curve, 0, this.curveOffset)), { mode: "Model" }));
|
|
@@ -78,8 +82,8 @@ class re extends w {
|
|
|
78
82
|
f(this, "getDuration", () => this.getSpeededDuration(this.duration));
|
|
79
83
|
f(this, "getProgress", () => {
|
|
80
84
|
var i;
|
|
81
|
-
const
|
|
82
|
-
let s = (i =
|
|
85
|
+
const t = this.getPauseData();
|
|
86
|
+
let s = (i = t == null ? void 0 : t.playedProgress) != null ? i : 0;
|
|
83
87
|
(s < 0 || s >= 1) && (s = 0);
|
|
84
88
|
const h = 1 - s, o = this.getDuration(), n = (performance.now() - this.playStartedTime) / o;
|
|
85
89
|
return 1 - h + n;
|
|
@@ -96,9 +100,9 @@ class re extends w {
|
|
|
96
100
|
};
|
|
97
101
|
this.state = l({}, h, this.state), this.config = l({}, o, this.config), this.baseCurveOffset = l({ x: 0, y: 0, z: 0 }, { y: 2 }, (p = this.config) == null ? void 0 : p.offset);
|
|
98
102
|
}
|
|
99
|
-
load(
|
|
103
|
+
load(t, s) {
|
|
100
104
|
var p, n, i, a, m, v;
|
|
101
|
-
if (this.handlePause(), this.clear(), this.data = d({ id: x() },
|
|
105
|
+
if (this.handlePause(), this.clear(), this.data = d({ id: x() }, t), this.curve = this.data.path.curves[0], this.curveOffset = {
|
|
102
106
|
x: this.baseCurveOffset.x + ((n = (p = this.data.offset) == null ? void 0 : p.x) != null ? n : 0),
|
|
103
107
|
y: this.baseCurveOffset.y + ((a = (i = this.data.offset) == null ? void 0 : i.y) != null ? a : 0),
|
|
104
108
|
z: this.baseCurveOffset.z + ((v = (m = this.data.offset) == null ? void 0 : m.z) != null ? v : 0)
|
|
@@ -108,7 +112,7 @@ class re extends w {
|
|
|
108
112
|
return this.duration = h / (this.state.config.speedConfig.moveSpeed / o), s ? this.setState(s) : (this.setState({ playing: !1 }), this.handleVisible(this.state.visible), this.handleEnable(this.state.enabled), this.changePlayState(this.state.playing), this.changeSpeed(this.state.speed)), Promise.resolve();
|
|
109
113
|
}
|
|
110
114
|
handlePlay() {
|
|
111
|
-
return new Promise((
|
|
115
|
+
return new Promise((t, s) => S(this, null, function* () {
|
|
112
116
|
var i;
|
|
113
117
|
this.hooks.emit("play", { userAction: !0 });
|
|
114
118
|
const h = this.getPauseData();
|
|
@@ -123,7 +127,7 @@ class re extends w {
|
|
|
123
127
|
const n = () => {
|
|
124
128
|
const a = this.getProgress();
|
|
125
129
|
if (a >= 1)
|
|
126
|
-
this.five.off("renderFrame", n), this.setState({ playing: !1 }, { userAction: !1 }), this.hooks.emit("end"), this.hooks.emit("progressChange", 1),
|
|
130
|
+
this.five.off("renderFrame", n), this.setState({ playing: !1 }, { userAction: !1 }), this.hooks.emit("end"), this.hooks.emit("progressChange", 1), t("end");
|
|
127
131
|
else if (this.state.playing === !1)
|
|
128
132
|
this.five.off("renderFrame", n);
|
|
129
133
|
else if (a >= 0) {
|
|
@@ -134,11 +138,11 @@ class re extends w {
|
|
|
134
138
|
this.five.on("renderFrame", n);
|
|
135
139
|
}));
|
|
136
140
|
}
|
|
137
|
-
handlePause(
|
|
141
|
+
handlePause(t) {
|
|
138
142
|
var s;
|
|
139
|
-
this.state.playing = !1, this.hooks.emit("pause", { userAction: (s =
|
|
143
|
+
this.state.playing = !1, this.hooks.emit("pause", { userAction: (s = t == null ? void 0 : t.userAction) != null ? s : !0 }), this.setPauseData();
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
146
|
export {
|
|
143
|
-
|
|
147
|
+
nt as default
|
|
144
148
|
};
|
|
@@ -78,11 +78,7 @@ export default class WalkController extends CruiseController<PluginData, Config>
|
|
|
78
78
|
protected setPauseData(): Map<string | number, {
|
|
79
79
|
fiveState: Partial<State>;
|
|
80
80
|
id?: string | number;
|
|
81
|
-
playedProgress: number;
|
|
82
|
-
* privateState.playing 和 state.playing 的区别:
|
|
83
|
-
* state.playing 先为true,然后才 handleplay,handleplay方法内会检查privateState.playing,如果已经开始(privateState.playing === true),就不执行操作,如果为false,就执行操作
|
|
84
|
-
* 其实就是加了一个不允许重复执行handleplay的逻辑
|
|
85
|
-
*/
|
|
81
|
+
playedProgress: number;
|
|
86
82
|
duration?: number;
|
|
87
83
|
}>;
|
|
88
84
|
/**
|