@realsee/vreo 1.0.0-alpha.5 → 1.0.0-alpha.7

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 (48) hide show
  1. package/lib/PlayController/createHTMLAudioElement.js +6 -11
  2. package/lib/PlayController/index.js +15 -80
  3. package/lib/Player/App.js +0 -24
  4. package/lib/Player/Controller.js +17 -93
  5. package/lib/Player/custom/SpatialScenePanel/index.js +42 -68
  6. package/lib/Player/hooks.js +0 -10
  7. package/lib/Player/index.js +24 -84
  8. package/lib/Player/modules/Drawer/index.js +0 -17
  9. package/lib/Player/modules/PopUp/index.js +0 -10
  10. package/lib/Player/modules/ResizeObserver/index.js +0 -8
  11. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +17 -111
  12. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +2 -24
  13. package/lib/Player/modules/VideoAgent/index.js +0 -17
  14. package/lib/Player/modules/Wave/index.js +0 -11
  15. package/lib/Player/modules/keyframes/BgMusic/index.js +2 -15
  16. package/lib/Player/modules/keyframes/CameraMovement/index.js +3 -27
  17. package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -25
  18. package/lib/Player/modules/keyframes/ModelVideo/index.js +3 -29
  19. package/lib/Player/modules/keyframes/PanoEffect/index.js +15 -43
  20. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -7
  21. package/lib/Player/modules/keyframes/PanoTag/index.js +6 -23
  22. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +22 -47
  23. package/lib/Player/modules/keyframes/Prompter/index.js +10 -32
  24. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +18 -25
  25. package/lib/Player/modules/keyframes/VideoEffect/index.js +12 -47
  26. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
  27. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
  28. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
  29. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +19 -60
  30. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
  31. package/lib/fivePlugins/CameraMovementPlugin/index.js +28 -75
  32. package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
  33. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +11 -60
  34. package/lib/index.js +0 -1
  35. package/lib/react/index.js +7 -34
  36. package/lib/shared-utils/AduioLike.js +5 -39
  37. package/lib/shared-utils/Preloader.js +0 -7
  38. package/lib/shared-utils/addResizeListener.js +0 -5
  39. package/lib/shared-utils/animationFrame/BetterTween.js +2 -38
  40. package/lib/shared-utils/animationFrame/index.js +2 -10
  41. package/lib/shared-utils/animationFrame/tween.js +2 -15
  42. package/lib/shared-utils/createTransMatrix.js +2 -17
  43. package/lib/shared-utils/getFileExpandedName.js +0 -1
  44. package/lib/shared-utils/getMediaInfo.js +0 -9
  45. package/lib/shared-utils/setElementDataset.js +0 -2
  46. package/lib/typings/VreoUnit.js +0 -15
  47. package/package.json +2 -2
  48. package/resources/Player/modules/keyframes/PanoTag/index.tsx +1 -2
@@ -1,24 +1,16 @@
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
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.PanoTag = PanoTag;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _hooks = require("../../../hooks");
13
-
14
10
  var _VreoUnit = require("../../../../typings/VreoUnit");
15
-
16
11
  var _dnalogel = require("@realsee/dnalogel");
17
-
18
12
  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
-
20
13
  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
-
22
14
  function PanoTag() {
23
15
  var timeoutRef = React.useRef();
24
16
  var controller = (0, _hooks.useController)();
@@ -42,22 +34,19 @@ function PanoTag() {
42
34
  }));
43
35
  React.useEffect(function () {
44
36
  var _controller$configs;
45
-
46
37
  if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.PanoTag) === false) {
47
38
  return;
48
39
  }
49
-
50
40
  var callback = function callback(keyframe) {
51
41
  if (!panoTagPlugin.current) return;
52
42
  var start = keyframe.start,
53
- end = keyframe.end,
54
- data = keyframe.data;
43
+ end = keyframe.end,
44
+ data = keyframe.data;
55
45
  var panoTagData = data;
56
- var id = 'any-id';
46
+ var id = Date.now().toString();
57
47
  var pointType = _dnalogel.PointType.PointTag;
58
48
  var dimensionType = _dnalogel.DimensionType.Two;
59
49
  var position = [panoTagData.vertex.x, panoTagData.vertex.y, panoTagData.vertex.z];
60
-
61
50
  var tag = function () {
62
51
  if (panoTagData.imgUrl) {
63
52
  return {
@@ -86,24 +75,20 @@ function PanoTag() {
86
75
  }
87
76
  };
88
77
  }
89
- }(); // show
90
-
78
+ }();
91
79
 
80
+ // show
92
81
  panoTagPlugin.current.load({
93
82
  tagList: [tag]
94
83
  });
95
84
  timeoutRef.current = setTimeout(function () {
96
85
  var _tag$hooks;
97
-
98
- var id = Date.now(); // clear
99
-
86
+ // clear
100
87
  var tag = panoTagPlugin.current.getTagById(id);
101
-
102
88
  if (tag.state) {
103
89
  tag.state.unfolded = false;
104
90
  panoTagPlugin.current.updateRenderAllTags();
105
91
  }
106
-
107
92
  (_tag$hooks = tag.hooks) === null || _tag$hooks === void 0 ? void 0 : _tag$hooks.on('folded', function () {
108
93
  setTimeout(function () {
109
94
  if (tag.state) {
@@ -114,11 +99,9 @@ function PanoTag() {
114
99
  });
115
100
  }, end - start);
116
101
  };
117
-
118
102
  controller.on(_VreoUnit.VreoKeyframeEnum.PanoTag, callback);
119
103
  return function () {
120
104
  controller.off(_VreoUnit.VreoKeyframeEnum.PanoTag, callback);
121
-
122
105
  if (timeoutRef.current) {
123
106
  clearTimeout(timeoutRef.current);
124
107
  }
@@ -1,42 +1,25 @@
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
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.PanoTextLabel = PanoTextLabel;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var THREE = _interopRequireWildcard(require("three"));
13
-
14
10
  var _reactDom = _interopRequireDefault(require("react-dom"));
15
-
16
11
  var _hooks = require("../../../hooks");
17
-
18
12
  var _CSS3DRenderPlugin = require("../../../../fivePlugins/CSS3DRenderPlugin");
19
-
20
13
  var _VreoUnit = require("../../../../typings/VreoUnit");
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
-
24
15
  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
-
26
16
  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
-
28
17
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
-
30
18
  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
-
32
19
  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
-
34
20
  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
-
36
21
  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
-
38
22
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
-
40
23
  /**
41
24
  * 通过传入中心点确定矩形框架容器的四个点:
42
25
  * 1. 已知矩形长宽和中心点
@@ -48,11 +31,11 @@ var calcPoints = function calcPoints(centerPoint, normal, wrapperLength, wrapper
48
31
  var length = wrapperLength / 375;
49
32
  var width = wrapperWidth / 375;
50
33
  var geometry = new THREE.PlaneGeometry(length, width);
51
-
52
34
  if (normal) {
53
35
  var lookPoint = new THREE.Vector3(normal.x + centerPoint.x, normal.y + centerPoint.y, normal.z + centerPoint.z);
54
36
  geometry.lookAt(lookPoint);
55
- } // const pointgeometry = new THREE.Geometry()
37
+ }
38
+ // const pointgeometry = new THREE.Geometry()
56
39
  // pointgeometry.vertices.push(cameraPosition)
57
40
  // const pointmaterial = new THREE.PointsMaterial({
58
41
  // color: 0xffffff,
@@ -60,33 +43,32 @@ var calcPoints = function calcPoints(centerPoint, normal, wrapperLength, wrapper
60
43
  // })
61
44
  // _point = new THREE.Points(pointgeometry, pointmaterial)
62
45
 
63
-
64
46
  var material = new THREE.MeshBasicMaterial({
65
47
  color: 0xffff00,
66
48
  side: THREE.DoubleSide
67
49
  });
68
50
  var plane = new THREE.Mesh(geometry, material);
69
51
  var v0 = centerPoint.clone();
70
- plane.position.copy(v0); // 计算传入的四个点的坐标
52
+ plane.position.copy(v0);
71
53
 
54
+ // 计算传入的四个点的坐标
72
55
  var _plane$geometry$verti = _slicedToArray(plane.geometry.vertices, 4),
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
-
56
+ v1 = _plane$geometry$verti[0],
57
+ v2 = _plane$geometry$verti[1],
58
+ v3 = _plane$geometry$verti[2],
59
+ v4 = _plane$geometry$verti[3];
78
60
  var downLeft = v0.clone().add(v4);
79
61
  var downRight = v0.clone().add(v3);
80
62
  var upLeft = v0.clone().add(v2);
81
- var upRight = v0.clone().add(v1); // 插件使用要求:矩形四个点位数据,顺序为**必须**为左下、右下、右上、左上
63
+ var upRight = v0.clone().add(v1);
82
64
 
65
+ // 插件使用要求:矩形四个点位数据,顺序为**必须**为左下、右下、右上、左上
83
66
  return [downLeft, downRight, upRight, upLeft];
84
67
  };
68
+
85
69
  /**
86
70
  * 空间文本标签。
87
71
  */
88
-
89
-
90
72
  function PanoTextLabel() {
91
73
  var timeoutRef = React.useRef();
92
74
  var controller = (0, _hooks.useController)();
@@ -94,39 +76,35 @@ function PanoTextLabel() {
94
76
  var ref = React.useRef();
95
77
  React.useEffect(function () {
96
78
  var _controller$configs;
97
-
98
79
  if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.PanoTextLabel) === false) {
99
80
  return;
100
81
  }
101
-
102
82
  var callback = function callback(keyframe) {
103
83
  var _panoTextLabelData$no, _panoTextLabelData$no2, _panoTextLabelData$no3;
104
-
105
84
  var start = keyframe.start,
106
- end = keyframe.end,
107
- data = keyframe.data;
108
- var panoTextLabelData = data; // 增加无文本情况的判断
109
-
85
+ end = keyframe.end,
86
+ data = keyframe.data;
87
+ var panoTextLabelData = data;
88
+ // 增加无文本情况的判断
110
89
  if (data.text === '') return;
111
90
  var _panoTextLabelData$ve = panoTextLabelData.vertex,
112
- x = _panoTextLabelData$ve.x,
113
- y = _panoTextLabelData$ve.y,
114
- z = _panoTextLabelData$ve.z;
91
+ x = _panoTextLabelData$ve.x,
92
+ y = _panoTextLabelData$ve.y,
93
+ z = _panoTextLabelData$ve.z;
115
94
  var centerPoint = new THREE.Vector3(x, y, z);
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
-
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
+ // 生成传入的四个点,将文本框最大宽度定在200px,最高高度在30px
118
97
  var wrapperLength = 200;
119
98
  var wrapperWidth = 30;
120
99
  var points = calcPoints(centerPoint, panoTextLabelData.normal && normal, wrapperLength, wrapperWidth);
121
100
  if (!ref.current) ref.current = (0, _CSS3DRenderPlugin.CSS3DRenderPlugin)(five);
122
101
  var container = ref.current.create3DDomContainer(points);
123
- var css3DObject = container === null || container === void 0 ? void 0 : container.css3DObject; // 将获取的mesh进行旋转操作,根据欧拉角去进行mesh的变换
124
-
102
+ var css3DObject = container === null || container === void 0 ? void 0 : container.css3DObject;
103
+ // 将获取的mesh进行旋转操作,根据欧拉角去进行mesh的变换
125
104
  if (data.quaternion) {
126
105
  var quaternion = new THREE.Quaternion(data.quaternion.x, data.quaternion.y, data.quaternion.z, data.quaternion.w);
127
106
  css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.quaternion.copy(quaternion);
128
107
  }
129
-
130
108
  if (container !== null && container !== void 0 && container.container) _reactDom["default"].render( /*#__PURE__*/React.createElement("div", {
131
109
  className: "PanoTextLabel PanoTextLabel--notHidden"
132
110
  }, /*#__PURE__*/React.createElement("div", {
@@ -139,15 +117,12 @@ function PanoTextLabel() {
139
117
  }, data.text || ''))), container === null || container === void 0 ? void 0 : container.container);
140
118
  timeoutRef.current = setTimeout(function () {
141
119
  var _ref$current;
142
-
143
120
  (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.disposeAll();
144
121
  }, end - start);
145
122
  };
146
-
147
123
  controller.on(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
148
124
  return function () {
149
125
  controller.off(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
150
-
151
126
  if (timeoutRef.current) {
152
127
  clearTimeout(timeoutRef.current);
153
128
  }
@@ -1,81 +1,59 @@
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
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.Prompter = Prompter;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
10
  var _hooks = require("../../../hooks");
15
-
16
11
  var _VreoUnit = require("../../../../typings/VreoUnit");
17
-
18
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
-
20
13
  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
-
22
14
  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
-
24
15
  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
-
26
16
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
27
-
28
17
  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
-
30
18
  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
-
32
19
  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
-
34
20
  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
-
36
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
-
38
22
  function Prompter() {
39
23
  var _React$useState = React.useState(''),
40
- _React$useState2 = _slicedToArray(_React$useState, 2),
41
- text = _React$useState2[0],
42
- setText = _React$useState2[1];
43
-
24
+ _React$useState2 = _slicedToArray(_React$useState, 2),
25
+ text = _React$useState2[0],
26
+ setText = _React$useState2[1];
44
27
  var _React$useState3 = React.useState(true),
45
- _React$useState4 = _slicedToArray(_React$useState3, 2),
46
- hidden = _React$useState4[0],
47
- setHidden = _React$useState4[1];
48
-
28
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
29
+ hidden = _React$useState4[0],
30
+ setHidden = _React$useState4[1];
49
31
  var ref = React.useRef(null);
50
32
  var controller = (0, _hooks.useController)();
51
33
  React.useEffect(function () {
52
34
  var _controller$configs;
53
-
54
35
  if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.Prompter) === false) {
55
36
  return;
56
37
  }
57
-
58
38
  var callback = function callback(keyframe) {
59
39
  var start = keyframe.start,
60
- end = keyframe.end,
61
- data = keyframe.data;
40
+ end = keyframe.end,
41
+ data = keyframe.data;
62
42
  setText(data.text);
63
43
  setHidden(false);
64
-
65
44
  if (ref.current) {
66
45
  clearTimeout(ref.current);
67
46
  ref.current = null;
68
47
  }
69
-
70
48
  ref.current = setTimeout(function () {
71
49
  setHidden(true);
72
- setText(''); // setTimeout(() => setText(''), 500)
50
+ setText('');
51
+ // setTimeout(() => setText(''), 500)
73
52
 
74
53
  if (ref.current) clearTimeout(ref.current);
75
54
  ref.current = null;
76
55
  }, end - start);
77
56
  };
78
-
79
57
  controller.on(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
80
58
  return function () {
81
59
  controller.off(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
@@ -1,40 +1,33 @@
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
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.UpdateVRPanorama = UpdateVRPanorama;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _five = require("@realsee/five");
13
-
14
10
  var _hooks = require("../../../hooks");
15
-
16
11
  var _VreoUnit = require("../../../../typings/VreoUnit");
17
-
18
12
  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
-
20
13
  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
-
22
14
  function UpdateVRPanorama() {
23
15
  var controller = (0, _hooks.useController)();
24
16
  var five = (0, _hooks.useFiveInstance)();
25
17
  var deafultWorkRef = React.useRef(null);
26
- var updateWorkRef = React.useRef(null); // 恢复默认 VR
18
+ var updateWorkRef = React.useRef(null);
27
19
 
20
+ // 恢复默认 VR
28
21
  var restoreCallback = React.useCallback(function () {
29
22
  // 先清理掉 之前的 VR 数据备份
30
23
  updateWorkRef.current = null;
31
-
32
24
  if (deafultWorkRef.current) {
33
25
  var work = (0, _five.parseWork)(deafultWorkRef.current);
34
26
  five.load(work);
35
27
  }
36
- }, []); // 暂停时: 恢复默认 VR
28
+ }, []);
37
29
 
30
+ // 暂停时: 恢复默认 VR
38
31
  var pausedCallback = React.useCallback(function () {
39
32
  if (deafultWorkRef.current) {
40
33
  var work = (0, _five.parseWork)(deafultWorkRef.current);
@@ -43,33 +36,32 @@ function UpdateVRPanorama() {
43
36
  });
44
37
  five.load(work);
45
38
  }
46
- }, []); // 播放时:如果暂停前有更新 VR 需要还原
39
+ }, []);
47
40
 
41
+ // 播放时:如果暂停前有更新 VR 需要还原
48
42
  var playingCallback = React.useCallback(function () {
49
43
  if (!updateWorkRef.current) {
50
44
  return;
51
45
  }
52
-
53
46
  five.load(updateWorkRef.current);
54
47
  }, []);
55
48
  React.useEffect(function () {
56
49
  var callback = function callback(keyframe) {
57
50
  var _five$work;
58
-
59
51
  if (!deafultWorkRef.current) {
60
52
  deafultWorkRef.current = five.work.raw.works;
61
53
  }
54
+ var data = keyframe.data;
62
55
 
63
- var data = keyframe.data; // 如果数据中有新 work 数据,则直接载入
64
-
56
+ // 如果数据中有新 work 数据,则直接载入
65
57
  if (data.work) {
66
58
  updateWorkRef.current = (0, _five.parseWork)(data.work);
67
59
  five.load(updateWorkRef.current);
68
60
  return;
69
61
  }
62
+ var lastRawWork = (_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.works[0];
70
63
 
71
- var lastRawWork = (_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.works[0]; // 动态场景:不提供完成的签名数据,需重新整理
72
-
64
+ // 动态场景:不提供完成的签名数据,需重新整理
73
65
  if (data.dynamic_scene && !data.panorama) {
74
66
  var lastWork = JSON.parse(lastRawWork);
75
67
  var panorama = lastWork.panorama;
@@ -78,7 +70,6 @@ function UpdateVRPanorama() {
78
70
  data.panorama = panorama;
79
71
  delete data.dynamic_scene;
80
72
  }
81
-
82
73
  Object.assign(window, {
83
74
  $work1: JSON.parse(lastRawWork),
84
75
  $work2: data,
@@ -87,15 +78,17 @@ function UpdateVRPanorama() {
87
78
  updateWorkRef.current = (0, _five.parseWork)([lastRawWork, data]);
88
79
  five.load(updateWorkRef.current);
89
80
  };
81
+ controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback);
90
82
 
91
- controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback); // 离开 将之前的内容清空
92
-
93
- controller.on(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback); // 新载入数据 将之前的内容清空
94
-
95
- controller.on('loaded', restoreCallback); // 暂停 回到默认状态
83
+ // 离开 将之前的内容清空
84
+ controller.on(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback);
96
85
 
97
- controller.on('paused', pausedCallback); // 播放 回归暂停前状态
86
+ // 新载入数据 将之前的内容清空
87
+ controller.on('loaded', restoreCallback);
98
88
 
89
+ // 暂停 回到默认状态
90
+ controller.on('paused', pausedCallback);
91
+ // 播放 回归暂停前状态
99
92
  controller.on('playing', playingCallback);
100
93
  return function () {
101
94
  // 清理事件监听