@realsee/vreo 2.6.4-alpha.5 → 2.6.5
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 +7 -0
- package/LICENSE +119 -21
- package/LICENSE-UPDATE.txt +5 -0
- package/lib/PlayController/createHTMLAudioElement.js +14 -10
- package/lib/PlayController/index.js +73 -63
- package/lib/Player/Controller.js +56 -50
- package/lib/Player/PlaybackLifecycle.js +7 -6
- package/lib/Player/custom/SpatialScenePanel/index.js +11 -34
- package/lib/Player/index.js +166 -160
- package/lib/Player/modules/Drawer/index.js +2 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +157 -146
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +1 -1
- package/lib/Player/modules/VideoAgent/index.js +3 -3
- package/lib/Player/modules/keyframes/BgMusic/index.js +12 -12
- package/lib/Player/modules/keyframes/CameraMovement/index.js +45 -43
- package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -8
- package/lib/Player/modules/keyframes/ModelVideo/index.js +83 -81
- package/lib/Player/modules/keyframes/PanoTag/index.js +1 -1
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +3 -3
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +3 -3
- package/lib/Player/modules/keyframes/VideoEffect/index.js +71 -69
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +6 -6
- package/lib/fivePlugins/CameraMovementPlugin/index.js +180 -173
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -6
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +59 -57
- package/lib/react/index.js +1 -1
- package/lib/shared-utils/Audio.js +56 -52
- package/lib/shared-utils/AudioLike.js +14 -11
- package/lib/shared-utils/animationFrame/BetterTween.js +15 -13
- package/lib/shared-utils/animationFrame/tween.js +3 -1
- package/lib/shared-utils/getMediaInfo.js +1 -0
- package/lib/typings/VreoUnit.js +27 -134
- package/package.json +4 -4
package/lib/Player/Controller.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
function ownKeys(
|
|
9
|
-
function _objectSpread(
|
|
10
|
-
function
|
|
11
|
-
function _isNativeReflectConstruct() {
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
13
|
import { PlaybackLifecycle } from "./PlaybackLifecycle.js";
|
|
13
14
|
import { Subscribe } from '@realsee/five';
|
|
14
15
|
import { action, makeObservable, observable, reaction } from 'mobx';
|
|
@@ -42,49 +43,39 @@ import { getMediaType } from "../shared-utils/getMediaInfo.js";
|
|
|
42
43
|
* ```
|
|
43
44
|
*/
|
|
44
45
|
export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
46
|
+
_inherits(Controller, _Subscribe);
|
|
47
|
+
var _super = _createSuper(Controller);
|
|
45
48
|
function Controller(_ref) {
|
|
46
49
|
var _this;
|
|
47
50
|
var five = _ref.five,
|
|
48
51
|
container = _ref.container,
|
|
49
52
|
configs = _ref.configs;
|
|
50
53
|
_classCallCheck(this, Controller);
|
|
51
|
-
_this =
|
|
52
|
-
_defineProperty(_this, "playing", false);
|
|
53
|
-
_defineProperty(_this, "ended", false);
|
|
54
|
-
_defineProperty(_this, "loading", false);
|
|
55
|
-
|
|
56
|
-
_defineProperty(_this, "containerSize", {
|
|
54
|
+
_this = _super.call(this);
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "playing", false);
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "ended", false);
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "loading", false);
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "containerSize", {
|
|
57
59
|
width: 0,
|
|
58
60
|
height: 0
|
|
59
61
|
});
|
|
60
|
-
_defineProperty(_this, "waveAppearance", null);
|
|
61
|
-
_defineProperty(_this, "appearance", {
|
|
62
|
+
_defineProperty(_assertThisInitialized(_this), "waveAppearance", null);
|
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "appearance", {
|
|
62
64
|
waveStyle: 'wave'
|
|
63
65
|
});
|
|
64
|
-
_defineProperty(_this, "avatar", {});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
_defineProperty(_this, "
|
|
70
|
-
_defineProperty(_this, "
|
|
71
|
-
_defineProperty(_this, "popUp", null);
|
|
72
|
-
_defineProperty(_this, "drawerConfig", null);
|
|
73
|
-
/**
|
|
74
|
-
* 创建 Controller 实例
|
|
75
|
-
* @param params - 构造参数对象
|
|
76
|
-
* @param params.five - Five 渲染引擎实例
|
|
77
|
-
* @param params.container - DOM 容器元素
|
|
78
|
-
* @param params.configs - 播放器配置
|
|
79
|
-
*/
|
|
80
|
-
_defineProperty(_this, "resumeGeneration", 0);
|
|
81
|
-
_defineProperty(_this, "disposers", []);
|
|
66
|
+
_defineProperty(_assertThisInitialized(_this), "avatar", {});
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "waitingForBgMusic", false);
|
|
68
|
+
_defineProperty(_assertThisInitialized(_this), "visible", false);
|
|
69
|
+
_defineProperty(_assertThisInitialized(_this), "popUp", null);
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "drawerConfig", null);
|
|
71
|
+
_defineProperty(_assertThisInitialized(_this), "resumeGeneration", 0);
|
|
72
|
+
_defineProperty(_assertThisInitialized(_this), "disposers", []);
|
|
82
73
|
_this.playback = new PlaybackLifecycle(configs.mediaManager, function () {
|
|
83
74
|
var _this$videoAgentScene;
|
|
84
75
|
_this.resuming = undefined;
|
|
85
76
|
++_this.resumeGeneration;
|
|
86
77
|
_this.setPlaying(false);
|
|
87
|
-
(_this$videoAgentScene = _this.videoAgentScene) === null || _this$videoAgentScene === void 0
|
|
78
|
+
(_this$videoAgentScene = _this.videoAgentScene) === null || _this$videoAgentScene === void 0 ? void 0 : _this$videoAgentScene.videoAgentMesh.stop();
|
|
88
79
|
_this.setWaitingForBgMusic(false);
|
|
89
80
|
});
|
|
90
81
|
_this.configs = configs;
|
|
@@ -92,7 +83,7 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
92
83
|
_this.five = five;
|
|
93
84
|
_this.appSize = configs.appSize;
|
|
94
85
|
_this.appearance = _objectSpread(_objectSpread({}, _this.appearance), configs.appearance);
|
|
95
|
-
makeObservable(_this, {
|
|
86
|
+
makeObservable(_assertThisInitialized(_this), {
|
|
96
87
|
visible: observable,
|
|
97
88
|
setVisible: action,
|
|
98
89
|
playing: observable,
|
|
@@ -203,10 +194,16 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
203
194
|
* 获取播放器是否准备就绪
|
|
204
195
|
* @returns 是否有可用的视频代理场景
|
|
205
196
|
*/
|
|
206
|
-
|
|
207
|
-
return _createClass(Controller, [{
|
|
197
|
+
_createClass(Controller, [{
|
|
208
198
|
key: "agentType",
|
|
209
199
|
get:
|
|
200
|
+
// null 表示加载失败
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 是否正在等待背景音乐加载
|
|
204
|
+
* 当此状态为 true 时,播放流程会暂停,等待音频加载完成
|
|
205
|
+
*/
|
|
206
|
+
|
|
210
207
|
/**
|
|
211
208
|
* 获取当前播放媒体的类型
|
|
212
209
|
* @returns 'video' | 'avatar' | 'none' - 媒体类型
|
|
@@ -336,6 +333,14 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
336
333
|
}
|
|
337
334
|
this.drawerConfig = drawerConfig;
|
|
338
335
|
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* 创建 Controller 实例
|
|
339
|
+
* @param params - 构造参数对象
|
|
340
|
+
* @param params.five - Five 渲染引擎实例
|
|
341
|
+
* @param params.container - DOM 容器元素
|
|
342
|
+
* @param params.configs - 播放器配置
|
|
343
|
+
*/
|
|
339
344
|
}, {
|
|
340
345
|
key: "ready",
|
|
341
346
|
get: function get() {
|
|
@@ -403,19 +408,19 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
403
408
|
if (this.waitingForBgMusic) {
|
|
404
409
|
var _this$mediaInstance;
|
|
405
410
|
if (!((_this$mediaInstance = this.mediaInstance) !== null && _this$mediaInstance !== void 0 && _this$mediaInstance.paused)) {
|
|
406
|
-
var _this$videoAgentScene5;
|
|
407
|
-
(_this$videoAgentScene5 = this.videoAgentScene) === null || _this$videoAgentScene5 === void 0
|
|
411
|
+
var _this$videoAgentScene5, _this$videoAgentScene6;
|
|
412
|
+
(_this$videoAgentScene5 = this.videoAgentScene) === null || _this$videoAgentScene5 === void 0 ? void 0 : (_this$videoAgentScene6 = _this$videoAgentScene5.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene6 === void 0 ? void 0 : _this$videoAgentScene6.pause();
|
|
408
413
|
}
|
|
409
414
|
return;
|
|
410
415
|
}
|
|
411
416
|
if ((_this$mediaInstance2 = this.mediaInstance) !== null && _this$mediaInstance2 !== void 0 && _this$mediaInstance2.ended && this.mediaInstance.currentTime !== 0) {
|
|
412
|
-
var _this$vreoUnit, _this$
|
|
417
|
+
var _this$vreoUnit, _this$videoAgentScene7;
|
|
413
418
|
if (this.ended) return;
|
|
414
|
-
(_this$vreoUnit = this.vreoUnit) === null || _this$vreoUnit === void 0
|
|
419
|
+
(_this$vreoUnit = this.vreoUnit) === null || _this$vreoUnit === void 0 ? void 0 : _this$vreoUnit.keyframes.forEach(function (keyframe) {
|
|
415
420
|
return keyframe.parsed = false;
|
|
416
421
|
});
|
|
417
|
-
var media = (_this$
|
|
418
|
-
media === null || media === void 0
|
|
422
|
+
var media = (_this$videoAgentScene7 = this.videoAgentScene) === null || _this$videoAgentScene7 === void 0 ? void 0 : _this$videoAgentScene7.videoAgentMesh.mediaOperations;
|
|
423
|
+
media === null || media === void 0 ? void 0 : media.pause();
|
|
419
424
|
if (media) media.currentTime = 0;
|
|
420
425
|
this.playback.finish();
|
|
421
426
|
this.setEnded(true);
|
|
@@ -425,8 +430,8 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
425
430
|
if (!this.playing) {
|
|
426
431
|
var _this$mediaInstance3;
|
|
427
432
|
if (!((_this$mediaInstance3 = this.mediaInstance) !== null && _this$mediaInstance3 !== void 0 && _this$mediaInstance3.paused)) {
|
|
428
|
-
var _this$
|
|
429
|
-
(_this$
|
|
433
|
+
var _this$videoAgentScene8, _this$videoAgentScene9;
|
|
434
|
+
(_this$videoAgentScene8 = this.videoAgentScene) === null || _this$videoAgentScene8 === void 0 ? void 0 : (_this$videoAgentScene9 = _this$videoAgentScene8.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene9 === void 0 ? void 0 : _this$videoAgentScene9.pause();
|
|
430
435
|
}
|
|
431
436
|
return;
|
|
432
437
|
}
|
|
@@ -449,14 +454,14 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
449
454
|
_this4 = this;
|
|
450
455
|
if (this.waitingForBgMusic) return;
|
|
451
456
|
if ((_this$mediaInstance4 = this.mediaInstance) !== null && _this$mediaInstance4 !== void 0 && _this$mediaInstance4.paused && this.playing && !this.resuming) {
|
|
452
|
-
var _this$
|
|
457
|
+
var _this$videoAgentScene10;
|
|
453
458
|
var attempt = ++this.resumeGeneration;
|
|
454
459
|
this.resuming = attempt;
|
|
455
460
|
var run = this.playback.capture();
|
|
456
461
|
var valid = function valid() {
|
|
457
462
|
return !!(run !== null && run !== void 0 && run.valid());
|
|
458
463
|
};
|
|
459
|
-
void ((_this$
|
|
464
|
+
void ((_this$videoAgentScene10 = this.videoAgentScene) === null || _this$videoAgentScene10 === void 0 ? void 0 : _this$videoAgentScene10.videoAgentMesh.play().catch(function (error) {
|
|
460
465
|
if (valid()) {
|
|
461
466
|
_this4.playback.cancel();
|
|
462
467
|
console.error(error);
|
|
@@ -493,7 +498,7 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
493
498
|
value: function clear() {
|
|
494
499
|
var _this$vreoUnit2, _this$stopInterval;
|
|
495
500
|
this.setPlaying(false);
|
|
496
|
-
(_this$vreoUnit2 = this.vreoUnit) === null || _this$vreoUnit2 === void 0
|
|
501
|
+
(_this$vreoUnit2 = this.vreoUnit) === null || _this$vreoUnit2 === void 0 ? void 0 : _this$vreoUnit2.keyframes.forEach(function (keyframe) {
|
|
497
502
|
return keyframe.parsed = false;
|
|
498
503
|
});
|
|
499
504
|
|
|
@@ -502,11 +507,11 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
502
507
|
*/
|
|
503
508
|
this.vreoUnit = undefined;
|
|
504
509
|
if (this.mediaInstance) {
|
|
505
|
-
var _this$
|
|
506
|
-
(_this$
|
|
507
|
-
if ((_this$
|
|
510
|
+
var _this$videoAgentScene11, _this$videoAgentScene12, _this$videoAgentScene13;
|
|
511
|
+
(_this$videoAgentScene11 = this.videoAgentScene) === null || _this$videoAgentScene11 === void 0 ? void 0 : (_this$videoAgentScene12 = _this$videoAgentScene11.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene12 === void 0 ? void 0 : _this$videoAgentScene12.pause();
|
|
512
|
+
if ((_this$videoAgentScene13 = this.videoAgentScene) !== null && _this$videoAgentScene13 !== void 0 && _this$videoAgentScene13.videoAgentMesh.mediaOperations) this.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = 0;
|
|
508
513
|
}
|
|
509
|
-
(_this$stopInterval = this.stopInterval) === null || _this$stopInterval === void 0
|
|
514
|
+
(_this$stopInterval = this.stopInterval) === null || _this$stopInterval === void 0 ? void 0 : _this$stopInterval.call(this);
|
|
510
515
|
this.stopInterval = undefined;
|
|
511
516
|
}
|
|
512
517
|
|
|
@@ -525,6 +530,7 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
525
530
|
this.clear();
|
|
526
531
|
}
|
|
527
532
|
}]);
|
|
533
|
+
return Controller;
|
|
528
534
|
}(Subscribe);
|
|
529
535
|
var ControllerContext = /*#__PURE__*/React.createContext(null);
|
|
530
536
|
export { ControllerContext };
|
|
@@ -18,7 +18,7 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
_createClass(PlaybackLifecycle, [{
|
|
22
22
|
key: "active",
|
|
23
23
|
get: function get() {
|
|
24
24
|
var _this$run;
|
|
@@ -77,9 +77,9 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
|
|
|
77
77
|
errors.push(error);
|
|
78
78
|
}
|
|
79
79
|
for (var _i = 0, _arr = _toConsumableArray(this.members); _i < _arr.length; _i++) {
|
|
80
|
-
var
|
|
80
|
+
var stop = _arr[_i];
|
|
81
81
|
try {
|
|
82
|
-
|
|
82
|
+
stop();
|
|
83
83
|
} catch (error) {
|
|
84
84
|
errors.push(error);
|
|
85
85
|
}
|
|
@@ -91,7 +91,7 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
|
|
|
91
91
|
value: function cancel() {
|
|
92
92
|
var _this$controller2;
|
|
93
93
|
var generation = this.generation;
|
|
94
|
-
(_this$controller2 = this.controller) === null || _this$controller2 === void 0
|
|
94
|
+
(_this$controller2 = this.controller) === null || _this$controller2 === void 0 ? void 0 : _this$controller2.cancel();
|
|
95
95
|
if (generation === this.generation) this.stop();
|
|
96
96
|
}
|
|
97
97
|
}, {
|
|
@@ -100,7 +100,7 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
|
|
|
100
100
|
var _this$run2;
|
|
101
101
|
var session = (_this$run2 = this.run) === null || _this$run2 === void 0 ? void 0 : _this$run2.session;
|
|
102
102
|
this.stop();
|
|
103
|
-
session === null || session === void 0
|
|
103
|
+
session === null || session === void 0 ? void 0 : session.finish();
|
|
104
104
|
}
|
|
105
105
|
}, {
|
|
106
106
|
key: "dispose",
|
|
@@ -109,9 +109,10 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
|
|
|
109
109
|
if (this.disposed) return;
|
|
110
110
|
this.disposed = true;
|
|
111
111
|
var generation = this.generation;
|
|
112
|
-
(_this$controller3 = this.controller) === null || _this$controller3 === void 0
|
|
112
|
+
(_this$controller3 = this.controller) === null || _this$controller3 === void 0 ? void 0 : _this$controller3.dispose();
|
|
113
113
|
if (generation === this.generation) this.stop();
|
|
114
114
|
this.members.clear();
|
|
115
115
|
}
|
|
116
116
|
}]);
|
|
117
|
+
return PlaybackLifecycle;
|
|
117
118
|
}();
|
|
@@ -4,30 +4,7 @@ import { createRoot } from 'react-dom/client';
|
|
|
4
4
|
import { Raycaster, Vector3 } from 'three';
|
|
5
5
|
import { tweenProgress } from "../../../shared-utils/animationFrame/BetterTween.js";
|
|
6
6
|
import { CSS3DRenderPlugin } from "../../../fivePlugins/CSS3DRenderPlugin/index.js";
|
|
7
|
-
import { VreoKeyframeEnum } from "../../../typings/VreoUnit.js";
|
|
8
|
-
// const mockData: SpatialScenePanelData = {
|
|
9
|
-
// customType: 'SpatialScenePanel',
|
|
10
|
-
// "stateList": [
|
|
11
|
-
// {
|
|
12
|
-
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___fc42f951076607a22fd5c54f005ba553.png",
|
|
13
|
-
// "text": "窗帘关闭"
|
|
14
|
-
// },
|
|
15
|
-
// {
|
|
16
|
-
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___b331e7ad732debc07250a169a3393b13.png",
|
|
17
|
-
// "text": "摄像头休眠"
|
|
18
|
-
// },
|
|
19
|
-
// {
|
|
20
|
-
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___2e425a81ac0ad88232d50d4e52a9abfa.png",
|
|
21
|
-
// "text": "氛围音乐"
|
|
22
|
-
// },
|
|
23
|
-
// {
|
|
24
|
-
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___bff48bb81cde37aa6a319d6f5d56e3a4.png",
|
|
25
|
-
// "text": "空调打开"
|
|
26
|
-
// }
|
|
27
|
-
// ],
|
|
28
|
-
// "temperature": "27",
|
|
29
|
-
// "title": "沉浸式回家"
|
|
30
|
-
// }
|
|
7
|
+
import { VreoKeyframeEnum } from "../../../typings/VreoUnit.js";
|
|
31
8
|
// const getSphere = (position: Vector3, color = 0xffff00) => {
|
|
32
9
|
// const geometry = new SphereGeometry(0.05, 32, 16)
|
|
33
10
|
// const material = new MeshBasicMaterial({ color })
|
|
@@ -118,7 +95,7 @@ export function SpatialScenePanel(props) {
|
|
|
118
95
|
});
|
|
119
96
|
if (!container) return;
|
|
120
97
|
var root = createRoot(container);
|
|
121
|
-
root.render(/*#__PURE__*/React.createElement(Panel, {
|
|
98
|
+
root.render( /*#__PURE__*/React.createElement(Panel, {
|
|
122
99
|
ref: function ref(_ref3) {
|
|
123
100
|
return panelRef.current = _ref3;
|
|
124
101
|
},
|
|
@@ -130,15 +107,15 @@ export function SpatialScenePanel(props) {
|
|
|
130
107
|
var progress = _ref4.progress;
|
|
131
108
|
var needRotateY = Math.PI / 90 * 11 * progress;
|
|
132
109
|
var rotateY = needRotateY - lastRotateY;
|
|
133
|
-
css3DObject === null || css3DObject === void 0
|
|
110
|
+
css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(rotateY);
|
|
134
111
|
// css3DObject?.rotateZ
|
|
135
112
|
lastRotateY = needRotateY;
|
|
136
113
|
}).onStart(function () {
|
|
137
|
-
css3DObject === null || css3DObject === void 0
|
|
114
|
+
css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(startRotateY);
|
|
138
115
|
render();
|
|
139
116
|
}).onDispose(function () {
|
|
140
117
|
var _panelRef$current;
|
|
141
|
-
(_panelRef$current = panelRef.current) === null || _panelRef$current === void 0
|
|
118
|
+
(_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.classList.add('show');
|
|
142
119
|
}).play();
|
|
143
120
|
|
|
144
121
|
// Object.assign(window, { $dispose: () => {
|
|
@@ -150,9 +127,9 @@ export function SpatialScenePanel(props) {
|
|
|
150
127
|
end = keyframe.end;
|
|
151
128
|
timeoutRef.current = setTimeout(function () {
|
|
152
129
|
var _panelRef$current2;
|
|
153
|
-
(_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0
|
|
130
|
+
(_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0 ? void 0 : _panelRef$current2.classList.add('hide');
|
|
154
131
|
timeoutRef.current = setTimeout(function () {
|
|
155
|
-
dispose === null || dispose === void 0
|
|
132
|
+
dispose === null || dispose === void 0 ? void 0 : dispose();
|
|
156
133
|
timeoutRef.current = null;
|
|
157
134
|
}, 1500);
|
|
158
135
|
}, end - start);
|
|
@@ -184,10 +161,10 @@ function SpatialScenePanelBg() {
|
|
|
184
161
|
if (!ref.current) return;
|
|
185
162
|
var listener = function listener() {
|
|
186
163
|
var _ref$current;
|
|
187
|
-
(_ref$current = ref.current) === null || _ref$current === void 0
|
|
164
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.setAttribute('class', 'SpatialScenePanel-bg');
|
|
188
165
|
timeoutRef.current = setTimeout(function () {
|
|
189
166
|
var _ref$current2;
|
|
190
|
-
(_ref$current2 = ref.current) === null || _ref$current2 === void 0
|
|
167
|
+
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.setAttribute('class', 'SpatialScenePanel-bg SpatialScenePanel-bg--animation');
|
|
191
168
|
timeoutRef.current = null;
|
|
192
169
|
}, 3000);
|
|
193
170
|
};
|
|
@@ -203,7 +180,7 @@ function SpatialScenePanelBg() {
|
|
|
203
180
|
});
|
|
204
181
|
}
|
|
205
182
|
var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
|
|
206
|
-
var _props$data, _props$data2, _props$data3;
|
|
183
|
+
var _props$data, _props$data2, _props$data3, _props$data3$stateLis;
|
|
207
184
|
return /*#__PURE__*/React.createElement("div", {
|
|
208
185
|
className: "SpatialScenePanel",
|
|
209
186
|
ref: myRef
|
|
@@ -217,7 +194,7 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
|
|
|
217
194
|
className: "SpatialScenePanel-temperature"
|
|
218
195
|
}, (_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.temperature, "\u2103")), /*#__PURE__*/React.createElement("div", {
|
|
219
196
|
className: "SpatialScenePanel-body"
|
|
220
|
-
}, (_props$data3 = props.data) === null || _props$data3 === void 0
|
|
197
|
+
}, (_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : (_props$data3$stateLis = _props$data3.stateList) === null || _props$data3$stateLis === void 0 ? void 0 : _props$data3$stateLis.map(function (state, index) {
|
|
221
198
|
return /*#__PURE__*/React.createElement("div", {
|
|
222
199
|
key: "scene-".concat(state.text),
|
|
223
200
|
className: "SpatialScenePanel-item index_".concat(index)
|