@realsee/vreo 0.2.0-alpha.5 → 0.2.0-alpha.8

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 (69) hide show
  1. package/README.md +47 -3
  2. package/docs/assets/custom.css +2 -2
  3. package/docs/assets/search.js +1 -1
  4. package/docs/classes/Player.Controller.html +3 -3
  5. package/docs/classes/Player.Player-1.html +3 -3
  6. package/docs/classes/Player.VideoAgentMesh.html +11 -11
  7. package/docs/classes/Player.VideoAgentScene.html +1 -1
  8. package/docs/enums/Player.InfoPanelStyleEnum.html +1 -0
  9. package/docs/enums/Player.InfoPanelTypeEnum.html +1 -1
  10. package/docs/enums/Player.PanoEffectEnum.html +1 -1
  11. package/docs/enums/Player.PanoTagEnum.html +1 -1
  12. package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
  13. package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
  14. package/docs/enums/fivePlugins.Rotation.html +1 -1
  15. package/docs/index.html +26 -2
  16. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
  17. package/docs/interfaces/Player.PlayerConfigs.html +3 -3
  18. package/docs/interfaces/Player.Vertex.html +1 -1
  19. package/docs/interfaces/Player.VideoAgentMeshOptions.html +1 -1
  20. package/docs/interfaces/Player.VreoKeyframe.html +1 -1
  21. package/docs/interfaces/Player.VreoUnit.html +1 -1
  22. package/docs/interfaces/Player.VreoVideo.html +1 -1
  23. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
  24. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
  25. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
  26. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
  27. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
  28. package/docs/interfaces/react.VreoActionCallbacks.html +6 -6
  29. package/docs/interfaces/react.VreoProviderProps.html +1 -1
  30. package/docs/modules/Player.html +13 -13
  31. package/docs/modules/custom.html +1 -1
  32. package/docs/modules/fivePlugins.html +2 -2
  33. package/docs/modules/react.html +1 -1
  34. package/lib/PlayController/createHTMLAudioElement.d.ts +1 -0
  35. package/lib/PlayController/createHTMLAudioElement.js +47 -0
  36. package/lib/PlayController/index.d.ts +38 -0
  37. package/lib/PlayController/index.js +300 -0
  38. package/lib/Player/Controller.d.ts +2 -0
  39. package/lib/Player/Controller.js +14 -0
  40. package/lib/Player/custom/SpatialScenePanel/index.d.ts +2 -2
  41. package/lib/Player/custom/SpatialScenePanel/index.js +96 -15
  42. package/lib/Player/index.d.ts +1 -1
  43. package/lib/Player/index.js +71 -10
  44. package/lib/Player/modules/PopUp/index.d.ts +2 -0
  45. package/lib/Player/modules/PopUp/index.js +43 -0
  46. package/lib/Player/modules/keyframes/CameraMovement/index.js +41 -5
  47. package/lib/Player/modules/keyframes/InfoPanel/index.js +73 -35
  48. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +23 -15
  49. package/lib/Player/typings.d.ts +4 -0
  50. package/lib/fivePlugins/CameraMovementPlugin/index.js +101 -90
  51. package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +3 -2
  52. package/lib/typings/VreoUnit.d.ts +9 -3
  53. package/lib/typings/VreoUnit.js +14 -6
  54. package/package.json +2 -2
  55. package/resources/PlayController/createHTMLAudioElement.ts +53 -0
  56. package/resources/PlayController/index.ts +167 -0
  57. package/resources/Player/Controller.ts +12 -0
  58. package/resources/Player/custom/SpatialScenePanel/index.tsx +143 -34
  59. package/resources/Player/index.tsx +36 -2
  60. package/resources/Player/modules/PopUp/index.tsx +26 -0
  61. package/resources/Player/modules/keyframes/CameraMovement/index.tsx +7 -3
  62. package/resources/Player/modules/keyframes/InfoPanel/index.tsx +79 -34
  63. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +20 -15
  64. package/resources/Player/typings.ts +2 -0
  65. package/resources/fivePlugins/CameraMovementPlugin/index.ts +55 -47
  66. package/resources/fivePlugins/CameraMovementPlugin/typings.ts +2 -1
  67. package/resources/typings/VreoUnit.ts +11 -4
  68. package/stylesheets/custom/SpatialScenePanel.css +14 -8
  69. package/stylesheets/default.css +66 -0
@@ -37,6 +37,13 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
37
37
 
38
38
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
39
 
40
+ // const getSphere = (position: Vector3, color = 0xffff00) => {
41
+ // const geometry = new SphereGeometry(0.05, 32, 16)
42
+ // const material = new MeshBasicMaterial({ color })
43
+ // const sphere = new Mesh(geometry, material)
44
+ // sphere.position.copy(position)
45
+ // return sphere
46
+ // }
40
47
  var searchV1 = function searchV1(_ref) {
41
48
  var five = _ref.five,
42
49
  dom = _ref.dom;
@@ -48,7 +55,8 @@ var searchV1 = function searchV1(_ref) {
48
55
  _five$model$intersect2 = _slicedToArray(_five$model$intersect, 1),
49
56
  intersect = _five$model$intersect2[0];
50
57
 
51
- var point = five.project2d(intersect.point); // const width = dom!.clientWidth
58
+ var point = five.project2d(intersect.point);
59
+ var widescreen = window.innerWidth > 560 ? true : false; // const width = dom!.clientWidth
52
60
 
53
61
  var height = dom.clientHeight;
54
62
  dom.style.left = point.x + 'px';
@@ -63,14 +71,16 @@ var searchV1 = function searchV1(_ref) {
63
71
  var rightTop = new _three.Vector3(right, top);
64
72
  var rightBottom = new _three.Vector3(right, bottom);
65
73
  var points = [leftBottom, rightBottom, rightTop, leftTop].map(function (point) {
66
- point.setX(point.x / window.innerWidth * 2 - 2);
67
- point.setY(-(point.y / window.innerHeight) * 2 + 1);
74
+ point.setX(point.x / window.innerWidth * 2 - (widescreen ? 1.25 : 1.75));
75
+ point.setY(-(point.y / window.innerHeight) * 2 + (widescreen ? 1.35 : 1.125));
68
76
  point.setZ(0.5);
69
77
  return point.unproject(five.camera).addScaledVector(cameraDirection, 0.2);
70
- }); // const colors = [0xdc143c, 0xffff00, 0x0000ff, 0x008000]
78
+ }); // __debug__
79
+ // const colors = [0xdc143c, 0xffff00, 0x0000ff, 0x008000]
71
80
  // points.forEach((p, index) => five.scene.add(getSphere(p, colors[index])))
81
+ // 判断是手机 150
72
82
 
73
- var ratio = leftBottom.distanceTo(rightBottom) / 120;
83
+ var ratio = leftBottom.distanceTo(rightBottom) / (widescreen ? 150 : 120);
74
84
  return {
75
85
  points: points,
76
86
  ratio: ratio
@@ -83,6 +93,7 @@ var searchV1 = function searchV1(_ref) {
83
93
 
84
94
 
85
95
  function SpatialScenePanel(props) {
96
+ var timeoutRef = React.useRef(null);
86
97
  var ref = React.useRef(null);
87
98
  var panelRef = React.useRef(null);
88
99
  var rendererRef = React.useRef((0, _CSS3DRenderPlugin.CSS3DRenderPlugin)(props.five));
@@ -96,7 +107,7 @@ function SpatialScenePanel(props) {
96
107
  return;
97
108
  }
98
109
 
99
- var data = keyframe.data;
110
+ var data = keyframe.data; // const data = mockData
100
111
 
101
112
  var _searchV = searchV1({
102
113
  five: props.five,
@@ -114,6 +125,9 @@ function SpatialScenePanel(props) {
114
125
  css3DObject = _ref2.css3DObject,
115
126
  render = _ref2.render;
116
127
 
128
+ Object.assign(window, {
129
+ $css3DObject: css3DObject
130
+ });
117
131
  if (!container) return;
118
132
 
119
133
  _reactDom["default"].render( /*#__PURE__*/React.createElement(Panel, {
@@ -129,7 +143,8 @@ function SpatialScenePanel(props) {
129
143
  var progress = _ref4.progress;
130
144
  var needRotateY = Math.PI / 90 * 11 * progress;
131
145
  var rotateY = needRotateY - lastRotateY;
132
- css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(rotateY);
146
+ css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(rotateY); // css3DObject?.rotateZ
147
+
133
148
  lastRotateY = needRotateY;
134
149
  }).onStart(function () {
135
150
  css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(startRotateY);
@@ -138,22 +153,35 @@ function SpatialScenePanel(props) {
138
153
  var _panelRef$current;
139
154
 
140
155
  (_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.classList.add('show');
141
- }).play();
156
+ }).play(); // Object.assign(window, { $dispose: () => {
157
+ // panelRef.current?.classList.add('hide')
158
+ // setTimeout(() => dispose?.(), 1500)
159
+ // } })
160
+
142
161
  var start = keyframe.start,
143
162
  end = keyframe.end;
144
- setTimeout(function () {
163
+ timeoutRef.current = setTimeout(function () {
145
164
  var _panelRef$current2;
146
165
 
147
166
  (_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0 ? void 0 : _panelRef$current2.classList.add('hide');
148
- setTimeout(function () {
149
- return dispose === null || dispose === void 0 ? void 0 : dispose();
167
+ timeoutRef.current = setTimeout(function () {
168
+ dispose === null || dispose === void 0 ? void 0 : dispose();
169
+ timeoutRef.current = null;
150
170
  }, 1500);
151
171
  }, end - start);
152
172
  };
153
173
 
174
+ Object.assign(window, {
175
+ $callback: callback
176
+ }); // setTimeout(() => {callback()}, 8000)
177
+
154
178
  props.subscribe.on(_VreoUnit.VreoKeyframeEnum.Custom, callback);
155
179
  return function () {
156
180
  props.subscribe.off(_VreoUnit.VreoKeyframeEnum.Custom, callback);
181
+
182
+ if (timeoutRef.current) {
183
+ clearTimeout(timeoutRef.current);
184
+ }
157
185
  };
158
186
  }, []);
159
187
  return /*#__PURE__*/React.createElement("div", {
@@ -161,6 +189,38 @@ function SpatialScenePanel(props) {
161
189
  ref: ref
162
190
  });
163
191
  }
192
+ /** 背景动画:控制延迟 */
193
+
194
+
195
+ function SpatialScenePanelBg() {
196
+ var ref = React.useRef(null);
197
+ var timeoutRef = React.useRef(null);
198
+ React.useEffect(function () {
199
+ if (!ref.current) return;
200
+
201
+ var listener = function listener() {
202
+ var _ref$current;
203
+
204
+ (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.setAttribute('class', 'SpatialScenePanel-bg');
205
+ timeoutRef.current = setTimeout(function () {
206
+ var _ref$current2;
207
+
208
+ (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.setAttribute('class', 'SpatialScenePanel-bg SpatialScenePanel-bg--animation');
209
+ timeoutRef.current = null;
210
+ }, 3000);
211
+ };
212
+
213
+ ref.current.addEventListener('animationend', listener);
214
+ return function () {
215
+ if (ref.current) ref.current.removeEventListener('animationend', listener);
216
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
217
+ };
218
+ }, []);
219
+ return /*#__PURE__*/React.createElement("div", {
220
+ ref: ref,
221
+ className: "SpatialScenePanel-bg SpatialScenePanel-bg--animation"
222
+ });
223
+ }
164
224
 
165
225
  var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
166
226
  var _props$data, _props$data2, _props$data3, _props$data3$stateLis;
@@ -170,9 +230,7 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
170
230
  ref: myRef
171
231
  }, /*#__PURE__*/React.createElement("div", {
172
232
  className: "SpatialScenePanel-show-area"
173
- }, /*#__PURE__*/React.createElement("div", {
174
- className: "SpatialScenePanel-bg"
175
- }), /*#__PURE__*/React.createElement("div", {
233
+ }, /*#__PURE__*/React.createElement(SpatialScenePanelBg, null), /*#__PURE__*/React.createElement("div", {
176
234
  className: "SpatialScenePanel-header"
177
235
  }, /*#__PURE__*/React.createElement("div", {
178
236
  className: "SpatialScenePanel-title"
@@ -195,4 +253,27 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
195
253
  }))), /*#__PURE__*/React.createElement("div", {
196
254
  className: "SpatialScenePanel-disappear-area"
197
255
  }));
198
- });
256
+ }); // export function SpatialScenePanel() {
257
+ // // const data = mockData
258
+ // return (
259
+ // <div className="SpatialScenePanel" >
260
+ // <div className="SpatialScenePanel-show-area">
261
+ // <SpatialScenePanelBg />
262
+ // <div className="SpatialScenePanel-header">
263
+ // <div className="SpatialScenePanel-title">{data?.title}</div>
264
+ // <div className="SpatialScenePanel-temperature">{data?.temperature}℃</div>
265
+ // </div>
266
+ // <div className="SpatialScenePanel-body">
267
+ // {data?.stateList?.map((state, index) => (
268
+ // <div key={`scene-${state.text}`} className={`SpatialScenePanel-item index_${index}`}>
269
+ // <img className="SpatialScenePanel-icon" src={state.icon}></img>
270
+ // <div className="SpatialScenePanel-text">{state.text}</div>
271
+ // <div className="SpatialScenePanel-dot"></div>
272
+ // </div>
273
+ // ))}
274
+ // </div>
275
+ // </div>
276
+ // <div className="SpatialScenePanel-disappear-area"></div>
277
+ // </div>
278
+ // )
279
+ // }
@@ -6,7 +6,7 @@ export declare class Player extends Subscribe<VreoKeyframeEvent> {
6
6
  private controller;
7
7
  configs: Readonly<PlayerConfigs>;
8
8
  constructor(five: Five, configs?: Partial<PlayerConfigs>);
9
- load(vreoUnit: VreoUnit, currentTime?: number): Promise<boolean>;
9
+ load(vreoUnit: VreoUnit, currentTime?: number, preload?: boolean): Promise<boolean>;
10
10
  get paused(): boolean;
11
11
  play(): boolean;
12
12
  pause(): void;
@@ -17,10 +17,14 @@ var _App = require("./App");
17
17
 
18
18
  var _Controller = require("./Controller");
19
19
 
20
+ var _VreoUnit = require("../typings/VreoUnit");
21
+
20
22
  var _mobx = require("mobx");
21
23
 
22
24
  var _Drawer = require("./modules/Drawer");
23
25
 
26
+ var _PopUp = require("./modules/PopUp");
27
+
24
28
  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
29
 
26
30
  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; }
@@ -79,7 +83,7 @@ var Player = /*#__PURE__*/function (_Subscribe) {
79
83
  _this.controller.configs = _this.configs;
80
84
  ReactDOM.render( /*#__PURE__*/React.createElement(_Controller.ControllerContext.Provider, {
81
85
  value: _this.controller
82
- }, /*#__PURE__*/React.createElement(_App.App, null), /*#__PURE__*/React.createElement(_Drawer.Drawer, null), _this.configs.customKeyframes && _this.configs.customKeyframes.map(function (CustomCmpt, key) {
86
+ }, /*#__PURE__*/React.createElement(_App.App, null), /*#__PURE__*/React.createElement(_Drawer.Drawer, null), /*#__PURE__*/React.createElement(_PopUp.PopUp, null), _this.configs.customKeyframes && _this.configs.customKeyframes.map(function (CustomCmpt, key) {
83
87
  return /*#__PURE__*/React.createElement(CustomCmpt, {
84
88
  key: key,
85
89
  subscribe: {
@@ -110,9 +114,14 @@ var Player = /*#__PURE__*/function (_Subscribe) {
110
114
  value: function () {
111
115
  var _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(vreoUnit) {
112
116
  var _this$controller$vide,
117
+ _this$configs$imageOp,
113
118
  _this2 = this;
114
119
 
115
120
  var currentTime,
121
+ preload,
122
+ panoIndexMap,
123
+ panoIndexs,
124
+ i,
116
125
  _this$controller$vide2,
117
126
  _this$controller$vide3,
118
127
  _args = arguments;
@@ -122,34 +131,86 @@ var Player = /*#__PURE__*/function (_Subscribe) {
122
131
  switch (_context.prev = _context.next) {
123
132
  case 0:
124
133
  currentTime = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
134
+ preload = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
125
135
 
126
136
  if (this.controller.visible) {
127
- _context.next = 5;
137
+ _context.next = 6;
128
138
  break;
129
139
  }
130
140
 
131
141
  this.controller.setVisible(true); // 延迟 500ms 规避跟 DOM 动画冲突
132
142
 
133
- _context.next = 5;
143
+ _context.next = 6;
134
144
  return new Promise(function (resolve) {
135
145
  setTimeout(function () {
136
146
  return resolve(true);
137
147
  }, 500);
138
148
  });
139
149
 
140
- case 5:
150
+ case 6:
141
151
  if (this.controller.stopInterval) {
142
152
  this.controller.stopInterval();
143
153
  this.controller.stopInterval = undefined;
144
154
  }
145
155
 
146
156
  this.controller.vreoUnit = vreoUnit;
147
- (_this$controller$vide = this.controller.videoInstance) === null || _this$controller$vide === void 0 ? void 0 : _this$controller$vide.pause(); // 新数据载入就绪
157
+ (_this$controller$vide = this.controller.videoInstance) === null || _this$controller$vide === void 0 ? void 0 : _this$controller$vide.pause(); // 预载逻辑
158
+ // 是否降低图片分辨率
159
+
160
+ if (this.$five.imageOptions.size && (_this$configs$imageOp = this.configs.imageOptions) !== null && _this$configs$imageOp !== void 0 && _this$configs$imageOp.size && this.$five.imageOptions.size > this.configs.imageOptions.size) {
161
+ this.$five.imageOptions.size = this.configs.imageOptions.size;
162
+ } // 预载数据中的点位
163
+
164
+
165
+ if (!(preload || preload === undefined && this.configs.autoPreload)) {
166
+ _context.next = 20;
167
+ break;
168
+ }
169
+
170
+ panoIndexMap = vreoUnit.keyframes.filter(function (vreoKeyframe) {
171
+ if (vreoKeyframe.type !== _VreoUnit.VreoKeyframeEnum.CameraMovement) {
172
+ return false;
173
+ }
174
+
175
+ var data = vreoKeyframe.data;
176
+
177
+ if (data.panoIndex === undefined) {
178
+ return false;
179
+ }
148
180
 
181
+ return true;
182
+ }).reduce(function (accu, curr) {
183
+ var panoIndex = curr.data.panoIndex;
184
+
185
+ if (!accu[panoIndex]) {
186
+ accu[panoIndex] = true;
187
+ }
188
+
189
+ return accu;
190
+ }, {});
191
+ panoIndexs = Object.keys(panoIndexMap);
192
+ i = 0;
193
+
194
+ case 14:
195
+ if (!(i < panoIndexs.length)) {
196
+ _context.next = 20;
197
+ break;
198
+ }
199
+
200
+ _context.next = 17;
201
+ return this.$five.preloadPano(Number(panoIndexs[i]));
202
+
203
+ case 17:
204
+ i++;
205
+ _context.next = 14;
206
+ break;
207
+
208
+ case 20:
209
+ // 新数据载入就绪
149
210
  this.emit('loaded', vreoUnit);
150
211
 
151
212
  if (!vreoUnit.video.url) {
152
- _context.next = 14;
213
+ _context.next = 26;
153
214
  break;
154
215
  }
155
216
 
@@ -157,19 +218,19 @@ var Player = /*#__PURE__*/function (_Subscribe) {
157
218
  this.controller.videoAgentScene.videoAgentMesh.videoInstance.currentTime = currentTime / 1000;
158
219
  }
159
220
 
160
- _context.next = 13;
221
+ _context.next = 25;
161
222
  return (_this$controller$vide3 = this.controller.videoAgentScene) === null || _this$controller$vide3 === void 0 ? void 0 : _this$controller$vide3.videoAgentMesh.play(vreoUnit.video.url);
162
223
 
163
- case 13:
224
+ case 25:
164
225
  this.play();
165
226
 
166
- case 14:
227
+ case 26:
167
228
  this.controller.run(function (type, keyframe) {
168
229
  return _this2.emit(type, keyframe);
169
230
  });
170
231
  return _context.abrupt("return", true);
171
232
 
172
- case 16:
233
+ case 28:
173
234
  case "end":
174
235
  return _context.stop();
175
236
  }
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function PopUp(): JSX.Element;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.PopUp = PopUp;
9
+
10
+ var React = _interopRequireWildcard(require("react"));
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
14
+ var _mobxReact = require("mobx-react");
15
+
16
+ var _hooks = require("../../hooks");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
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
+
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
+
24
+ var PopUpView = (0, _mobxReact.observer)(function (_ref) {
25
+ var controller = _ref.controller;
26
+ return /*#__PURE__*/React.createElement("div", {
27
+ className: (0, _classnames["default"])('vreo-PopUp', {
28
+ 'vreo-PopUp-visible': controller.popUp
29
+ }),
30
+ onClick: function onClick() {
31
+ return controller.openPopUp(false);
32
+ }
33
+ }, /*#__PURE__*/React.createElement("div", {
34
+ className: "vreo-PopUp-inner"
35
+ }, controller.popUp || ''));
36
+ });
37
+
38
+ function PopUp() {
39
+ var controller = (0, _hooks.useController)();
40
+ return /*#__PURE__*/React.createElement(PopUpView, {
41
+ controller: controller
42
+ });
43
+ }
@@ -45,13 +45,49 @@ function CameraMovement() {
45
45
  cameraMovementData = data;
46
46
  effect = cameraMovementData.effect;
47
47
 
48
- if (effect === _typings.CameraMovementEffect.Rotate) {
49
- ref.current.rotate(data, end - start);
50
- } else {
51
- ref.current.move(data, end - start);
48
+ if (!(effect === _typings.CameraMovementEffect.Rotate)) {
49
+ _context.next = 9;
50
+ break;
52
51
  }
53
52
 
54
- case 5:
53
+ _context.next = 7;
54
+ return ref.current.rotate(data, end - start);
55
+
56
+ case 7:
57
+ _context.next = 21;
58
+ break;
59
+
60
+ case 9:
61
+ if (!(effect === _typings.CameraMovementEffect.Move)) {
62
+ _context.next = 14;
63
+ break;
64
+ }
65
+
66
+ _context.next = 12;
67
+ return ref.current.move(data, end - start);
68
+
69
+ case 12:
70
+ _context.next = 21;
71
+ break;
72
+
73
+ case 14:
74
+ if (!(cameraMovementData.panoIndex !== undefined && cameraMovementData.panoIndex !== five.panoIndex)) {
75
+ _context.next = 19;
76
+ break;
77
+ }
78
+
79
+ _context.next = 17;
80
+ return ref.current.move(data, end - start);
81
+
82
+ case 17:
83
+ _context.next = 21;
84
+ break;
85
+
86
+ case 19:
87
+ _context.next = 21;
88
+ return ref.current.rotate(data, end - start);
89
+
90
+ case 21:
55
91
  case "end":
56
92
  return _context.stop();
57
93
  }
@@ -75,49 +75,87 @@ function InfoPanel() {
75
75
  data = keyframe.data;
76
76
  var infoPanelData = data;
77
77
  var title = infoPanelData.title,
78
- subTitle = infoPanelData.subTitle;
79
-
80
- if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
81
- controller.openDrawer({
82
- content: /*#__PURE__*/React.createElement(InfoPanelImg, {
83
- url: infoPanelData.url
84
- }, /*#__PURE__*/React.createElement(Title, {
85
- title: title,
86
- subTitle: subTitle
87
- })),
88
- height: '60vh'
89
- });
90
- } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
91
- controller.openDrawer({
92
- content: /*#__PURE__*/React.createElement(InfoPanelVideo, {
93
- url: infoPanelData.url
94
- }, /*#__PURE__*/React.createElement(Title, {
95
- title: title,
96
- subTitle: subTitle
97
- })),
98
- height: '60vh'
99
- });
100
- }
78
+ subTitle = infoPanelData.subTitle,
79
+ style = infoPanelData.style;
80
+
81
+ do {
82
+ if (style === _VreoUnit.InfoPanelStyleEnum.PopUp) {
83
+ if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
84
+ controller.openPopUp( /*#__PURE__*/React.createElement(InfoPanelImg, {
85
+ url: infoPanelData.url
86
+ }, /*#__PURE__*/React.createElement(Title, {
87
+ title: title,
88
+ subTitle: subTitle
89
+ })));
90
+ } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
91
+ controller.openPopUp( /*#__PURE__*/React.createElement(InfoPanelVideo, {
92
+ url: infoPanelData.url
93
+ }, /*#__PURE__*/React.createElement(Title, {
94
+ title: title,
95
+ subTitle: subTitle
96
+ })));
97
+ }
98
+
99
+ break;
100
+ }
101
+
102
+ if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
103
+ controller.openDrawer({
104
+ content: /*#__PURE__*/React.createElement(InfoPanelImg, {
105
+ url: infoPanelData.url
106
+ }, /*#__PURE__*/React.createElement(Title, {
107
+ title: title,
108
+ subTitle: subTitle
109
+ })),
110
+ height: '60vh'
111
+ });
112
+ } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
113
+ controller.openDrawer({
114
+ content: /*#__PURE__*/React.createElement(InfoPanelVideo, {
115
+ url: infoPanelData.url
116
+ }, /*#__PURE__*/React.createElement(Title, {
117
+ title: title,
118
+ subTitle: subTitle
119
+ })),
120
+ height: '60vh'
121
+ });
122
+ }
123
+ } while (false);
101
124
 
102
125
  timeoutRef.current = setTimeout(function () {
103
- return controller.openDrawer(false);
126
+ controller.openDrawer(false);
127
+ controller.openPopUp(false);
104
128
  }, end - start);
105
129
  };
106
130
 
107
131
  controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback); // Object.assign(window, {
108
132
  // $setInfoPanel: () => {
109
- // controller.openDrawer({
110
- // content: (
111
- // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif'>
112
- // // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
113
- // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
114
- // // </InfoPanelImg>
115
- // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
133
+ // controller.openPopUp(
134
+ // // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
135
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
136
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
137
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
138
+ // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
116
139
  // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
117
- // </InfoPanelVideo>
118
- // ),
119
- // height: '60vh',
120
- // })
140
+ // </InfoPanelImg>
141
+ // // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
142
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
143
+ // // </InfoPanelVideo>
144
+ // )
145
+ // },
146
+ // $setInfoPanel2: () => {
147
+ // controller.openPopUp(
148
+ // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
149
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
150
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
151
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
152
+ // // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
153
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
154
+ // // </InfoPanelImg>
155
+ // // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
156
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
157
+ // // </InfoPanelVideo>
158
+ // )
121
159
  // },
122
160
  // })
123
161
 
@@ -22,42 +22,45 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
22
22
  function UpdateVRPanorama() {
23
23
  var controller = (0, _hooks.useController)();
24
24
  var five = (0, _hooks.useFiveInstance)();
25
- var rawRef = React.useRef(null);
26
- var workRef = React.useRef(null);
25
+ var deafultWorkRef = React.useRef(null);
26
+ var updateWorkRef = React.useRef(null);
27
27
  var restoreCallback = React.useCallback(function () {
28
- if (rawRef.current) {
29
- var work = (0, _five.parseWork)(rawRef.current);
28
+ if (deafultWorkRef.current) {
29
+ var work = (0, _five.parseWork)(deafultWorkRef.current);
30
30
  five.load(work);
31
31
  }
32
32
 
33
- workRef.current = null;
33
+ updateWorkRef.current = null;
34
34
  }, []);
35
35
  var pausedCallback = React.useCallback(function () {
36
- if (rawRef.current) {
37
- var work = (0, _five.parseWork)(rawRef.current);
36
+ if (deafultWorkRef.current) {
37
+ var work = (0, _five.parseWork)(deafultWorkRef.current);
38
+ Object.assign(window, {
39
+ $rawWork: work
40
+ });
38
41
  five.load(work);
39
42
  }
40
43
  }, []);
41
44
  var playingCallback = React.useCallback(function () {
42
- if (!workRef.current) {
45
+ if (!updateWorkRef.current) {
43
46
  return;
44
47
  }
45
48
 
46
- five.load(workRef.current);
49
+ five.load(updateWorkRef.current);
47
50
  }, []);
48
51
  React.useEffect(function () {
49
52
  var callback = function callback(keyframe) {
50
53
  var _five$work;
51
54
 
52
- if (!rawRef.current) {
53
- rawRef.current = five.work.raw.works;
55
+ if (!deafultWorkRef.current) {
56
+ deafultWorkRef.current = five.work.raw.works;
54
57
  }
55
58
 
56
59
  var data = keyframe.data; // 如果数据中有新 work 数据,则直接载入
57
60
 
58
61
  if (data.work) {
59
- workRef.current = (0, _five.parseWork)(data.work);
60
- five.load(workRef.current);
62
+ updateWorkRef.current = (0, _five.parseWork)(data.work);
63
+ five.load(updateWorkRef.current);
61
64
  return;
62
65
  }
63
66
 
@@ -72,8 +75,13 @@ function UpdateVRPanorama() {
72
75
  delete data.dynamic_scene;
73
76
  }
74
77
 
75
- workRef.current = (0, _five.parseWork)([lastRawWork, data]);
76
- five.load(workRef.current);
78
+ Object.assign(window, {
79
+ $work1: JSON.parse(lastRawWork),
80
+ $work2: data,
81
+ parseWork: _five.parseWork
82
+ });
83
+ updateWorkRef.current = (0, _five.parseWork)([lastRawWork, data]);
84
+ five.load(updateWorkRef.current);
77
85
  };
78
86
 
79
87
  controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback); // 离开 将之前的内容清空