@realsee/vreo 1.0.0-alpha.3 → 1.0.0-alpha.30

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 (166) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +46 -36
  3. package/lib/PlayController/createHTMLAudioElement.js +6 -11
  4. package/lib/PlayController/index.js +16 -81
  5. package/lib/Player/App.js +0 -24
  6. package/lib/Player/Controller.d.ts +3 -3
  7. package/lib/Player/Controller.js +47 -105
  8. package/lib/Player/custom/SpatialScenePanel/index.js +42 -68
  9. package/lib/Player/hooks.js +0 -10
  10. package/lib/Player/index.js +40 -87
  11. package/lib/Player/modules/Drawer/index.js +0 -17
  12. package/lib/Player/modules/PopUp/index.js +0 -10
  13. package/lib/Player/modules/ResizeObserver/index.js +0 -8
  14. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +2 -2
  15. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +20 -114
  16. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +2 -24
  17. package/lib/Player/modules/VideoAgent/index.js +1 -18
  18. package/lib/Player/modules/Wave/index.js +160 -36
  19. package/lib/Player/modules/keyframes/BgMusic/index.js +50 -51
  20. package/lib/Player/modules/keyframes/CameraMovement/index.js +3 -27
  21. package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -25
  22. package/lib/Player/modules/keyframes/ModelVideo/index.js +3 -29
  23. package/lib/Player/modules/keyframes/PanoEffect/index.js +15 -43
  24. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -7
  25. package/lib/Player/modules/keyframes/PanoTag/index.js +7 -23
  26. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +22 -47
  27. package/lib/Player/modules/keyframes/Prompter/index.js +10 -32
  28. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +18 -25
  29. package/lib/Player/modules/keyframes/VideoEffect/index.js +12 -47
  30. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
  31. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
  32. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
  33. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +19 -60
  34. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
  35. package/lib/fivePlugins/CameraMovementPlugin/index.js +28 -75
  36. package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
  37. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +11 -60
  38. package/lib/index.js +0 -1
  39. package/lib/react/index.js +7 -34
  40. package/lib/shared-utils/Audio.d.ts +14 -0
  41. package/lib/shared-utils/Audio.js +159 -0
  42. package/lib/shared-utils/{AduioLike.d.ts → AudioLike.d.ts} +0 -0
  43. package/lib/shared-utils/{AduioLike.js → AudioLike.js} +9 -45
  44. package/lib/shared-utils/Preloader.js +0 -7
  45. package/lib/shared-utils/addResizeListener.js +0 -5
  46. package/lib/shared-utils/animationFrame/BetterTween.js +2 -38
  47. package/lib/shared-utils/animationFrame/index.js +2 -10
  48. package/lib/shared-utils/animationFrame/tween.js +2 -15
  49. package/lib/shared-utils/createTransMatrix.js +2 -17
  50. package/lib/shared-utils/getFileExpandedName.js +0 -1
  51. package/lib/shared-utils/getMediaInfo.js +0 -9
  52. package/lib/shared-utils/setElementDataset.js +0 -2
  53. package/lib/typings/VreoUnit.d.ts +5 -5
  54. package/lib/typings/VreoUnit.js +0 -15
  55. package/package.json +2 -4
  56. package/stylesheets/default.css +11 -4
  57. package/docs/.nojekyll +0 -1
  58. package/docs/assets/custom.css +0 -78
  59. package/docs/assets/highlight.css +0 -127
  60. package/docs/assets/icons.css +0 -1043
  61. package/docs/assets/icons.png +0 -0
  62. package/docs/assets/icons@2x.png +0 -0
  63. package/docs/assets/main.js +0 -52
  64. package/docs/assets/search.js +0 -1
  65. package/docs/assets/style.css +0 -1414
  66. package/docs/assets/widgets.png +0 -0
  67. package/docs/assets/widgets@2x.png +0 -0
  68. package/docs/classes/Player.AudioLike.html +0 -52
  69. package/docs/classes/Player.Controller.html +0 -54
  70. package/docs/classes/Player.Player-1.html +0 -50
  71. package/docs/classes/Player.VideoAgentMesh.html +0 -142
  72. package/docs/classes/Player.VideoAgentScene.html +0 -1
  73. package/docs/demo/assets/AppReact.39bef668.js +0 -1
  74. package/docs/demo/assets/default.9bbb3329.js +0 -3984
  75. package/docs/demo/assets/default.f3f3ca8c.css +0 -1
  76. package/docs/demo/assets/dynamic.5e9275ce.js +0 -1
  77. package/docs/demo/assets/examples.2ac45f33.js +0 -25
  78. package/docs/demo/assets/examples.dac4a6fe.css +0 -1
  79. package/docs/demo/assets/index.6699bd11.js +0 -1
  80. package/docs/demo/assets/index.9331038f.css +0 -1
  81. package/docs/demo/assets/main.a0741cbc.js +0 -1
  82. package/docs/demo/assets/react.2ee8565f.css +0 -1
  83. package/docs/demo/assets/react.a3f20ea9.js +0 -25
  84. package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +0 -1
  85. package/docs/demo/examples.html +0 -17
  86. package/docs/demo/index-react-dynamic.html +0 -20
  87. package/docs/demo/index-react.html +0 -20
  88. package/docs/demo/index.html +0 -19
  89. package/docs/enums/Player.InfoPanelStyleEnum.html +0 -1
  90. package/docs/enums/Player.InfoPanelTypeEnum.html +0 -3
  91. package/docs/enums/Player.PanoEffectEnum.html +0 -5
  92. package/docs/enums/Player.PanoTagEnum.html +0 -3
  93. package/docs/enums/Player.PanoTagStyleEnum.html +0 -7
  94. package/docs/enums/Player.VreoKeyframeEnum.html +0 -25
  95. package/docs/enums/fivePlugins.CameraMovementEffect.html +0 -1
  96. package/docs/enums/fivePlugins.Rotation.html +0 -1
  97. package/docs/index.html +0 -245
  98. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +0 -1
  99. package/docs/interfaces/Player.PlayerConfigs.html +0 -7
  100. package/docs/interfaces/Player.Vertex.html +0 -3
  101. package/docs/interfaces/Player.VideoAgentMeshOptions.html +0 -8
  102. package/docs/interfaces/Player.VreoKeyframe.html +0 -3
  103. package/docs/interfaces/Player.VreoUnit.html +0 -3
  104. package/docs/interfaces/Player.VreoVideo.html +0 -3
  105. package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +0 -4
  106. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +0 -1
  107. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +0 -7
  108. package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +0 -1
  109. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +0 -1
  110. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +0 -1
  111. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +0 -1
  112. package/docs/interfaces/fivePlugins.Vector3Position.html +0 -3
  113. package/docs/interfaces/react.VreoActionCallbacks.html +0 -23
  114. package/docs/interfaces/react.VreoProviderProps.html +0 -1
  115. package/docs/modules/Player.html +0 -37
  116. package/docs/modules/custom.html +0 -3
  117. package/docs/modules/fivePlugins.html +0 -6
  118. package/docs/modules/react.html +0 -1
  119. package/docs/modules.html +0 -1
  120. package/resources/PlayController/createHTMLAudioElement.ts +0 -53
  121. package/resources/PlayController/index.ts +0 -154
  122. package/resources/Player/App.tsx +0 -66
  123. package/resources/Player/Controller.ts +0 -297
  124. package/resources/Player/custom/SpatialScenePanel/index.tsx +0 -264
  125. package/resources/Player/hooks.ts +0 -26
  126. package/resources/Player/index.tsx +0 -225
  127. package/resources/Player/modules/Drawer/index.tsx +0 -40
  128. package/resources/Player/modules/PopUp/index.tsx +0 -26
  129. package/resources/Player/modules/ResizeObserver/index.tsx +0 -23
  130. package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +0 -302
  131. package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +0 -56
  132. package/resources/Player/modules/VideoAgent/index.tsx +0 -53
  133. package/resources/Player/modules/Wave/index.tsx +0 -18
  134. package/resources/Player/modules/keyframes/BgMusic/index.tsx +0 -66
  135. package/resources/Player/modules/keyframes/CameraMovement/index.tsx +0 -37
  136. package/resources/Player/modules/keyframes/InfoPanel/index.tsx +0 -165
  137. package/resources/Player/modules/keyframes/ModelVideo/index.tsx +0 -77
  138. package/resources/Player/modules/keyframes/PanoEffect/index.tsx +0 -99
  139. package/resources/Player/modules/keyframes/PanoEffect/lineAnime.ts +0 -31
  140. package/resources/Player/modules/keyframes/PanoTag/index.tsx +0 -83
  141. package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +0 -117
  142. package/resources/Player/modules/keyframes/Prompter/index.tsx +0 -56
  143. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +0 -99
  144. package/resources/Player/modules/keyframes/VideoEffect/index.tsx +0 -115
  145. package/resources/Player/typings.ts +0 -49
  146. package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +0 -5
  147. package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +0 -17
  148. package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +0 -4
  149. package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +0 -254
  150. package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +0 -5
  151. package/resources/fivePlugins/CameraMovementPlugin/index.ts +0 -226
  152. package/resources/fivePlugins/CameraMovementPlugin/typings.ts +0 -59
  153. package/resources/fivePlugins/ModelTVVideoPlugin/index.ts +0 -278
  154. package/resources/index.ts +0 -1
  155. package/resources/react/index.tsx +0 -121
  156. package/resources/shared-utils/AduioLike.ts +0 -109
  157. package/resources/shared-utils/Preloader.ts +0 -35
  158. package/resources/shared-utils/addResizeListener.ts +0 -46
  159. package/resources/shared-utils/animationFrame/BetterTween.ts +0 -33
  160. package/resources/shared-utils/animationFrame/index.ts +0 -48
  161. package/resources/shared-utils/animationFrame/tween.ts +0 -51
  162. package/resources/shared-utils/createTransMatrix.ts +0 -12
  163. package/resources/shared-utils/getFileExpandedName.ts +0 -6
  164. package/resources/shared-utils/getMediaInfo.ts +0 -52
  165. package/resources/shared-utils/setElementDataset.ts +0 -18
  166. package/resources/typings/VreoUnit.ts +0 -314
@@ -1,30 +1,19 @@
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["default"] = exports.CSS3DRenderPlugin = void 0;
9
-
10
8
  var THREE = _interopRequireWildcard(require("three"));
11
-
12
9
  var _CSS3DRenderer = require("three/examples/jsm/renderers/CSS3DRenderer");
13
-
14
10
  var _evenNumber = _interopRequireDefault(require("./evenNumber"));
15
-
16
11
  var _centerPoint = _interopRequireDefault(require("./centerPoint"));
17
-
18
12
  var _transformPositionToVector = _interopRequireDefault(require("./transformPositionToVector3"));
19
-
20
13
  var _createResizeObserver = _interopRequireDefault(require("./createResizeObserver"));
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
  /**
29
18
  * **CSS3DRenderPlugin** 提供矩形区域(三维空间四个坐标点),你可以在此矩形区域中渲染 DOM 内容。
30
19
  * 实现原理参考[CSS3DRenderer](https://threejs.org/docs/index.html?q=CSS3D#examples/en/renderers/CSS3DRenderer)。
@@ -35,14 +24,11 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
35
24
  var state = {
36
25
  disposeCallbacks: []
37
26
  };
38
-
39
27
  var create3DDomContainer = function create3DDomContainer() {
40
28
  var _five$model, _five$model2, _config$autoRender;
41
-
42
29
  for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
43
30
  params[_key] = arguments[_key];
44
31
  }
45
-
46
32
  var points = params[0].map(function (point) {
47
33
  return point instanceof THREE.Vector3 ? point : (0, _transformPositionToVector["default"])(point);
48
34
  });
@@ -59,43 +45,40 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
59
45
  var autoRender = (_config$autoRender = config === null || config === void 0 ? void 0 : config.autoRender) !== null && _config$autoRender !== void 0 ? _config$autoRender : true;
60
46
  var behindFiveContainer = (config === null || config === void 0 ? void 0 : config.behindFiveContainer) || fiveElement.parentElement || document.body;
61
47
  var container = (config === null || config === void 0 ? void 0 : config.container) || document.createElement('div');
62
- container.classList.add('__Vreo-plugin--CSS3DRenderPlugin'); // 获取css3DObject, 如果mode为behind的话,一起获取mesh
48
+ container.classList.add('__Vreo-plugin--CSS3DRenderPlugin');
63
49
 
50
+ // 获取css3DObject, 如果mode为behind的话,一起获取mesh
64
51
  var _createObject = createObject(points, {
65
- ratio: ratio,
66
- dpr: dpr,
67
- container: container,
68
- mode: mode
69
- }),
70
- css3DObject = _createObject.css3DObject,
71
- mesh = _createObject.mesh; // ======= INIT START =======
72
-
73
-
52
+ ratio: ratio,
53
+ dpr: dpr,
54
+ container: container,
55
+ mode: mode
56
+ }),
57
+ css3DObject = _createObject.css3DObject,
58
+ mesh = _createObject.mesh;
59
+
60
+ // ======= INIT START =======
74
61
  var resizeObserver;
75
62
  var frontModeUnInited = mode === 'front' && !state.frontMode;
76
63
  var behindModeUnInited = mode === 'behind' && !state.behindMode;
77
64
  var inited = !(frontModeUnInited || behindModeUnInited);
78
65
  var stopRenderFlag = false;
79
66
  var requestAnimationFrameId = null;
80
-
81
67
  if (behindModeUnInited) {
82
68
  state.behindMode = {
83
69
  scene: new THREE.Scene(),
84
70
  css3DRenderer: new _CSS3DRenderer.CSS3DRenderer()
85
71
  };
86
72
  }
87
-
88
73
  if (frontModeUnInited) {
89
74
  state.frontMode = {
90
75
  scene: new THREE.Scene(),
91
76
  css3DRenderer: new _CSS3DRenderer.CSS3DRenderer()
92
77
  };
93
78
  }
94
-
95
79
  var _ref = mode === 'behind' ? state.behindMode : state.frontMode,
96
- scene = _ref.scene,
97
- css3DRenderer = _ref.css3DRenderer;
98
-
80
+ scene = _ref.scene,
81
+ css3DRenderer = _ref.css3DRenderer;
99
82
  var render = function () {
100
83
  if (!inited) {
101
84
  var css3DRendererSetSize = function css3DRendererSetSize() {
@@ -109,27 +92,22 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
109
92
  });
110
93
  css3DRenderer.setSize(rendererWidth, rendererHeight);
111
94
  };
112
-
113
95
  css3DRendererSetSize();
114
96
  resizeObserver = (0, _createResizeObserver["default"])(css3DRendererSetSize, fiveElement);
115
97
  css3DRenderer.domElement.style.position = 'absolute';
116
98
  css3DRenderer.domElement.style.top = '0';
117
99
  css3DRenderer.domElement.style.userSelect = 'none';
118
100
  css3DRenderer.domElement.style.pointerEvents = 'none';
119
-
120
101
  var renderEveryFrame = function renderEveryFrame() {
121
102
  if (stopRenderFlag) return;
122
103
  requestAnimationFrameId = requestAnimationFrame(renderEveryFrame);
123
104
  css3DRenderer.render(scene, five.camera);
124
105
  };
125
-
126
106
  return function () {
127
107
  var _resizeObserver, _resizeObserver$obser;
128
-
129
108
  scene.add(css3DObject);
130
109
  (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : (_resizeObserver$obser = _resizeObserver.observe) === null || _resizeObserver$obser === void 0 ? void 0 : _resizeObserver$obser.call(_resizeObserver);
131
110
  renderEveryFrame();
132
-
133
111
  if (mode === 'behind' && mesh) {
134
112
  five.scene.add(mesh);
135
113
  disposers.push(function () {
@@ -143,18 +121,15 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
143
121
  };
144
122
  }
145
123
  }();
146
-
147
124
  if (frontModeUnInited) {
148
125
  var wrapper = fiveElement.parentElement || document.body;
149
126
  wrapper.appendChild(css3DRenderer.domElement);
150
127
  }
151
-
152
128
  if (behindModeUnInited) {
153
129
  var _wrapper = behindFiveContainer;
154
-
155
130
  _wrapper.appendChild(css3DRenderer.domElement);
156
- } // ======= INIT END =======
157
-
131
+ }
132
+ // ======= INIT END =======
158
133
 
159
134
  var dispose = function dispose() {
160
135
  stopRenderFlag = true;
@@ -163,32 +138,25 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
163
138
  });
164
139
  scene.remove(css3DObject);
165
140
  if (typeof requestAnimationFrameId === 'number') cancelAnimationFrame(requestAnimationFrameId);
166
-
167
141
  if (scene.children.length === 0) {
168
142
  css3DRenderer.domElement.remove();
169
143
  if (mode === 'front') state.frontMode = undefined;
170
144
  if (mode === 'behind') state.behindMode = undefined;
171
-
172
145
  if (!state.behindMode && !state.frontMode) {
173
146
  var _resizeObserver2, _resizeObserver2$unob;
174
-
175
147
  (_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : (_resizeObserver2$unob = _resizeObserver2.unobserve) === null || _resizeObserver2$unob === void 0 ? void 0 : _resizeObserver2$unob.call(_resizeObserver2);
176
148
  }
177
149
  }
178
-
179
150
  return true;
180
151
  };
181
-
182
152
  var idx = state.disposeCallbacks.findIndex(function (item) {
183
153
  return item === dispose;
184
154
  });
185
-
186
155
  if (idx !== -1) {
187
156
  state.disposeCallbacks.splice(idx, 1);
188
157
  } else {
189
158
  state.disposeCallbacks.push(dispose);
190
159
  }
191
-
192
160
  if (autoRender) render();
193
161
  return {
194
162
  container: container,
@@ -197,12 +165,11 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
197
165
  render: autoRender ? undefined : render
198
166
  };
199
167
  };
200
-
201
168
  var createObject = function createObject(points, config) {
202
169
  var ratio = config.ratio,
203
- dpr = config.dpr,
204
- element = config.container,
205
- mode = config.mode;
170
+ dpr = config.dpr,
171
+ element = config.container,
172
+ mode = config.mode;
206
173
  var planeWidth = points[0].distanceTo(points[1]);
207
174
  var planeHeight = points[1].distanceTo(points[2]);
208
175
  var domWidthPx = (0, _evenNumber["default"])(planeWidth / ratio * dpr);
@@ -214,10 +181,9 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
214
181
  element.style.pointerEvents = 'none';
215
182
  var centerPosition = (0, _centerPoint["default"])(points[0], points[2]);
216
183
  var vector01 = points[1].clone().sub(points[0]); // 点0 -> 点1 的向量
217
-
218
184
  var vector12 = points[2].clone().sub(points[1]); // 点1 -> 点2 的向量
219
- // 旋转
220
185
 
186
+ // 旋转
221
187
  var rotateXAngle = new THREE.Vector3(0, 1, 0).angleTo(new THREE.Vector3(0, vector12.y, vector12.z));
222
188
  var rotateYAngle = new THREE.Vector3(1, 0, 0).angleTo(new THREE.Vector3(vector01.x, 0, vector01.z));
223
189
  var rotateZAngle = vector01.angleTo(new THREE.Vector3(vector01.x, 0, vector01.z));
@@ -226,19 +192,15 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
226
192
  * [0,0,1] => [0,1,0] 为rolate Worldy正方向
227
193
  * [0,1,1] => [-1,0,0] 为rolate Worldz正方向
228
194
  */
229
-
230
195
  var rotateX = (vector12.z > 0 ? -1 : 1) * rotateXAngle;
231
196
  var rotateY = (vector01.z < 0 ? 1 : -1) * rotateYAngle;
232
197
  var rotateZ = (vector01.x > 0 && vector01.y < 0 || vector01.x < 0 && vector01.y > 0 ? -1 : 1) * rotateZAngle;
233
198
  css3DObject.rotateOnWorldAxis(new THREE.Vector3(1, 0, 0), rotateX); // x
234
-
235
199
  css3DObject.rotateOnWorldAxis(new THREE.Vector3(0, 1, 0), rotateY); // y
236
-
237
200
  css3DObject.rotateOnWorldAxis(new THREE.Vector3(0, 0, 1), rotateZ); // z
238
201
 
239
202
  css3DObject.position.set(centerPosition.x, centerPosition.y, centerPosition.z);
240
203
  var mesh;
241
-
242
204
  if (mode === 'behind') {
243
205
  var material = new THREE.MeshBasicMaterial({
244
206
  opacity: 0,
@@ -252,13 +214,11 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
252
214
  mesh.rotation.copy(css3DObject.rotation);
253
215
  mesh.scale.copy(css3DObject.scale);
254
216
  }
255
-
256
217
  return {
257
218
  css3DObject: css3DObject,
258
219
  mesh: mesh
259
220
  };
260
221
  };
261
-
262
222
  return {
263
223
  create3DDomContainer: create3DDomContainer,
264
224
  disposeAll: function disposeAll() {
@@ -269,7 +229,6 @@ var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
269
229
  }
270
230
  };
271
231
  };
272
-
273
232
  exports.CSS3DRenderPlugin = CSS3DRenderPlugin;
274
233
  var _default = CSS3DRenderPlugin;
275
234
  exports["default"] = _default;
@@ -4,15 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _three = require("three");
9
-
10
8
  var transformPositionToVector3 = function transformPositionToVector3(_ref) {
11
9
  var x = _ref.x,
12
- y = _ref.y,
13
- z = _ref.z;
10
+ y = _ref.y,
11
+ z = _ref.z;
14
12
  return new _three.Vector3(x, y, z);
15
13
  };
16
-
17
14
  var _default = transformPositionToVector3;
18
15
  exports["default"] = _default;
@@ -1,37 +1,35 @@
1
1
  "use strict";
2
2
 
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); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.CameraMovementPlugin = void 0;
7
-
8
8
  var _five = require("@realsee/five");
9
-
10
9
  var _typings = require("./typings");
11
-
12
10
  var _tween = require("../../shared-utils/animationFrame/tween");
13
-
11
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
14
12
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
15
-
16
13
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
17
-
18
14
  var PI = Math.PI;
19
15
  var PI_2 = PI * 2;
20
-
21
16
  function formatLatitude(rad) {
22
17
  return rad % PI_2;
23
18
  }
24
-
25
19
  function formatLongitude(rad) {
26
20
  return rad % PI_2;
27
21
  }
28
-
29
22
  var getLongitudeParams = function getLongitudeParams(from, to, rotation) {
30
23
  from = formatLongitude(from);
31
- to = formatLongitude(to); // 逆时针旋转,初始值必须是较大的值
24
+ to = formatLongitude(to);
25
+
26
+ // 逆时针旋转,初始值必须是较大的值
27
+ if (rotation === _typings.Rotation.Anticlockwise && from > to) to += PI_2;
32
28
 
33
- if (rotation === _typings.Rotation.Anticlockwise && from > to) to += PI_2; // 顺时针旋转,结束值必须是较大值
34
- else if (rotation === _typings.Rotation.Clockwise && to > from) from += PI_2; // Loop 旋转,找锐角旋转
29
+ // 顺时针旋转,结束值必须是较大值
30
+ else if (rotation === _typings.Rotation.Clockwise && to > from) from += PI_2;
31
+
32
+ // Loop 旋转,找锐角旋转
35
33
  // 如果 to 比 from 大 180°,逆时针转
36
34
  // 如果 from 比 to 大 180°,顺时针转
37
35
  else if (rotation !== _typings.Rotation.Anticlockwise && rotation !== _typings.Rotation.Clockwise && to - from > PI) return getLongitudeParams(from, to, _typings.Rotation.Clockwise);else if (rotation !== _typings.Rotation.Anticlockwise && rotation !== _typings.Rotation.Clockwise && from - to > PI) return getLongitudeParams(from, to, _typings.Rotation.Anticlockwise);
@@ -40,44 +38,38 @@ var getLongitudeParams = function getLongitudeParams(from, to, rotation) {
40
38
  to: to
41
39
  };
42
40
  };
43
-
44
41
  function progressNumber(from, to, pst) {
45
42
  return from + (to - from) * pst;
46
43
  }
44
+
47
45
  /**
48
46
  * **运镜插件** 模拟类似于电影运镜效果。
49
47
  */
50
-
51
-
52
48
  var CameraMovementPlugin = function CameraMovementPlugin(five) {
53
49
  var move = function move(args, duration) {
54
50
  var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
55
51
  preload: true
56
52
  };
57
53
  return new Promise( /*#__PURE__*/function () {
58
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve, reject) {
54
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
59
55
  var panoIndex, movePanoOptions;
60
- return regeneratorRuntime.wrap(function _callee$(_context) {
56
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
61
57
  while (1) {
62
58
  switch (_context.prev = _context.next) {
63
59
  case 0:
64
60
  if (opts.asyncStartCallback) {
65
61
  opts.asyncStartCallback();
66
62
  }
67
-
68
63
  if (!(five.panoIndex === undefined)) {
69
64
  _context.next = 3;
70
65
  break;
71
66
  }
72
-
73
67
  return _context.abrupt("return", reject(false));
74
-
75
68
  case 3:
76
69
  if (!(args.mode && args.mode !== five.currentMode)) {
77
70
  _context.next = 6;
78
71
  break;
79
72
  }
80
-
81
73
  _context.next = 6;
82
74
  return new Promise(function (resolve) {
83
75
  if (!args.mode) return;
@@ -95,44 +87,34 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
95
87
  panoIndex: args.panoIndex || undefined
96
88
  });
97
89
  });
98
-
99
90
  case 6:
100
91
  if (!(args.mode === _five.Five.Mode.Floorplan)) {
101
92
  _context.next = 8;
102
93
  break;
103
94
  }
104
-
105
95
  return _context.abrupt("return", resolve(true));
106
-
107
96
  case 8:
108
97
  if (!(opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
109
98
  _context.next = 11;
110
99
  break;
111
100
  }
112
-
113
101
  _context.next = 11;
114
102
  return five.preloadPano(args.panoIndex);
115
-
116
103
  case 11:
117
104
  if (opts.asyncEndCallback) {
118
105
  opts.asyncEndCallback();
119
106
  }
120
-
121
107
  if (!(args.panoIndex === undefined && args.fov === undefined && args.latitude === undefined && args.longitude === undefined)) {
122
108
  _context.next = 14;
123
109
  break;
124
110
  }
125
-
126
111
  return _context.abrupt("return", resolve(true));
127
-
128
112
  case 14:
129
113
  panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
130
-
131
114
  if (!(panoIndex !== undefined)) {
132
115
  _context.next = 21;
133
116
  break;
134
117
  }
135
-
136
118
  movePanoOptions = Object.assign(args, {
137
119
  duration: duration,
138
120
  // 移动耗时
@@ -144,18 +126,14 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
144
126
  resolve(true);
145
127
  } // 移动开始
146
128
  // effect: args.transEffect || 'fade',
147
-
148
129
  });
149
130
  _context.next = 19;
150
131
  return five.moveToPano(panoIndex, movePanoOptions);
151
-
152
132
  case 19:
153
133
  _context.next = 22;
154
134
  break;
155
-
156
135
  case 21:
157
136
  reject(false);
158
-
159
137
  case 22:
160
138
  case "end":
161
139
  return _context.stop();
@@ -163,24 +141,21 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
163
141
  }
164
142
  }, _callee);
165
143
  }));
166
-
167
144
  return function (_x, _x2) {
168
145
  return _ref.apply(this, arguments);
169
146
  };
170
147
  }());
171
148
  };
172
-
173
149
  var getAnimeParams = function getAnimeParams(args) {
174
- var currentFiveState = five.state; // latitude
175
-
150
+ var currentFiveState = five.state;
151
+ // latitude
176
152
  var fromLatitude = formatLatitude(currentFiveState.latitude);
177
- var toLatitude = formatLatitude(args.latitude); // longitude
178
-
153
+ var toLatitude = formatLatitude(args.latitude);
154
+ // longitude
179
155
  var _getLongitudeParams = getLongitudeParams(currentFiveState.longitude, args.longitude, args.rotation || _typings.Rotation.Loop),
180
- fromLongitude = _getLongitudeParams.from,
181
- toLongitude = _getLongitudeParams.to; // fov
182
-
183
-
156
+ fromLongitude = _getLongitudeParams.from,
157
+ toLongitude = _getLongitudeParams.to;
158
+ // fov
184
159
  var fromFov = currentFiveState.fov;
185
160
  var toFov = args.fov;
186
161
  return {
@@ -196,48 +171,40 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
196
171
  }
197
172
  };
198
173
  };
199
-
200
174
  var rotate = /*#__PURE__*/function () {
201
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(args, duration) {
175
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(args, duration) {
202
176
  var opts,
203
- _getAnimeParams,
204
- from,
205
- to,
206
- _args2 = arguments;
207
-
208
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
177
+ _getAnimeParams,
178
+ from,
179
+ to,
180
+ _args2 = arguments;
181
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
209
182
  while (1) {
210
183
  switch (_context2.prev = _context2.next) {
211
184
  case 0:
212
185
  opts = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
213
-
214
186
  if (opts.asyncStartCallback) {
215
187
  opts.asyncStartCallback();
216
- } // 先切换模型再出旋转效果
217
-
188
+ }
218
189
 
190
+ // 先切换模型再出旋转效果
219
191
  if (!(args.mode && five.currentMode !== args.mode)) {
220
192
  _context2.next = 5;
221
193
  break;
222
194
  }
223
-
224
195
  _context2.next = 5;
225
196
  return five.changeMode(args.mode);
226
-
227
197
  case 5:
228
198
  if (!(args.mode === _five.Five.Mode.Panorama && five.currentMode === _five.Five.Mode.Panorama && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
229
199
  _context2.next = 11;
230
200
  break;
231
201
  }
232
-
233
202
  if (!opts.preload) {
234
203
  _context2.next = 9;
235
204
  break;
236
205
  }
237
-
238
206
  _context2.next = 9;
239
207
  return five.preloadPano(args.panoIndex);
240
-
241
208
  case 9:
242
209
  _context2.next = 11;
243
210
  return new Promise(function (resolve, reject) {
@@ -253,12 +220,10 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
253
220
  effect: 'fade'
254
221
  });
255
222
  });
256
-
257
223
  case 11:
258
224
  if (opts.asyncEndCallback) {
259
225
  opts.asyncEndCallback();
260
226
  }
261
-
262
227
  _getAnimeParams = getAnimeParams(args), from = _getAnimeParams.from, to = _getAnimeParams.to;
263
228
  _context2.next = 15;
264
229
  return new Promise(function (resolve, reject) {
@@ -270,37 +235,28 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
270
235
  state.fov = progressNumber(from.fov, to.fov, progress);
271
236
  five.setState(state, true);
272
237
  };
273
-
274
238
  var onComplete = function onComplete() {
275
239
  resolve(true);
276
240
  };
277
-
278
241
  var onDestroy = function onDestroy() {
279
242
  resolve(false);
280
243
  };
281
-
282
244
  var animeDuration = duration;
283
-
284
245
  if (args.rotation === _typings.Rotation.Loop) {
285
246
  animeDuration = args.rotateSpeed ? Math.ceil(Math.abs(to.longitude - from.longitude) / args.rotateSpeed * 1000) : duration;
286
247
  }
287
-
288
248
  var tween = (0, _tween.tweenProgress)(animeDuration, _tween.Easing.Linear.None).onUpdate(onUpdate).onComplete(onComplete).onDestroy(onDestroy);
289
-
290
249
  if (args.rotation === _typings.Rotation.Loop) {
291
250
  tween.repeat(Infinity).yoyo(true);
292
251
  }
293
-
294
252
  setTimeout(function () {
295
253
  // 总时间到了之后强制结束,同时也是 Loop 模式的结束方式
296
254
  tween.destroy();
297
255
  resolve(true);
298
256
  }, duration);
299
257
  });
300
-
301
258
  case 15:
302
259
  return _context2.abrupt("return", _context2.sent);
303
-
304
260
  case 16:
305
261
  case "end":
306
262
  return _context2.stop();
@@ -308,16 +264,13 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
308
264
  }
309
265
  }, _callee2);
310
266
  }));
311
-
312
267
  return function rotate(_x3, _x4) {
313
268
  return _ref2.apply(this, arguments);
314
269
  };
315
270
  }();
316
-
317
271
  return {
318
272
  move: move,
319
273
  rotate: rotate
320
274
  };
321
275
  };
322
-
323
276
  exports.CameraMovementPlugin = CameraMovementPlugin;
@@ -4,20 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Rotation = exports.CameraMovementEffect = void 0;
7
-
8
7
  /* eslint-disable prettier/prettier */
9
8
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
10
9
  var CameraMovementEffect;
11
10
  exports.CameraMovementEffect = CameraMovementEffect;
12
-
13
11
  (function (CameraMovementEffect) {
14
12
  CameraMovementEffect["Move"] = "Move";
15
13
  CameraMovementEffect["Rotate"] = "Rotate";
16
14
  })(CameraMovementEffect || (exports.CameraMovementEffect = CameraMovementEffect = {}));
17
-
18
15
  var Rotation;
19
16
  exports.Rotation = Rotation;
20
-
21
17
  (function (Rotation) {
22
18
  Rotation["Clockwise"] = "Clockwise";
23
19
  Rotation["Anticlockwise"] = "Anticlockwise";