@realsee/vreo 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/PlayController/createHTMLAudioElement.js +12 -22
- package/lib/PlayController/index.js +70 -137
- package/lib/Player/App.d.ts +2 -2
- package/lib/Player/App.js +1 -28
- package/lib/Player/Controller.d.ts +3 -3
- package/lib/Player/Controller.js +46 -110
- package/lib/Player/custom/SpatialScenePanel/index.d.ts +2 -2
- package/lib/Player/custom/SpatialScenePanel/index.js +75 -72
- package/lib/Player/hooks.d.ts +3 -3
- package/lib/Player/hooks.js +0 -10
- package/lib/Player/index.js +109 -175
- package/lib/Player/modules/Drawer/index.d.ts +2 -2
- package/lib/Player/modules/Drawer/index.js +2 -21
- package/lib/Player/modules/PopUp/index.d.ts +2 -2
- package/lib/Player/modules/PopUp/index.js +1 -12
- package/lib/Player/modules/ResizeObserver/index.d.ts +2 -2
- package/lib/Player/modules/ResizeObserver/index.js +0 -8
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +1 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +148 -247
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +7 -23
- package/lib/Player/modules/VideoAgent/index.d.ts +2 -2
- package/lib/Player/modules/VideoAgent/index.js +2 -20
- package/lib/Player/modules/Wave/index.d.ts +2 -2
- package/lib/Player/modules/Wave/index.js +12 -34
- package/lib/Player/modules/keyframes/BgMusic/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/BgMusic/index.js +41 -64
- package/lib/Player/modules/keyframes/CameraMovement/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/CameraMovement/index.js +42 -71
- package/lib/Player/modules/keyframes/InfoPanel/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/InfoPanel/index.js +16 -47
- package/lib/Player/modules/keyframes/ModelVideo/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/ModelVideo/index.js +52 -83
- package/lib/Player/modules/keyframes/PanoEffect/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/PanoEffect/index.js +16 -40
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -9
- package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -1
- package/lib/Player/modules/keyframes/PanoTag/index.js +6 -25
- package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +31 -50
- package/lib/Player/modules/keyframes/Prompter/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/Prompter/index.js +11 -29
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +25 -29
- package/lib/Player/modules/keyframes/VideoEffect/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/VideoEffect/index.js +52 -87
- package/lib/Player/typings.d.ts +7 -4
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +1 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +42 -81
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +3 -7
- package/lib/fivePlugins/CameraMovementPlugin/index.js +181 -241
- package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +4 -4
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -12
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +37 -87
- package/lib/index.js +0 -1
- package/lib/react/index.d.ts +2 -1
- package/lib/react/index.js +10 -35
- package/lib/shared-utils/Audio.js +57 -106
- package/lib/shared-utils/AudioLike.d.ts +1 -1
- package/lib/shared-utils/AudioLike.js +19 -46
- package/lib/shared-utils/Preloader.js +2 -10
- package/lib/shared-utils/addResizeListener.d.ts +1 -1
- package/lib/shared-utils/addResizeListener.js +0 -5
- package/lib/shared-utils/animationFrame/BetterTween.d.ts +1 -1
- package/lib/shared-utils/animationFrame/BetterTween.js +14 -45
- package/lib/shared-utils/animationFrame/index.d.ts +1 -2
- package/lib/shared-utils/animationFrame/index.js +3 -12
- package/lib/shared-utils/animationFrame/tween.d.ts +2 -2
- package/lib/shared-utils/animationFrame/tween.js +3 -14
- package/lib/shared-utils/createTransMatrix.js +1 -10
- package/lib/shared-utils/getFileExpandedName.js +0 -1
- package/lib/shared-utils/getMediaInfo.d.ts +3 -3
- package/lib/shared-utils/getMediaInfo.js +0 -10
- package/lib/shared-utils/setElementDataset.js +0 -2
- package/lib/typings/VreoUnit.d.ts +16 -16
- package/lib/typings/VreoUnit.js +115 -47
- package/package.json +3 -2
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.CameraMovementPlugin = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _five = require("@realsee/five");
|
|
15
|
-
|
|
16
11
|
var _typings = require("./typings");
|
|
17
|
-
|
|
18
12
|
var PI = Math.PI;
|
|
19
13
|
var PI_2 = PI * 2;
|
|
20
14
|
var moving = false; // five 6 神秘bug, move 的时候不能 setState
|
|
@@ -23,7 +17,6 @@ function progressNumber(from, to, pst) {
|
|
|
23
17
|
if (from === to) return from;
|
|
24
18
|
return from + (to - from) * pst;
|
|
25
19
|
}
|
|
26
|
-
|
|
27
20
|
function progressLongitude(fromLongitude, toLongitude, rotation, progress) {
|
|
28
21
|
var clockwise = rotation === _typings.Rotation.Clockwise;
|
|
29
22
|
var delta = clockwise ? fromLongitude - toLongitude : toLongitude - fromLongitude;
|
|
@@ -33,276 +26,223 @@ function progressLongitude(fromLongitude, toLongitude, rotation, progress) {
|
|
|
33
26
|
var progressLongitude = fromLongitude + deltaMod3 * progress;
|
|
34
27
|
return progressLongitude % PI_2;
|
|
35
28
|
}
|
|
29
|
+
|
|
36
30
|
/**
|
|
37
31
|
* **运镜插件** 模拟类似于电影运镜效果。
|
|
38
32
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var CameraMovementPlugin = function CameraMovementPlugin(five) {
|
|
33
|
+
var CameraMovementPlugin = exports.CameraMovementPlugin = function CameraMovementPlugin(five) {
|
|
42
34
|
var move = function move(args, duration) {
|
|
43
35
|
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
44
36
|
preload: true
|
|
45
37
|
};
|
|
46
|
-
return new Promise(
|
|
47
|
-
var _ref = (0, _asyncToGenerator2["default"])(
|
|
38
|
+
return new Promise(/*#__PURE__*/function () {
|
|
39
|
+
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(resolve, reject) {
|
|
48
40
|
var _opts$asyncEndCallbac;
|
|
49
|
-
|
|
50
41
|
var panoIndex, start, movePanoOptions;
|
|
51
42
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
52
|
-
while (1) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
_context.next =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
case 8:
|
|
81
|
-
if (!(args.mode === _five.Five.Mode.Floorplan)) {
|
|
82
|
-
_context.next = 10;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return _context.abrupt("return", resolve(true));
|
|
87
|
-
|
|
88
|
-
case 10:
|
|
89
|
-
if (!(opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
|
|
90
|
-
_context.next = 13;
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
|
|
43
|
+
while (1) switch (_context.prev = _context.next) {
|
|
44
|
+
case 0:
|
|
45
|
+
moving = true;
|
|
46
|
+
if (opts.asyncStartCallback) {
|
|
47
|
+
opts.asyncStartCallback();
|
|
48
|
+
}
|
|
49
|
+
if (!(five.panoIndex === undefined)) {
|
|
50
|
+
_context.next = 4;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
return _context.abrupt("return", reject(false));
|
|
54
|
+
case 4:
|
|
55
|
+
if (!(args.mode && args.mode !== five.currentMode)) {
|
|
56
|
+
_context.next = 8;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
_context.next = 7;
|
|
60
|
+
return five.changeMode(args.mode, args, duration);
|
|
61
|
+
case 7:
|
|
62
|
+
return _context.abrupt("return", resolve(true));
|
|
63
|
+
case 8:
|
|
64
|
+
if (!(args.mode === _five.Five.Mode.Floorplan)) {
|
|
65
|
+
_context.next = 10;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
return _context.abrupt("return", resolve(true));
|
|
69
|
+
case 10:
|
|
70
|
+
if (!(opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
|
|
94
71
|
_context.next = 13;
|
|
95
|
-
return five.preloadPano(args.panoIndex);
|
|
96
|
-
|
|
97
|
-
case 13:
|
|
98
|
-
(_opts$asyncEndCallbac = opts.asyncEndCallback) === null || _opts$asyncEndCallbac === void 0 ? void 0 : _opts$asyncEndCallbac.call(opts);
|
|
99
|
-
|
|
100
|
-
if (!(args.panoIndex === undefined && args.fov === undefined && args.latitude === undefined && args.longitude === undefined)) {
|
|
101
|
-
_context.next = 16;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return _context.abrupt("return", resolve(true));
|
|
106
|
-
|
|
107
|
-
case 16:
|
|
108
|
-
panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
|
|
109
|
-
|
|
110
|
-
if (!(panoIndex !== undefined)) {
|
|
111
|
-
_context.next = 26;
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
start = performance.now();
|
|
116
|
-
_context.next = 21;
|
|
117
|
-
return five.ready();
|
|
118
|
-
|
|
119
|
-
case 21:
|
|
120
|
-
movePanoOptions = Object.assign({}, args, {
|
|
121
|
-
duration: duration - (performance.now() - start),
|
|
122
|
-
// 移动耗时
|
|
123
|
-
moveEndCallback: function moveEndCallback() {
|
|
124
|
-
return resolve(true);
|
|
125
|
-
},
|
|
126
|
-
// 移动结束
|
|
127
|
-
moveCancelCallback: function moveCancelCallback() {
|
|
128
|
-
resolve(true);
|
|
129
|
-
},
|
|
130
|
-
// 移动开始
|
|
131
|
-
effect: args.transEffect || 'fly'
|
|
132
|
-
});
|
|
133
|
-
_context.next = 24;
|
|
134
|
-
return five.moveToPano(panoIndex, movePanoOptions);
|
|
135
|
-
|
|
136
|
-
case 24:
|
|
137
|
-
_context.next = 27;
|
|
138
72
|
break;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
73
|
+
}
|
|
74
|
+
_context.next = 13;
|
|
75
|
+
return five.preloadPano(args.panoIndex);
|
|
76
|
+
case 13:
|
|
77
|
+
(_opts$asyncEndCallbac = opts.asyncEndCallback) === null || _opts$asyncEndCallbac === void 0 || _opts$asyncEndCallbac.call(opts);
|
|
78
|
+
if (!(args.panoIndex === undefined && args.fov === undefined && args.latitude === undefined && args.longitude === undefined)) {
|
|
79
|
+
_context.next = 16;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
return _context.abrupt("return", resolve(true));
|
|
83
|
+
case 16:
|
|
84
|
+
panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
|
|
85
|
+
if (!(panoIndex !== undefined)) {
|
|
86
|
+
_context.next = 26;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
start = performance.now();
|
|
90
|
+
_context.next = 21;
|
|
91
|
+
return five.ready();
|
|
92
|
+
case 21:
|
|
93
|
+
movePanoOptions = Object.assign({}, args, {
|
|
94
|
+
duration: duration - (performance.now() - start),
|
|
95
|
+
// 移动耗时
|
|
96
|
+
moveEndCallback: function moveEndCallback() {
|
|
97
|
+
return resolve(true);
|
|
98
|
+
},
|
|
99
|
+
// 移动结束
|
|
100
|
+
moveCancelCallback: function moveCancelCallback() {
|
|
101
|
+
resolve(true);
|
|
102
|
+
},
|
|
103
|
+
// 移动开始
|
|
104
|
+
effect: args.transEffect || 'fly'
|
|
105
|
+
});
|
|
106
|
+
_context.next = 24;
|
|
107
|
+
return five.moveToPano(panoIndex, movePanoOptions);
|
|
108
|
+
case 24:
|
|
109
|
+
_context.next = 27;
|
|
110
|
+
break;
|
|
111
|
+
case 26:
|
|
112
|
+
reject(false);
|
|
113
|
+
case 27:
|
|
114
|
+
case "end":
|
|
115
|
+
return _context.stop();
|
|
147
116
|
}
|
|
148
117
|
}, _callee);
|
|
149
118
|
}));
|
|
150
|
-
|
|
151
119
|
return function (_x, _x2) {
|
|
152
120
|
return _ref.apply(this, arguments);
|
|
153
121
|
};
|
|
154
122
|
}());
|
|
155
123
|
};
|
|
156
|
-
|
|
157
124
|
var rotate = /*#__PURE__*/function () {
|
|
158
|
-
var _ref2 = (0, _asyncToGenerator2["default"])(
|
|
125
|
+
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(args, duration) {
|
|
159
126
|
var _opts$asyncStartCallb, _opts$asyncEndCallbac2;
|
|
160
|
-
|
|
161
127
|
var opts,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
128
|
+
from,
|
|
129
|
+
to,
|
|
130
|
+
timeEnd,
|
|
131
|
+
start,
|
|
132
|
+
animeDuration,
|
|
133
|
+
_onFiveRenderFrame,
|
|
134
|
+
_args2 = arguments;
|
|
169
135
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
170
|
-
while (1) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
_context2.next = 6;
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
|
|
136
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
137
|
+
case 0:
|
|
138
|
+
opts = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
|
|
139
|
+
moving = false;
|
|
140
|
+
(_opts$asyncStartCallb = opts.asyncStartCallback) === null || _opts$asyncStartCallb === void 0 || _opts$asyncStartCallb.call(opts);
|
|
141
|
+
|
|
142
|
+
// 先切换模型再出旋转效果
|
|
143
|
+
if (!(args.mode && five.currentMode !== args.mode)) {
|
|
182
144
|
_context2.next = 6;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (!opts.preload) {
|
|
194
|
-
_context2.next = 10;
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
_context2.next = 10;
|
|
199
|
-
return five.preloadPano(args.panoIndex);
|
|
200
|
-
|
|
201
|
-
case 10:
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
_context2.next = 6;
|
|
148
|
+
return five.changeMode(args.mode, args.mode === _five.Five.Mode.Panorama ? {
|
|
149
|
+
latitude: 0
|
|
150
|
+
} : undefined);
|
|
151
|
+
case 6:
|
|
152
|
+
if (!(args.mode === _five.Five.Mode.Panorama && five.currentMode === _five.Five.Mode.Panorama && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
|
|
202
153
|
_context2.next = 12;
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
if (!opts.preload) {
|
|
157
|
+
_context2.next = 10;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
_context2.next = 10;
|
|
161
|
+
return five.preloadPano(args.panoIndex);
|
|
162
|
+
case 10:
|
|
163
|
+
_context2.next = 12;
|
|
164
|
+
return new Promise(function (resolve, reject) {
|
|
165
|
+
five.moveToPano(args.panoIndex, {
|
|
166
|
+
moveEndCallback: function moveEndCallback() {
|
|
167
|
+
return resolve(true);
|
|
168
|
+
},
|
|
169
|
+
// 移动结束
|
|
170
|
+
moveCancelCallback: function moveCancelCallback() {
|
|
171
|
+
return reject(false);
|
|
172
|
+
},
|
|
173
|
+
// 移动开始
|
|
174
|
+
effect: 'fade'
|
|
215
175
|
});
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
animeDuration = duration;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
176
|
+
});
|
|
177
|
+
case 12:
|
|
178
|
+
_context2.next = 14;
|
|
179
|
+
return five.ready();
|
|
180
|
+
case 14:
|
|
181
|
+
(_opts$asyncEndCallbac2 = opts.asyncEndCallback) === null || _opts$asyncEndCallbac2 === void 0 || _opts$asyncEndCallbac2.call(opts);
|
|
182
|
+
|
|
183
|
+
// 计算to
|
|
184
|
+
from = five.getCurrentState();
|
|
185
|
+
to = function () {
|
|
186
|
+
return args;
|
|
187
|
+
}();
|
|
188
|
+
timeEnd = false; // 开始时间
|
|
189
|
+
start = performance.now();
|
|
190
|
+
animeDuration = duration;
|
|
191
|
+
if (args.rotation === _typings.Rotation.Loop) {
|
|
192
|
+
animeDuration = args.rotateSpeed ? Math.ceil(Math.abs(to.longitude - from.longitude) / args.rotateSpeed * 1000) : duration;
|
|
193
|
+
animeDuration = Math.min(duration, animeDuration);
|
|
194
|
+
}
|
|
195
|
+
_onFiveRenderFrame = function onFiveRenderFrame() {
|
|
196
|
+
if (timeEnd || moving) {
|
|
197
|
+
five.off('renderFrame', _onFiveRenderFrame);
|
|
198
|
+
return;
|
|
238
199
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
_context2.next = 25;
|
|
277
|
-
return new Promise(function (resolve) {
|
|
278
|
-
setTimeout(function () {
|
|
279
|
-
timeEnd = true;
|
|
280
|
-
five.off('renderFrame', onFiveRenderFrame); // 总时间到了之后强制结束,同时也是 Loop 模式的结束方式
|
|
281
|
-
|
|
282
|
-
resolve(true);
|
|
283
|
-
}, duration);
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
case 25:
|
|
287
|
-
return _context2.abrupt("return", _context2.sent);
|
|
288
|
-
|
|
289
|
-
case 26:
|
|
290
|
-
case "end":
|
|
291
|
-
return _context2.stop();
|
|
292
|
-
}
|
|
200
|
+
var targetState = {};
|
|
201
|
+
if (args.rotation !== _typings.Rotation.Loop) {
|
|
202
|
+
var progress = (performance.now() - start) / duration;
|
|
203
|
+
targetState = {
|
|
204
|
+
fov: progressNumber(from.fov, to.fov, progress),
|
|
205
|
+
latitude: progressNumber(from.latitude, to.latitude, progress),
|
|
206
|
+
longitude: progressLongitude(from.longitude, to.longitude, args.rotation, progress)
|
|
207
|
+
};
|
|
208
|
+
} else {
|
|
209
|
+
var _progress = (performance.now() - start) / animeDuration; // 可能大于1
|
|
210
|
+
var times = Math.floor(_progress);
|
|
211
|
+
var progress2 = _progress - times; // 一定小于1
|
|
212
|
+
var isNegative = times % 2 === 1; // 是否为反向旋转, 0: 正, 1: 反, 2: 正, 3: 反 以此类推
|
|
213
|
+
var resultProgress = isNegative ? 1 - progress2 : progress2;
|
|
214
|
+
targetState = {
|
|
215
|
+
fov: progressNumber(from.fov, to.fov, resultProgress),
|
|
216
|
+
latitude: progressNumber(from.latitude, to.latitude, resultProgress),
|
|
217
|
+
longitude: progressNumber(from.longitude, to.longitude, resultProgress)
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
five.setState(targetState, true);
|
|
221
|
+
};
|
|
222
|
+
five.on('renderFrame', _onFiveRenderFrame);
|
|
223
|
+
_context2.next = 25;
|
|
224
|
+
return new Promise(function (resolve) {
|
|
225
|
+
setTimeout(function () {
|
|
226
|
+
timeEnd = true;
|
|
227
|
+
five.off('renderFrame', _onFiveRenderFrame);
|
|
228
|
+
// 总时间到了之后强制结束,同时也是 Loop 模式的结束方式
|
|
229
|
+
resolve(true);
|
|
230
|
+
}, duration);
|
|
231
|
+
});
|
|
232
|
+
case 25:
|
|
233
|
+
return _context2.abrupt("return", _context2.sent);
|
|
234
|
+
case 26:
|
|
235
|
+
case "end":
|
|
236
|
+
return _context2.stop();
|
|
293
237
|
}
|
|
294
238
|
}, _callee2);
|
|
295
239
|
}));
|
|
296
|
-
|
|
297
240
|
return function rotate(_x3, _x4) {
|
|
298
241
|
return _ref2.apply(this, arguments);
|
|
299
242
|
};
|
|
300
243
|
}();
|
|
301
|
-
|
|
302
244
|
return {
|
|
303
245
|
move: move,
|
|
304
246
|
rotate: rotate
|
|
305
247
|
};
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
exports.CameraMovementPlugin = CameraMovementPlugin;
|
|
248
|
+
};
|
|
@@ -30,21 +30,21 @@ export interface CameraMovementOptsCallback {
|
|
|
30
30
|
asyncStartCallback?: () => void;
|
|
31
31
|
asyncEndCallback?: () => void;
|
|
32
32
|
}
|
|
33
|
-
export
|
|
33
|
+
export type MoveArgs = {
|
|
34
34
|
mode: Mode;
|
|
35
35
|
panoIndex: number;
|
|
36
36
|
transEffect?: "fly" | "fade" | "instant";
|
|
37
37
|
} & Pose;
|
|
38
|
-
export
|
|
38
|
+
export type MoveOpts = {
|
|
39
39
|
preload?: boolean;
|
|
40
40
|
} & CameraMovementOptsCallback;
|
|
41
|
-
export
|
|
41
|
+
export type RotateArgs = {
|
|
42
42
|
mode?: Mode;
|
|
43
43
|
panoIndex: number;
|
|
44
44
|
loop: boolean;
|
|
45
45
|
rotateSpeed: number;
|
|
46
46
|
rotation: Rotation;
|
|
47
47
|
} & Pose;
|
|
48
|
-
export
|
|
48
|
+
export type RotateOpts = {
|
|
49
49
|
preload?: boolean;
|
|
50
50
|
} & CameraMovementOptsCallback;
|
|
@@ -4,22 +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
|
-
var CameraMovementEffect
|
|
11
|
-
exports.CameraMovementEffect = CameraMovementEffect;
|
|
12
|
-
|
|
13
|
-
(function (CameraMovementEffect) {
|
|
9
|
+
var CameraMovementEffect = exports.CameraMovementEffect = /*#__PURE__*/function (CameraMovementEffect) {
|
|
14
10
|
CameraMovementEffect["Move"] = "Move";
|
|
15
11
|
CameraMovementEffect["Rotate"] = "Rotate";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var Rotation
|
|
19
|
-
exports.Rotation = Rotation;
|
|
20
|
-
|
|
21
|
-
(function (Rotation) {
|
|
12
|
+
return CameraMovementEffect;
|
|
13
|
+
}({});
|
|
14
|
+
var Rotation = exports.Rotation = /*#__PURE__*/function (Rotation) {
|
|
22
15
|
Rotation["Clockwise"] = "Clockwise";
|
|
23
16
|
Rotation["Anticlockwise"] = "Anticlockwise";
|
|
24
17
|
Rotation["Loop"] = "Loop";
|
|
25
|
-
|
|
18
|
+
return Rotation;
|
|
19
|
+
}({});
|