@realsee/vreo 1.2.1-alpha.3 → 2.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,38 +1,42 @@
1
1
  # CHANGELOG
2
- #1.0.0-alpha.21
2
+ # 2.0.0
3
+ - fix: 重新实现了运镜功能,修复了运镜掉帧的问题
4
+ - break-change:修复了模型态切换全景态时的目标点位为0时,有可能不会真正移动到目标位置的问题。该问题的修复会导致之前的一些基于此bug制作的导览出现问题,需要重新制作。
5
+
6
+ # 1.0.0-alpha.21
3
7
  - fix: 多段BgMusic播放问题
4
8
 
5
- #1.0.0-alpha.19
9
+ # 1.0.0-alpha.19
6
10
  - fix: 多段BgMusic可以重复播放
7
11
 
8
- #1.0.0-alpha.18
12
+ # 1.0.0-alpha.18
9
13
  - fix: 修复无音频版本中途播放会从头开始的问题
10
14
 
11
- #1.0.0-alpha.1
15
+ # 1.0.0-alpha.1
12
16
  - feat: css样式适配: 手机横竖屏, pad, pc
13
17
  - feat: 新增两种波浪风格: 'wave' | 'solid'
14
18
  - feat: 标签调用dna插件
15
19
  - fix: 图片/视频 弹窗UI问题
16
20
 
17
- #0.2.0-alpha.25
21
+ # 0.2.0-alpha.25
18
22
  - feat: rotate 不指定顺时针或者逆时针,则按照锐角交互。
19
23
 
20
- #0.2.0-alpha.24
24
+ # 0.2.0-alpha.24
21
25
  - fix: 修复 CSS3DRender 与插件库样式冲突问题。
22
26
  - fix: 修复示例 wrapper 定位问题。
23
27
 
24
- #0.2.0-alpha.23
28
+ # 0.2.0-alpha.23
25
29
  - fix: 修复21版本针对非旋转运镜使用了旋转速度问题修复的代码丢失问题。
26
30
 
27
- #0.2.0-alpha.22
31
+ # 0.2.0-alpha.22
28
32
  - fix: 修复运镜顺时针逆时针反向问题。
29
33
 
30
- #0.2.0-alpha.21
34
+ # 0.2.0-alpha.21
31
35
  - fix: 修复非旋转运镜使用了旋转速度问题。
32
36
 
33
- #0.2.0-alpha.20
37
+ # 0.2.0-alpha.20
34
38
  - fix: 修复 `paused` 事件抛出 `ended` 回调带来的重复抛出事件问题。
35
39
 
36
- #0.2.0-alpha.19
40
+ # 0.2.0-alpha.19
37
41
  - feat: 新增 `getCurrentTime()` 方法,支持实时获取当前播放时间点;
38
42
  - feat: 新增 `ended` 标识,当检测到 video 实例 `ended` 以后会在 `paused` 事件里抛出 `true` 回调。
@@ -34,7 +34,7 @@ function BgMusic() {
34
34
  case 4:
35
35
  audio = (0, _Audio.getAudio)(keyframe.data.url);
36
36
  audio.currentTime = Math.max(0, _currentTime);
37
- console.log('play', audio.src);
37
+ // console.log('play', audio.src)
38
38
  // const play = () => audio.play()
39
39
 
40
40
  audio.play();
@@ -51,7 +51,7 @@ function BgMusic() {
51
51
  controller.once('paused', function () {
52
52
  cleanAudio();
53
53
  });
54
- case 11:
54
+ case 10:
55
55
  case "end":
56
56
  return _context.stop();
57
57
  }
@@ -29,15 +29,10 @@ function InfoPanelImg(_ref) {
29
29
  return /*#__PURE__*/React.createElement("div", {
30
30
  className: "vreo-infoPanel-container"
31
31
  }, /*#__PURE__*/React.createElement("div", {
32
- className: "vreo-infoPanel vreo-infoPanel--img"
33
- }, /*#__PURE__*/React.createElement("div", {
34
- className: "ratio-4-5 vreo-infoPanel-wrapper"
35
- }, /*#__PURE__*/React.createElement("div", {
36
- className: "vreo-infoPanel-inner"
32
+ className: "vreo-infoPanel"
37
33
  }, children, /*#__PURE__*/React.createElement("img", {
38
- className: "vreo-infoPanelImg",
39
34
  src: url
40
- })))));
35
+ })));
41
36
  }
42
37
  function InfoPanelVideo(_ref2) {
43
38
  var url = _ref2.url,
@@ -55,28 +50,21 @@ function InfoPanelVideo(_ref2) {
55
50
  return /*#__PURE__*/React.createElement("div", {
56
51
  className: "vreo-infoPanel-container"
57
52
  }, /*#__PURE__*/React.createElement("div", {
58
- className: "vreo-infoPanel vreo-infoPanel--video"
59
- }, /*#__PURE__*/React.createElement("div", {
60
- className: "ratio-4-5 vreo-infoPanel-wrapper"
61
- }, /*#__PURE__*/React.createElement("div", {
62
- className: "vreo-infoPanel-inner"
53
+ className: "vreo-infoPanel"
63
54
  }, children, /*#__PURE__*/React.createElement("div", {
64
- className: "vreo-infoPanelVideo",
55
+ className: "vreo-infoPanel-inner",
65
56
  ref: videoWrapperRef
66
57
  }, !isWX && /*#__PURE__*/React.createElement("video", {
67
58
  playsInline: true,
68
59
  autoPlay: true,
69
- className: "vreo-infoPanelVideo",
70
60
  src: url
71
- }))))));
61
+ }))));
72
62
  }
73
63
  var Title = function Title(props) {
74
64
  if (!props.title && !props.subTitle) {
75
65
  return null;
76
66
  }
77
67
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
78
- className: "vreo-infoPanel-title-shadow"
79
- }), /*#__PURE__*/React.createElement("div", {
80
68
  className: "vreo-infoPanel-title"
81
69
  }, /*#__PURE__*/React.createElement("div", {
82
70
  className: "vreo-infoPanel-t1"
@@ -6,42 +6,25 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.CameraMovementPlugin = void 0;
8
8
  var _five = require("@realsee/five");
9
- var _tween = require("@tweenjs/tween.js");
10
9
  var _typings = require("./typings");
11
- var _tween2 = require("../../shared-utils/animationFrame/tween");
12
10
  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; }
13
11
  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); } }
14
12
  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); }); }; }
15
13
  var PI = Math.PI;
16
14
  var PI_2 = PI * 2;
17
- function formatLatitude(rad) {
18
- return rad % PI_2;
19
- }
20
- function formatLongitude(rad) {
21
- return rad % PI_2;
22
- }
23
- var getLongitudeParams = function getLongitudeParams(from, to, rotation) {
24
- from = formatLongitude(from);
25
- to = formatLongitude(to);
26
-
27
- // 逆时针旋转,初始值必须是较大的值
28
- if (rotation === _typings.Rotation.Anticlockwise && from > to) to += PI_2;
29
-
30
- // 顺时针旋转,结束值必须是较大值
31
- else if (rotation === _typings.Rotation.Clockwise && to > from) from += PI_2;
32
-
33
- // Loop 旋转,找锐角旋转
34
- // 如果 to 比 from 大 180°,逆时针转
35
- // 如果 from 比 to 大 180°,顺时针转
36
- 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);
37
- return {
38
- from: from,
39
- to: to
40
- };
41
- };
42
15
  function progressNumber(from, to, pst) {
16
+ if (from === to) return from;
43
17
  return from + (to - from) * pst;
44
18
  }
19
+ function progressLongitude(fromLongitude, toLongitude, rotation, progress) {
20
+ var clockwise = rotation === _typings.Rotation.Clockwise;
21
+ var delta = clockwise ? fromLongitude - toLongitude : toLongitude - fromLongitude;
22
+ var deltaMod = delta % PI_2;
23
+ var deltaMod2 = deltaMod < 0 ? deltaMod + PI_2 : deltaMod;
24
+ var deltaMod3 = clockwise ? -deltaMod2 : deltaMod2;
25
+ var progressLongitude = fromLongitude + deltaMod3 * progress;
26
+ return progressLongitude % PI_2;
27
+ }
45
28
 
46
29
  /**
47
30
  * **运镜插件** 模拟类似于电影运镜效果。
@@ -53,7 +36,8 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
53
36
  };
54
37
  return new Promise( /*#__PURE__*/function () {
55
38
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
56
- var panoIndex, movePanoOptions;
39
+ var _opts$asyncEndCallbac;
40
+ var panoIndex, start, movePanoOptions;
57
41
  return _regeneratorRuntime().wrap(function _callee$(_context) {
58
42
  while (1) {
59
43
  switch (_context.prev = _context.next) {
@@ -68,56 +52,45 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
68
52
  return _context.abrupt("return", reject(false));
69
53
  case 3:
70
54
  if (!(args.mode && args.mode !== five.currentMode)) {
71
- _context.next = 6;
55
+ _context.next = 7;
72
56
  break;
73
57
  }
74
58
  _context.next = 6;
75
- return new Promise(function (resolve) {
76
- if (!args.mode) return;
77
- five.once('modeChange', function (mode) {
78
- five.once('initAnimationEnded', function () {
79
- if (mode === args.mode) {
80
- resolve(true);
81
- }
82
- });
83
- });
84
- five.changeMode(args.mode, {
85
- fov: args.fov || undefined,
86
- latitude: args.latitude || undefined,
87
- longitude: args.longitude || undefined,
88
- panoIndex: args.panoIndex || undefined
89
- });
90
- });
59
+ return five.changeMode(args.mode, args, duration);
91
60
  case 6:
61
+ return _context.abrupt("return", resolve(true));
62
+ case 7:
92
63
  if (!(args.mode === _five.Five.Mode.Floorplan)) {
93
- _context.next = 8;
64
+ _context.next = 9;
94
65
  break;
95
66
  }
96
67
  return _context.abrupt("return", resolve(true));
97
- case 8:
68
+ case 9:
98
69
  if (!(opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
99
- _context.next = 11;
70
+ _context.next = 12;
100
71
  break;
101
72
  }
102
- _context.next = 11;
73
+ _context.next = 12;
103
74
  return five.preloadPano(args.panoIndex);
104
- case 11:
105
- if (opts.asyncEndCallback) {
106
- opts.asyncEndCallback();
107
- }
75
+ case 12:
76
+ (_opts$asyncEndCallbac = opts.asyncEndCallback) === null || _opts$asyncEndCallbac === void 0 ? void 0 : _opts$asyncEndCallbac.call(opts);
108
77
  if (!(args.panoIndex === undefined && args.fov === undefined && args.latitude === undefined && args.longitude === undefined)) {
109
- _context.next = 14;
78
+ _context.next = 15;
110
79
  break;
111
80
  }
112
81
  return _context.abrupt("return", resolve(true));
113
- case 14:
82
+ case 15:
114
83
  panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
115
84
  if (!(panoIndex !== undefined)) {
116
- _context.next = 21;
85
+ _context.next = 25;
117
86
  break;
118
87
  }
88
+ start = performance.now();
89
+ _context.next = 20;
90
+ return five.ready();
91
+ case 20:
119
92
  movePanoOptions = Object.assign(args, {
120
- duration: duration,
93
+ duration: duration - (performance.now() - start),
121
94
  // 移动耗时
122
95
  moveEndCallback: function moveEndCallback() {
123
96
  return resolve(true);
@@ -128,14 +101,14 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
128
101
  } // 移动开始
129
102
  // effect: args.transEffect || 'fade',
130
103
  });
131
- _context.next = 19;
104
+ _context.next = 23;
132
105
  return five.moveToPano(panoIndex, movePanoOptions);
133
- case 19:
134
- _context.next = 22;
106
+ case 23:
107
+ _context.next = 26;
135
108
  break;
136
- case 21:
109
+ case 25:
137
110
  reject(false);
138
- case 22:
111
+ case 26:
139
112
  case "end":
140
113
  return _context.stop();
141
114
  }
@@ -147,46 +120,23 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
147
120
  };
148
121
  }());
149
122
  };
150
- var getAnimeParams = function getAnimeParams(args) {
151
- var currentFiveState = five.state;
152
- // latitude
153
- var fromLatitude = formatLatitude(currentFiveState.latitude);
154
- var toLatitude = formatLatitude(args.latitude);
155
- // longitude
156
- var _getLongitudeParams = getLongitudeParams(currentFiveState.longitude, args.longitude, args.rotation || _typings.Rotation.Loop),
157
- fromLongitude = _getLongitudeParams.from,
158
- toLongitude = _getLongitudeParams.to;
159
- // fov
160
- var fromFov = currentFiveState.fov;
161
- var toFov = args.fov;
162
- return {
163
- from: {
164
- latitude: fromLatitude,
165
- longitude: fromLongitude,
166
- fov: fromFov
167
- },
168
- to: {
169
- latitude: toLatitude,
170
- longitude: toLongitude,
171
- fov: toFov
172
- }
173
- };
174
- };
175
123
  var rotate = /*#__PURE__*/function () {
176
124
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(args, duration) {
125
+ var _opts$asyncStartCallb, _opts$asyncEndCallbac2;
177
126
  var opts,
178
- _getAnimeParams,
179
127
  from,
180
128
  to,
129
+ timeEnd,
130
+ start,
131
+ animeDuration,
132
+ onFiveRenderFrame,
181
133
  _args2 = arguments;
182
134
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
183
135
  while (1) {
184
136
  switch (_context2.prev = _context2.next) {
185
137
  case 0:
186
138
  opts = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
187
- if (opts.asyncStartCallback) {
188
- opts.asyncStartCallback();
189
- }
139
+ (_opts$asyncStartCallb = opts.asyncStartCallback) === null || _opts$asyncStartCallb === void 0 ? void 0 : _opts$asyncStartCallb.call(opts);
190
140
 
191
141
  // 先切换模型再出旋转效果
192
142
  if (!(args.mode && five.currentMode !== args.mode)) {
@@ -194,7 +144,9 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
194
144
  break;
195
145
  }
196
146
  _context2.next = 5;
197
- return five.changeMode(args.mode);
147
+ return five.changeMode(args.mode, args.mode === _five.Five.Mode.Panorama ? {
148
+ latitude: 0
149
+ } : undefined);
198
150
  case 5:
199
151
  if (!(args.mode === _five.Five.Mode.Panorama && five.currentMode === _five.Five.Mode.Panorama && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
200
152
  _context2.next = 11;
@@ -222,43 +174,63 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
222
174
  });
223
175
  });
224
176
  case 11:
225
- if (opts.asyncEndCallback) {
226
- opts.asyncEndCallback();
177
+ _context2.next = 13;
178
+ return five.ready();
179
+ case 13:
180
+ (_opts$asyncEndCallbac2 = opts.asyncEndCallback) === null || _opts$asyncEndCallbac2 === void 0 ? void 0 : _opts$asyncEndCallbac2.call(opts);
181
+
182
+ // 计算to
183
+ from = five.getCurrentState();
184
+ to = function () {
185
+ return args;
186
+ }();
187
+ timeEnd = false; // 开始时间
188
+ start = performance.now();
189
+ animeDuration = duration;
190
+ if (args.rotation === _typings.Rotation.Loop) {
191
+ animeDuration = args.rotateSpeed ? Math.ceil(Math.abs(to.longitude - from.longitude) / args.rotateSpeed * 1000) : duration;
192
+ animeDuration = Math.min(duration, animeDuration);
227
193
  }
228
- _getAnimeParams = getAnimeParams(args), from = _getAnimeParams.from, to = _getAnimeParams.to;
229
- _context2.next = 15;
230
- return new Promise(function (resolve, reject) {
231
- var onUpdate = function onUpdate(_ref3) {
232
- var progress = _ref3.progress;
233
- var state = {};
234
- state.longitude = progressNumber(from.longitude, to.longitude, progress) % PI_2;
235
- state.latitude = progressNumber(from.latitude, to.latitude, progress);
236
- state.fov = progressNumber(from.fov, to.fov, progress);
237
- five.setState(state, true);
238
- };
239
- var onComplete = function onComplete() {
240
- resolve(true);
241
- };
242
- var onDestroy = function onDestroy() {
243
- resolve(false);
244
- };
245
- var animeDuration = duration;
246
- if (args.rotation === _typings.Rotation.Loop) {
247
- animeDuration = args.rotateSpeed ? Math.ceil(Math.abs(to.longitude - from.longitude) / args.rotateSpeed * 1000) : duration;
194
+ onFiveRenderFrame = function onFiveRenderFrame() {
195
+ if (timeEnd) {
196
+ five.off('renderFrame', onFiveRenderFrame);
197
+ return;
248
198
  }
249
- var tween = (0, _tween2.tweenProgress)(animeDuration, _tween.Easing.Linear.None).onUpdate(onUpdate).onComplete(onComplete).onDestroy(onDestroy);
250
- if (args.rotation === _typings.Rotation.Loop) {
251
- tween.repeat(Infinity).yoyo(true);
199
+ var targetState = {};
200
+ if (args.rotation !== _typings.Rotation.Loop) {
201
+ var progress = (performance.now() - start) / duration;
202
+ targetState = {
203
+ fov: progressNumber(from.fov, to.fov, progress),
204
+ latitude: progressNumber(from.latitude, to.latitude, progress),
205
+ longitude: progressLongitude(from.longitude, to.longitude, args.rotation, progress)
206
+ };
207
+ } else {
208
+ var _progress = (performance.now() - start) / animeDuration; // 可能大于1
209
+ var times = Math.floor(_progress);
210
+ var progress2 = _progress - times; // 一定小于1
211
+ var isNegative = times % 2 === 1; // 是否为反向旋转, 0: 正, 1: 反, 2: 正, 3: 反 以此类推
212
+ var resultProgress = isNegative ? 1 - progress2 : progress2;
213
+ targetState = {
214
+ fov: progressNumber(from.fov, to.fov, resultProgress),
215
+ latitude: progressNumber(from.latitude, to.latitude, resultProgress),
216
+ longitude: progressNumber(from.longitude, to.longitude, resultProgress)
217
+ };
252
218
  }
219
+ five.setState(targetState, true);
220
+ };
221
+ five.on('renderFrame', onFiveRenderFrame);
222
+ _context2.next = 24;
223
+ return new Promise(function (resolve) {
253
224
  setTimeout(function () {
225
+ timeEnd = true;
226
+ five.off('renderFrame', onFiveRenderFrame);
254
227
  // 总时间到了之后强制结束,同时也是 Loop 模式的结束方式
255
- tween.destroy();
256
228
  resolve(true);
257
229
  }, duration);
258
230
  });
259
- case 15:
231
+ case 24:
260
232
  return _context2.abrupt("return", _context2.sent);
261
- case 16:
233
+ case 25:
262
234
  case "end":
263
235
  return _context2.stop();
264
236
  }
@@ -8,7 +8,9 @@ exports.getFrameTime = getFrameTime;
8
8
  exports.nextFrame = nextFrame;
9
9
  exports.requestAnimationFrameInterval = requestAnimationFrameInterval;
10
10
  var _requestAnimationFrame = window.requestAnimationFrame || function (fn) {
11
- return setTimeout(fn, 16);
11
+ return setTimeout(function () {
12
+ return fn(performance.now());
13
+ }, 16);
12
14
  };
13
15
  var _cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
14
16
  var _default = _requestAnimationFrame;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realsee/vreo",
3
- "version": "1.2.1-alpha.3",
3
+ "version": "2.1.0-alpha.0",
4
4
  "description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
5
5
  "keywords": [
6
6
  "realsee",
@@ -732,38 +732,35 @@
732
732
  align-items: center;
733
733
  }
734
734
 
735
- .vreo-infoPanel-wrapper {
735
+ .vreo-infoPanel {
736
736
  position: relative;
737
- }
738
-
739
- .vreo-infoPanel-inner {
740
- position: absolute;
741
- left: 0;
742
- top: 0;
743
737
  width: 100%;
744
738
  height: 100%;
739
+ min-width: 70%;
740
+ max-width: 80%;
741
+ min-height: 30%;
742
+ max-height: 60%;
745
743
  border-radius: 4px;
746
744
  overflow: hidden;
747
- background-color: rgba(0, 0, 0, 1);
745
+ display: flex;
746
+ justify-content: center;
747
+ align-items: center;
748
748
  }
749
749
 
750
- .vreo-infoPanel {
750
+ .vreo-infoPanel-inner {
751
751
  position: relative;
752
+ width: 100%;
753
+ height: 100%;
752
754
  }
753
755
 
754
- .vreo-app .vreo-infoPanel,
755
- .vreo-app[data-size="S"] .vreo-infoPanel {
756
- width: 327px;
757
- }
758
- .vreo-app[data-size="M"][data-orientation="landscape"] .vreo-infoPanel {
759
- width: 192px;
760
- }
761
- .vreo-app[data-size="M"][data-orientation="portrait"] .vreo-infoPanel,
762
- .vreo-app[data-size="L"] .vreo-infoPanel {
763
- width: 319px;
764
- }
765
- .vreo-app[data-size="XL"] .vreo-infoPanel {
766
- width: 384px;
756
+ .vreo-infoPanel video,
757
+ .vreo-infoPanel img {
758
+ display: block;
759
+ width: 100%;
760
+ height: 100%;
761
+ object-fit: contain;
762
+ border-radius: 4px;
763
+ overflow: hidden;
767
764
  }
768
765
 
769
766
  .vreo-infoPanel-title {
@@ -790,15 +787,6 @@
790
787
  padding-top: 6px;
791
788
  }
792
789
 
793
- .vreo-infoPanelImg,
794
- .vreo-infoPanelVideo {
795
- position: absolute;
796
- width: 100%;
797
- height: 100%;
798
- object-position: center center;
799
- object-fit: contain;
800
- }
801
-
802
790
  .vreo-panel--hidden .vreo-panel-inner {
803
791
  opacity: 0;
804
792
  transition: opacity 0.45s;
@@ -839,7 +827,7 @@
839
827
  box-sizing: border-box;
840
828
  padding-left: 16px;
841
829
  padding-right: 16px;
842
- margin-bottom: 16.5%;
830
+ margin-bottom: 30px;
843
831
  bottom: 0;
844
832
  z-index: 1;
845
833
  flex-direction: column;
@@ -855,6 +843,11 @@
855
843
  z-index: 1;
856
844
  }
857
845
 
846
+ .vreo-PopUp-inner .vreo-infoPanel-title .vreo-infoPanel-t1,
847
+ .vreo-PopUp-inner .vreo-infoPanel-title .vreo-infoPanel-t2 {
848
+ text-shadow: 0 1px 3px rgba(0, 0, 0, 1);
849
+ }
850
+
858
851
  .vreo-PopUp-inner .vreo-infoPanel-title .vreo-infoPanel-t1 {
859
852
  padding-left: 0;
860
853
  font-weight: 600;