@realsee/vreo 1.0.0-alpha.17 → 1.0.0-alpha.19
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 +6 -1
- package/docs/demo/assets/{AppReact.a3fc45d3.js → AppReact.20163f9a.js} +1 -1
- package/docs/demo/assets/default.5069891b.js +3988 -0
- package/docs/demo/assets/{dynamic.714b9eb8.js → dynamic.c8118cc9.js} +1 -1
- package/docs/demo/assets/{examples.1a6f5a2c.js → examples.5391fc1f.js} +1 -1
- package/docs/demo/assets/{index.0ca9e9d3.js → index.2272a9ef.js} +1 -1
- package/docs/demo/assets/main.b335b989.js +1 -0
- package/docs/demo/assets/{react.fca6a967.js → react.efea3f3f.js} +1 -1
- package/docs/demo/examples.html +2 -2
- package/docs/demo/index-react-dynamic.html +4 -4
- package/docs/demo/index-react.html +4 -4
- package/docs/demo/index.html +3 -3
- package/lib/PlayController/createHTMLAudioElement.js +11 -6
- package/lib/PlayController/index.js +81 -16
- package/lib/Player/App.js +24 -0
- package/lib/Player/Controller.d.ts +2 -2
- package/lib/Player/Controller.js +95 -19
- package/lib/Player/custom/SpatialScenePanel/index.js +68 -42
- package/lib/Player/hooks.js +10 -0
- package/lib/Player/index.js +85 -25
- package/lib/Player/modules/Drawer/index.js +17 -0
- package/lib/Player/modules/PopUp/index.js +10 -0
- package/lib/Player/modules/ResizeObserver/index.js +8 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +2 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +114 -20
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +24 -2
- package/lib/Player/modules/VideoAgent/index.js +17 -0
- package/lib/Player/modules/Wave/index.js +32 -7
- package/lib/Player/modules/keyframes/BgMusic/index.js +44 -14
- package/lib/Player/modules/keyframes/CameraMovement/index.js +27 -3
- package/lib/Player/modules/keyframes/InfoPanel/index.js +25 -8
- package/lib/Player/modules/keyframes/ModelVideo/index.js +29 -3
- package/lib/Player/modules/keyframes/PanoEffect/index.js +43 -15
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +7 -0
- package/lib/Player/modules/keyframes/PanoTag/index.js +21 -4
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +47 -22
- package/lib/Player/modules/keyframes/Prompter/index.js +32 -10
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +25 -18
- package/lib/Player/modules/keyframes/VideoEffect/index.js +47 -12
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +2 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +1 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +60 -19
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +5 -2
- package/lib/fivePlugins/CameraMovementPlugin/index.js +75 -28
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +4 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +60 -11
- package/lib/index.js +1 -0
- package/lib/react/index.js +34 -7
- package/lib/shared-utils/{AduioLike.d.ts → AudioLike.d.ts} +0 -0
- package/lib/shared-utils/{AduioLike.js → AudioLike.js} +43 -11
- package/lib/shared-utils/Preloader.js +7 -0
- package/lib/shared-utils/addResizeListener.js +5 -0
- package/lib/shared-utils/animationFrame/BetterTween.js +38 -2
- package/lib/shared-utils/animationFrame/index.js +10 -2
- package/lib/shared-utils/animationFrame/tween.js +15 -2
- package/lib/shared-utils/createTransMatrix.js +17 -2
- package/lib/shared-utils/getFileExpandedName.js +1 -0
- package/lib/shared-utils/getMediaInfo.js +9 -0
- package/lib/shared-utils/setElementDataset.js +2 -0
- package/lib/typings/VreoUnit.d.ts +5 -5
- package/lib/typings/VreoUnit.js +15 -0
- package/package.json +1 -1
- package/resources/PlayController/index.ts +1 -1
- package/resources/Player/Controller.ts +3 -3
- package/resources/Player/index.tsx +1 -1
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +2 -2
- package/resources/Player/modules/keyframes/BgMusic/index.tsx +23 -14
- package/resources/Player/modules/keyframes/PanoTag/index.tsx +1 -0
- package/resources/shared-utils/{AduioLike.ts → AudioLike.ts} +4 -6
- package/resources/typings/VreoUnit.ts +5 -5
- package/docs/demo/assets/default.9985006b.js +0 -3988
- package/docs/demo/assets/main.7963f418.js +0 -1
|
@@ -1,53 +1,77 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.PanoEffect = PanoEffect;
|
|
9
|
+
|
|
8
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _three = require("three");
|
|
13
|
+
|
|
10
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
11
16
|
var _lineAnime = _interopRequireDefault(require("./lineAnime"));
|
|
17
|
+
|
|
12
18
|
var _hooks = require("../../../hooks");
|
|
19
|
+
|
|
13
20
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
21
|
+
|
|
14
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
+
|
|
15
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
16
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
|
|
17
28
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
+
|
|
18
30
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
+
|
|
19
32
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
33
|
+
|
|
20
34
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
35
|
+
|
|
21
36
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
37
|
+
|
|
22
38
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
+
|
|
23
40
|
function PanoEffect() {
|
|
24
41
|
var _React$useState = React.useState(null),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
42
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
43
|
+
state = _React$useState2[0],
|
|
44
|
+
setState = _React$useState2[1];
|
|
45
|
+
|
|
28
46
|
var five = (0, _hooks.useFiveInstance)();
|
|
29
47
|
var lineRef = React.useRef(null);
|
|
48
|
+
|
|
30
49
|
var _React$useState3 = React.useState(null),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
50
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
51
|
+
pos = _React$useState4[0],
|
|
52
|
+
setPos = _React$useState4[1];
|
|
53
|
+
|
|
34
54
|
var timeoutRef = React.useRef();
|
|
35
55
|
var controller = (0, _hooks.useController)();
|
|
36
56
|
var project2d = (0, _hooks.useFiveProject2d)();
|
|
57
|
+
|
|
37
58
|
var delLine = function delLine() {
|
|
38
59
|
if (lineRef.current) {
|
|
39
60
|
lineRef.current.dispose();
|
|
40
61
|
}
|
|
41
62
|
};
|
|
63
|
+
|
|
42
64
|
React.useEffect(function () {
|
|
43
65
|
var callback = function callback(keyframe) {
|
|
44
66
|
var start = keyframe.start,
|
|
45
|
-
|
|
46
|
-
|
|
67
|
+
end = keyframe.end,
|
|
68
|
+
data = keyframe.data;
|
|
47
69
|
var videoEffectData = data;
|
|
70
|
+
|
|
48
71
|
var _videoEffectData$twoV = _slicedToArray(videoEffectData.twoVertexs, 2),
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
v1 = _videoEffectData$twoV[0],
|
|
73
|
+
v2 = _videoEffectData$twoV[1];
|
|
74
|
+
|
|
51
75
|
var p1 = new _three.Vector3(v1.x, v1.y, v1.z);
|
|
52
76
|
var p2 = new _three.Vector3(v2.x, v2.y, v2.z);
|
|
53
77
|
lineRef.current = (0, _lineAnime["default"])(five, p1.clone(), p2.clone());
|
|
@@ -57,7 +81,7 @@ function PanoEffect() {
|
|
|
57
81
|
var p = project2d(center);
|
|
58
82
|
if (!p) return;
|
|
59
83
|
var left = p.x,
|
|
60
|
-
|
|
84
|
+
top = p.y;
|
|
61
85
|
setState({
|
|
62
86
|
center: center,
|
|
63
87
|
distance: distance
|
|
@@ -72,12 +96,15 @@ function PanoEffect() {
|
|
|
72
96
|
delLine();
|
|
73
97
|
}, end - start);
|
|
74
98
|
};
|
|
99
|
+
|
|
75
100
|
controller.on(_VreoUnit.VreoKeyframeEnum.PanoEffect, callback);
|
|
76
101
|
return function () {
|
|
77
102
|
controller.off(_VreoUnit.VreoKeyframeEnum.PanoEffect, callback);
|
|
103
|
+
|
|
78
104
|
if (timeoutRef.current) {
|
|
79
105
|
clearTimeout(timeoutRef.current);
|
|
80
106
|
}
|
|
107
|
+
|
|
81
108
|
delLine();
|
|
82
109
|
};
|
|
83
110
|
}, [controller]);
|
|
@@ -85,18 +112,19 @@ function PanoEffect() {
|
|
|
85
112
|
var callback = function callback() {
|
|
86
113
|
if (!(state !== null && state !== void 0 && state.center)) return;
|
|
87
114
|
var _state$center = state.center,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
115
|
+
x = _state$center.x,
|
|
116
|
+
y = _state$center.y,
|
|
117
|
+
z = _state$center.z;
|
|
91
118
|
var res = project2d(new _three.Vector3(x, y, z));
|
|
92
119
|
if (!res) return;
|
|
93
120
|
var left = res.x,
|
|
94
|
-
|
|
121
|
+
top = res.y;
|
|
95
122
|
setPos({
|
|
96
123
|
left: left,
|
|
97
124
|
top: top
|
|
98
125
|
});
|
|
99
126
|
};
|
|
127
|
+
|
|
100
128
|
five.on('currentStateChange', callback);
|
|
101
129
|
return function () {
|
|
102
130
|
five.off('currentStateChange', callback);
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports["default"] = lineAnime;
|
|
9
|
+
|
|
8
10
|
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
+
|
|
9
12
|
var _line = require("@realsee/five/line");
|
|
13
|
+
|
|
10
14
|
var _BetterTween = require("../../../../shared-utils/animationFrame/BetterTween");
|
|
15
|
+
|
|
11
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
12
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
13
20
|
function lineAnime(five, startPoint, endPoint) {
|
|
14
21
|
var pointImage = 'data:image/png;base64,' + 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg==';
|
|
15
22
|
var pointTexture = new THREE.TextureLoader().load(pointImage);
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.PanoTag = PanoTag;
|
|
9
|
+
|
|
8
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _hooks = require("../../../hooks");
|
|
13
|
+
|
|
10
14
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
15
|
+
|
|
11
16
|
var _dnalogel = require("@realsee/dnalogel");
|
|
17
|
+
|
|
12
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
13
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
14
22
|
function PanoTag() {
|
|
15
23
|
var timeoutRef = React.useRef();
|
|
16
24
|
var controller = (0, _hooks.useController)();
|
|
@@ -34,19 +42,22 @@ function PanoTag() {
|
|
|
34
42
|
}));
|
|
35
43
|
React.useEffect(function () {
|
|
36
44
|
var _controller$configs;
|
|
45
|
+
|
|
37
46
|
if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.PanoTag) === false) {
|
|
38
47
|
return;
|
|
39
48
|
}
|
|
49
|
+
|
|
40
50
|
var callback = function callback(keyframe) {
|
|
41
51
|
if (!panoTagPlugin.current) return;
|
|
42
52
|
var start = keyframe.start,
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
end = keyframe.end,
|
|
54
|
+
data = keyframe.data;
|
|
45
55
|
var panoTagData = data;
|
|
46
56
|
var id = Date.now().toString();
|
|
47
57
|
var pointType = _dnalogel.PointType.PointTag;
|
|
48
58
|
var dimensionType = _dnalogel.DimensionType.Two;
|
|
49
59
|
var position = [panoTagData.vertex.x, panoTagData.vertex.y, panoTagData.vertex.z];
|
|
60
|
+
|
|
50
61
|
var tag = function () {
|
|
51
62
|
if (panoTagData.imgUrl) {
|
|
52
63
|
return {
|
|
@@ -75,20 +86,24 @@ function PanoTag() {
|
|
|
75
86
|
}
|
|
76
87
|
};
|
|
77
88
|
}
|
|
78
|
-
}();
|
|
89
|
+
}(); // show
|
|
90
|
+
|
|
79
91
|
|
|
80
|
-
// show
|
|
81
92
|
panoTagPlugin.current.load({
|
|
82
93
|
tagList: [tag]
|
|
83
94
|
});
|
|
84
95
|
timeoutRef.current = setTimeout(function () {
|
|
85
96
|
var _tag$hooks;
|
|
97
|
+
|
|
86
98
|
// clear
|
|
87
99
|
var tag = panoTagPlugin.current.getTagById(id);
|
|
100
|
+
if (!tag) return;
|
|
101
|
+
|
|
88
102
|
if (tag.state) {
|
|
89
103
|
tag.state.unfolded = false;
|
|
90
104
|
panoTagPlugin.current.updateRenderAllTags();
|
|
91
105
|
}
|
|
106
|
+
|
|
92
107
|
(_tag$hooks = tag.hooks) === null || _tag$hooks === void 0 ? void 0 : _tag$hooks.on('folded', function () {
|
|
93
108
|
setTimeout(function () {
|
|
94
109
|
if (tag.state) {
|
|
@@ -99,9 +114,11 @@ function PanoTag() {
|
|
|
99
114
|
});
|
|
100
115
|
}, end - start);
|
|
101
116
|
};
|
|
117
|
+
|
|
102
118
|
controller.on(_VreoUnit.VreoKeyframeEnum.PanoTag, callback);
|
|
103
119
|
return function () {
|
|
104
120
|
controller.off(_VreoUnit.VreoKeyframeEnum.PanoTag, callback);
|
|
121
|
+
|
|
105
122
|
if (timeoutRef.current) {
|
|
106
123
|
clearTimeout(timeoutRef.current);
|
|
107
124
|
}
|
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.PanoTextLabel = PanoTextLabel;
|
|
9
|
+
|
|
8
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var THREE = _interopRequireWildcard(require("three"));
|
|
13
|
+
|
|
10
14
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
15
|
+
|
|
11
16
|
var _hooks = require("../../../hooks");
|
|
17
|
+
|
|
12
18
|
var _CSS3DRenderPlugin = require("../../../../fivePlugins/CSS3DRenderPlugin");
|
|
19
|
+
|
|
13
20
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
21
|
+
|
|
14
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
+
|
|
15
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
16
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
|
|
17
28
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
+
|
|
18
30
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
+
|
|
19
32
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
33
|
+
|
|
20
34
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
35
|
+
|
|
21
36
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
37
|
+
|
|
22
38
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
+
|
|
23
40
|
/**
|
|
24
41
|
* 通过传入中心点确定矩形框架容器的四个点:
|
|
25
42
|
* 1. 已知矩形长宽和中心点
|
|
@@ -31,11 +48,11 @@ var calcPoints = function calcPoints(centerPoint, normal, wrapperLength, wrapper
|
|
|
31
48
|
var length = wrapperLength / 375;
|
|
32
49
|
var width = wrapperWidth / 375;
|
|
33
50
|
var geometry = new THREE.PlaneGeometry(length, width);
|
|
51
|
+
|
|
34
52
|
if (normal) {
|
|
35
53
|
var lookPoint = new THREE.Vector3(normal.x + centerPoint.x, normal.y + centerPoint.y, normal.z + centerPoint.z);
|
|
36
54
|
geometry.lookAt(lookPoint);
|
|
37
|
-
}
|
|
38
|
-
// const pointgeometry = new THREE.Geometry()
|
|
55
|
+
} // const pointgeometry = new THREE.Geometry()
|
|
39
56
|
// pointgeometry.vertices.push(cameraPosition)
|
|
40
57
|
// const pointmaterial = new THREE.PointsMaterial({
|
|
41
58
|
// color: 0xffffff,
|
|
@@ -43,32 +60,33 @@ var calcPoints = function calcPoints(centerPoint, normal, wrapperLength, wrapper
|
|
|
43
60
|
// })
|
|
44
61
|
// _point = new THREE.Points(pointgeometry, pointmaterial)
|
|
45
62
|
|
|
63
|
+
|
|
46
64
|
var material = new THREE.MeshBasicMaterial({
|
|
47
65
|
color: 0xffff00,
|
|
48
66
|
side: THREE.DoubleSide
|
|
49
67
|
});
|
|
50
68
|
var plane = new THREE.Mesh(geometry, material);
|
|
51
69
|
var v0 = centerPoint.clone();
|
|
52
|
-
plane.position.copy(v0);
|
|
70
|
+
plane.position.copy(v0); // 计算传入的四个点的坐标
|
|
53
71
|
|
|
54
|
-
// 计算传入的四个点的坐标
|
|
55
72
|
var _plane$geometry$verti = _slicedToArray(plane.geometry.vertices, 4),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
v1 = _plane$geometry$verti[0],
|
|
74
|
+
v2 = _plane$geometry$verti[1],
|
|
75
|
+
v3 = _plane$geometry$verti[2],
|
|
76
|
+
v4 = _plane$geometry$verti[3];
|
|
77
|
+
|
|
60
78
|
var downLeft = v0.clone().add(v4);
|
|
61
79
|
var downRight = v0.clone().add(v3);
|
|
62
80
|
var upLeft = v0.clone().add(v2);
|
|
63
|
-
var upRight = v0.clone().add(v1);
|
|
81
|
+
var upRight = v0.clone().add(v1); // 插件使用要求:矩形四个点位数据,顺序为**必须**为左下、右下、右上、左上
|
|
64
82
|
|
|
65
|
-
// 插件使用要求:矩形四个点位数据,顺序为**必须**为左下、右下、右上、左上
|
|
66
83
|
return [downLeft, downRight, upRight, upLeft];
|
|
67
84
|
};
|
|
68
|
-
|
|
69
85
|
/**
|
|
70
86
|
* 空间文本标签。
|
|
71
87
|
*/
|
|
88
|
+
|
|
89
|
+
|
|
72
90
|
function PanoTextLabel() {
|
|
73
91
|
var timeoutRef = React.useRef();
|
|
74
92
|
var controller = (0, _hooks.useController)();
|
|
@@ -76,35 +94,39 @@ function PanoTextLabel() {
|
|
|
76
94
|
var ref = React.useRef();
|
|
77
95
|
React.useEffect(function () {
|
|
78
96
|
var _controller$configs;
|
|
97
|
+
|
|
79
98
|
if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.PanoTextLabel) === false) {
|
|
80
99
|
return;
|
|
81
100
|
}
|
|
101
|
+
|
|
82
102
|
var callback = function callback(keyframe) {
|
|
83
103
|
var _panoTextLabelData$no, _panoTextLabelData$no2, _panoTextLabelData$no3;
|
|
104
|
+
|
|
84
105
|
var start = keyframe.start,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var panoTextLabelData = data;
|
|
88
|
-
|
|
106
|
+
end = keyframe.end,
|
|
107
|
+
data = keyframe.data;
|
|
108
|
+
var panoTextLabelData = data; // 增加无文本情况的判断
|
|
109
|
+
|
|
89
110
|
if (data.text === '') return;
|
|
90
111
|
var _panoTextLabelData$ve = panoTextLabelData.vertex,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
112
|
+
x = _panoTextLabelData$ve.x,
|
|
113
|
+
y = _panoTextLabelData$ve.y,
|
|
114
|
+
z = _panoTextLabelData$ve.z;
|
|
94
115
|
var centerPoint = new THREE.Vector3(x, y, z);
|
|
95
|
-
var normal = new THREE.Vector3((_panoTextLabelData$no = panoTextLabelData.normal) === null || _panoTextLabelData$no === void 0 ? void 0 : _panoTextLabelData$no.x, (_panoTextLabelData$no2 = panoTextLabelData.normal) === null || _panoTextLabelData$no2 === void 0 ? void 0 : _panoTextLabelData$no2.y, (_panoTextLabelData$no3 = panoTextLabelData.normal) === null || _panoTextLabelData$no3 === void 0 ? void 0 : _panoTextLabelData$no3.z);
|
|
96
|
-
|
|
116
|
+
var normal = new THREE.Vector3((_panoTextLabelData$no = panoTextLabelData.normal) === null || _panoTextLabelData$no === void 0 ? void 0 : _panoTextLabelData$no.x, (_panoTextLabelData$no2 = panoTextLabelData.normal) === null || _panoTextLabelData$no2 === void 0 ? void 0 : _panoTextLabelData$no2.y, (_panoTextLabelData$no3 = panoTextLabelData.normal) === null || _panoTextLabelData$no3 === void 0 ? void 0 : _panoTextLabelData$no3.z); // 生成传入的四个点,将文本框最大宽度定在200px,最高高度在30px
|
|
117
|
+
|
|
97
118
|
var wrapperLength = 200;
|
|
98
119
|
var wrapperWidth = 30;
|
|
99
120
|
var points = calcPoints(centerPoint, panoTextLabelData.normal && normal, wrapperLength, wrapperWidth);
|
|
100
121
|
if (!ref.current) ref.current = (0, _CSS3DRenderPlugin.CSS3DRenderPlugin)(five);
|
|
101
122
|
var container = ref.current.create3DDomContainer(points);
|
|
102
|
-
var css3DObject = container === null || container === void 0 ? void 0 : container.css3DObject;
|
|
103
|
-
|
|
123
|
+
var css3DObject = container === null || container === void 0 ? void 0 : container.css3DObject; // 将获取的mesh进行旋转操作,根据欧拉角去进行mesh的变换
|
|
124
|
+
|
|
104
125
|
if (data.quaternion) {
|
|
105
126
|
var quaternion = new THREE.Quaternion(data.quaternion.x, data.quaternion.y, data.quaternion.z, data.quaternion.w);
|
|
106
127
|
css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.quaternion.copy(quaternion);
|
|
107
128
|
}
|
|
129
|
+
|
|
108
130
|
if (container !== null && container !== void 0 && container.container) _reactDom["default"].render( /*#__PURE__*/React.createElement("div", {
|
|
109
131
|
className: "PanoTextLabel PanoTextLabel--notHidden"
|
|
110
132
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -117,12 +139,15 @@ function PanoTextLabel() {
|
|
|
117
139
|
}, data.text || ''))), container === null || container === void 0 ? void 0 : container.container);
|
|
118
140
|
timeoutRef.current = setTimeout(function () {
|
|
119
141
|
var _ref$current;
|
|
142
|
+
|
|
120
143
|
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.disposeAll();
|
|
121
144
|
}, end - start);
|
|
122
145
|
};
|
|
146
|
+
|
|
123
147
|
controller.on(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
|
|
124
148
|
return function () {
|
|
125
149
|
controller.off(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
|
|
150
|
+
|
|
126
151
|
if (timeoutRef.current) {
|
|
127
152
|
clearTimeout(timeoutRef.current);
|
|
128
153
|
}
|
|
@@ -1,59 +1,81 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.Prompter = Prompter;
|
|
9
|
+
|
|
8
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
10
14
|
var _hooks = require("../../../hooks");
|
|
15
|
+
|
|
11
16
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
17
|
+
|
|
12
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
13
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
14
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
15
24
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
+
|
|
16
26
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
17
28
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
29
|
+
|
|
18
30
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
+
|
|
19
32
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
33
|
+
|
|
20
34
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
35
|
+
|
|
21
36
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
+
|
|
22
38
|
function Prompter() {
|
|
23
39
|
var _React$useState = React.useState(''),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
40
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
41
|
+
text = _React$useState2[0],
|
|
42
|
+
setText = _React$useState2[1];
|
|
43
|
+
|
|
27
44
|
var _React$useState3 = React.useState(true),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
45
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
46
|
+
hidden = _React$useState4[0],
|
|
47
|
+
setHidden = _React$useState4[1];
|
|
48
|
+
|
|
31
49
|
var ref = React.useRef(null);
|
|
32
50
|
var controller = (0, _hooks.useController)();
|
|
33
51
|
React.useEffect(function () {
|
|
34
52
|
var _controller$configs;
|
|
53
|
+
|
|
35
54
|
if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.Prompter) === false) {
|
|
36
55
|
return;
|
|
37
56
|
}
|
|
57
|
+
|
|
38
58
|
var callback = function callback(keyframe) {
|
|
39
59
|
var start = keyframe.start,
|
|
40
|
-
|
|
41
|
-
|
|
60
|
+
end = keyframe.end,
|
|
61
|
+
data = keyframe.data;
|
|
42
62
|
setText(data.text);
|
|
43
63
|
setHidden(false);
|
|
64
|
+
|
|
44
65
|
if (ref.current) {
|
|
45
66
|
clearTimeout(ref.current);
|
|
46
67
|
ref.current = null;
|
|
47
68
|
}
|
|
69
|
+
|
|
48
70
|
ref.current = setTimeout(function () {
|
|
49
71
|
setHidden(true);
|
|
50
|
-
setText('');
|
|
51
|
-
// setTimeout(() => setText(''), 500)
|
|
72
|
+
setText(''); // setTimeout(() => setText(''), 500)
|
|
52
73
|
|
|
53
74
|
if (ref.current) clearTimeout(ref.current);
|
|
54
75
|
ref.current = null;
|
|
55
76
|
}, end - start);
|
|
56
77
|
};
|
|
78
|
+
|
|
57
79
|
controller.on(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
|
|
58
80
|
return function () {
|
|
59
81
|
controller.off(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
|
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.UpdateVRPanorama = UpdateVRPanorama;
|
|
9
|
+
|
|
8
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _five = require("@realsee/five");
|
|
13
|
+
|
|
10
14
|
var _hooks = require("../../../hooks");
|
|
15
|
+
|
|
11
16
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
17
|
+
|
|
12
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
13
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
14
22
|
function UpdateVRPanorama() {
|
|
15
23
|
var controller = (0, _hooks.useController)();
|
|
16
24
|
var five = (0, _hooks.useFiveInstance)();
|
|
17
25
|
var deafultWorkRef = React.useRef(null);
|
|
18
|
-
var updateWorkRef = React.useRef(null);
|
|
26
|
+
var updateWorkRef = React.useRef(null); // 恢复默认 VR
|
|
19
27
|
|
|
20
|
-
// 恢复默认 VR
|
|
21
28
|
var restoreCallback = React.useCallback(function () {
|
|
22
29
|
// 先清理掉 之前的 VR 数据备份
|
|
23
30
|
updateWorkRef.current = null;
|
|
31
|
+
|
|
24
32
|
if (deafultWorkRef.current) {
|
|
25
33
|
var work = (0, _five.parseWork)(deafultWorkRef.current);
|
|
26
34
|
five.load(work);
|
|
27
35
|
}
|
|
28
|
-
}, []);
|
|
36
|
+
}, []); // 暂停时: 恢复默认 VR
|
|
29
37
|
|
|
30
|
-
// 暂停时: 恢复默认 VR
|
|
31
38
|
var pausedCallback = React.useCallback(function () {
|
|
32
39
|
if (deafultWorkRef.current) {
|
|
33
40
|
var work = (0, _five.parseWork)(deafultWorkRef.current);
|
|
@@ -36,32 +43,33 @@ function UpdateVRPanorama() {
|
|
|
36
43
|
});
|
|
37
44
|
five.load(work);
|
|
38
45
|
}
|
|
39
|
-
}, []);
|
|
46
|
+
}, []); // 播放时:如果暂停前有更新 VR 需要还原
|
|
40
47
|
|
|
41
|
-
// 播放时:如果暂停前有更新 VR 需要还原
|
|
42
48
|
var playingCallback = React.useCallback(function () {
|
|
43
49
|
if (!updateWorkRef.current) {
|
|
44
50
|
return;
|
|
45
51
|
}
|
|
52
|
+
|
|
46
53
|
five.load(updateWorkRef.current);
|
|
47
54
|
}, []);
|
|
48
55
|
React.useEffect(function () {
|
|
49
56
|
var callback = function callback(keyframe) {
|
|
50
57
|
var _five$work;
|
|
58
|
+
|
|
51
59
|
if (!deafultWorkRef.current) {
|
|
52
60
|
deafultWorkRef.current = five.work.raw.works;
|
|
53
61
|
}
|
|
54
|
-
var data = keyframe.data;
|
|
55
62
|
|
|
56
|
-
// 如果数据中有新 work 数据,则直接载入
|
|
63
|
+
var data = keyframe.data; // 如果数据中有新 work 数据,则直接载入
|
|
64
|
+
|
|
57
65
|
if (data.work) {
|
|
58
66
|
updateWorkRef.current = (0, _five.parseWork)(data.work);
|
|
59
67
|
five.load(updateWorkRef.current);
|
|
60
68
|
return;
|
|
61
69
|
}
|
|
62
|
-
var lastRawWork = (_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.works[0];
|
|
63
70
|
|
|
64
|
-
// 动态场景:不提供完成的签名数据,需重新整理
|
|
71
|
+
var lastRawWork = (_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.works[0]; // 动态场景:不提供完成的签名数据,需重新整理
|
|
72
|
+
|
|
65
73
|
if (data.dynamic_scene && !data.panorama) {
|
|
66
74
|
var lastWork = JSON.parse(lastRawWork);
|
|
67
75
|
var panorama = lastWork.panorama;
|
|
@@ -70,6 +78,7 @@ function UpdateVRPanorama() {
|
|
|
70
78
|
data.panorama = panorama;
|
|
71
79
|
delete data.dynamic_scene;
|
|
72
80
|
}
|
|
81
|
+
|
|
73
82
|
Object.assign(window, {
|
|
74
83
|
$work1: JSON.parse(lastRawWork),
|
|
75
84
|
$work2: data,
|
|
@@ -78,17 +87,15 @@ function UpdateVRPanorama() {
|
|
|
78
87
|
updateWorkRef.current = (0, _five.parseWork)([lastRawWork, data]);
|
|
79
88
|
five.load(updateWorkRef.current);
|
|
80
89
|
};
|
|
81
|
-
controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback);
|
|
82
90
|
|
|
83
|
-
// 离开 将之前的内容清空
|
|
84
|
-
|
|
91
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback); // 离开 将之前的内容清空
|
|
92
|
+
|
|
93
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback); // 新载入数据 将之前的内容清空
|
|
94
|
+
|
|
95
|
+
controller.on('loaded', restoreCallback); // 暂停 回到默认状态
|
|
85
96
|
|
|
86
|
-
//
|
|
87
|
-
controller.on('loaded', restoreCallback);
|
|
97
|
+
controller.on('paused', pausedCallback); // 播放 回归暂停前状态
|
|
88
98
|
|
|
89
|
-
// 暂停 回到默认状态
|
|
90
|
-
controller.on('paused', pausedCallback);
|
|
91
|
-
// 播放 回归暂停前状态
|
|
92
99
|
controller.on('playing', playingCallback);
|
|
93
100
|
return function () {
|
|
94
101
|
// 清理事件监听
|