@realsee/vreo 0.2.0-alpha.9 → 1.0.0-alpha.10

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 (161) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +16 -5
  3. package/docs/assets/highlight.css +1 -1
  4. package/docs/assets/main.js +2 -2
  5. package/docs/assets/search.js +1 -1
  6. package/docs/assets/style.css +28 -2
  7. package/docs/classes/Player.AudioLike.html +52 -0
  8. package/docs/classes/Player.Controller.html +13 -13
  9. package/docs/classes/Player.Player-1.html +11 -11
  10. package/docs/classes/Player.VideoAgentMesh.html +53 -53
  11. package/docs/classes/Player.VideoAgentScene.html +1 -1
  12. package/docs/demo/assets/AppReact.ea8cbdb3.js +1 -0
  13. package/docs/demo/assets/default.1dd2b2d4.js +3988 -0
  14. package/docs/demo/assets/default.bc4c715d.css +1 -0
  15. package/docs/demo/assets/dynamic.cd7d1da6.js +1 -0
  16. package/docs/demo/assets/examples.98aaf9e2.js +25 -0
  17. package/docs/demo/assets/examples.dac4a6fe.css +1 -0
  18. package/docs/demo/assets/index.9331038f.css +1 -0
  19. package/docs/demo/assets/index.a3d7bd8a.js +1 -0
  20. package/docs/demo/assets/main.f0c47cae.js +1 -0
  21. package/docs/demo/assets/react.2ee8565f.css +1 -0
  22. package/docs/demo/assets/react.5f3bcfc5.js +25 -0
  23. package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +1 -0
  24. package/docs/demo/examples.html +17 -0
  25. package/docs/demo/index-react-dynamic.html +20 -0
  26. package/docs/demo/index-react.html +20 -0
  27. package/docs/demo/index.html +19 -0
  28. package/docs/enums/Player.InfoPanelStyleEnum.html +1 -1
  29. package/docs/enums/Player.InfoPanelTypeEnum.html +2 -2
  30. package/docs/enums/Player.PanoEffectEnum.html +2 -2
  31. package/docs/enums/Player.PanoTagEnum.html +2 -2
  32. package/docs/enums/Player.PanoTagStyleEnum.html +7 -0
  33. package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
  34. package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
  35. package/docs/enums/fivePlugins.Rotation.html +1 -1
  36. package/docs/index.html +13 -6
  37. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
  38. package/docs/interfaces/Player.PlayerConfigs.html +4 -3
  39. package/docs/interfaces/Player.Vertex.html +2 -2
  40. package/docs/interfaces/Player.VideoAgentMeshOptions.html +8 -1
  41. package/docs/interfaces/Player.VreoKeyframe.html +2 -2
  42. package/docs/interfaces/Player.VreoUnit.html +2 -2
  43. package/docs/interfaces/Player.VreoVideo.html +2 -2
  44. package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +4 -0
  45. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
  46. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
  47. package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +1 -1
  48. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
  49. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
  50. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
  51. package/docs/interfaces/fivePlugins.Vector3Position.html +3 -0
  52. package/docs/interfaces/react.VreoActionCallbacks.html +15 -7
  53. package/docs/interfaces/react.VreoProviderProps.html +1 -1
  54. package/docs/modules/Player.html +21 -15
  55. package/docs/modules/custom.html +1 -1
  56. package/docs/modules/fivePlugins.html +5 -2
  57. package/docs/modules/react.html +1 -1
  58. package/docs/modules.html +1 -1
  59. package/lib/PlayController/createHTMLAudioElement.js +6 -11
  60. package/lib/PlayController/index.js +19 -85
  61. package/lib/Player/App.js +7 -29
  62. package/lib/Player/Controller.d.ts +29 -8
  63. package/lib/Player/Controller.js +185 -87
  64. package/lib/Player/custom/SpatialScenePanel/index.js +47 -72
  65. package/lib/Player/hooks.js +2 -12
  66. package/lib/Player/index.d.ts +5 -3
  67. package/lib/Player/index.js +108 -122
  68. package/lib/Player/modules/Drawer/index.js +1 -18
  69. package/lib/Player/modules/PopUp/index.js +1 -11
  70. package/lib/Player/modules/ResizeObserver/index.d.ts +2 -0
  71. package/lib/Player/modules/ResizeObserver/index.js +29 -0
  72. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +16 -2
  73. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +124 -145
  74. package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +3 -6
  75. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +25 -52
  76. package/lib/Player/modules/VideoAgent/index.js +46 -22
  77. package/lib/Player/modules/Wave/index.d.ts +5 -0
  78. package/lib/Player/modules/Wave/index.js +77 -0
  79. package/lib/Player/modules/keyframes/BgMusic/index.js +3 -16
  80. package/lib/Player/modules/keyframes/CameraMovement/index.js +4 -28
  81. package/lib/Player/modules/keyframes/InfoPanel/index.js +30 -35
  82. package/lib/Player/modules/keyframes/ModelVideo/index.js +40 -29
  83. package/lib/Player/modules/keyframes/PanoEffect/index.js +16 -44
  84. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -8
  85. package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -2
  86. package/lib/Player/modules/keyframes/PanoTag/index.js +75 -132
  87. package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +3 -0
  88. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +93 -66
  89. package/lib/Player/modules/keyframes/Prompter/index.js +18 -53
  90. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +22 -25
  91. package/lib/Player/modules/keyframes/VideoEffect/index.js +13 -48
  92. package/lib/Player/typings.d.ts +12 -1
  93. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts +2 -0
  94. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +10 -0
  95. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts +7 -0
  96. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +31 -0
  97. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts +3 -0
  98. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +10 -0
  99. package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +56 -0
  100. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +234 -0
  101. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts +7 -0
  102. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +15 -0
  103. package/lib/fivePlugins/CameraMovementPlugin/index.js +36 -82
  104. package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
  105. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +12 -61
  106. package/lib/index.js +0 -1
  107. package/lib/react/index.d.ts +8 -4
  108. package/lib/react/index.js +10 -37
  109. package/lib/shared-utils/AduioLike.d.ts +37 -0
  110. package/lib/shared-utils/AduioLike.js +132 -0
  111. package/lib/shared-utils/Preloader.js +0 -7
  112. package/lib/shared-utils/addResizeListener.d.ts +4 -0
  113. package/lib/shared-utils/addResizeListener.js +46 -0
  114. package/lib/shared-utils/animationFrame/BetterTween.js +7 -39
  115. package/lib/shared-utils/animationFrame/index.js +2 -10
  116. package/lib/shared-utils/animationFrame/tween.js +3 -16
  117. package/lib/shared-utils/createTransMatrix.d.ts +1 -0
  118. package/lib/shared-utils/createTransMatrix.js +28 -0
  119. package/lib/shared-utils/getFileExpandedName.d.ts +1 -0
  120. package/lib/shared-utils/getFileExpandedName.js +12 -0
  121. package/lib/shared-utils/getMediaInfo.d.ts +9 -0
  122. package/lib/shared-utils/getMediaInfo.js +66 -0
  123. package/lib/shared-utils/setElementDataset.d.ts +1 -0
  124. package/lib/shared-utils/setElementDataset.js +22 -0
  125. package/lib/typings/VreoUnit.d.ts +37 -2
  126. package/lib/typings/VreoUnit.js +10 -13
  127. package/package.json +10 -10
  128. package/resources/PlayController/index.ts +0 -13
  129. package/resources/Player/App.tsx +5 -4
  130. package/resources/Player/Controller.ts +274 -146
  131. package/resources/Player/custom/SpatialScenePanel/index.tsx +5 -5
  132. package/resources/Player/hooks.ts +3 -5
  133. package/resources/Player/index.tsx +190 -140
  134. package/resources/Player/modules/ResizeObserver/index.tsx +23 -0
  135. package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +87 -31
  136. package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +27 -24
  137. package/resources/Player/modules/VideoAgent/index.tsx +28 -12
  138. package/resources/Player/modules/Wave/index.tsx +64 -0
  139. package/resources/Player/modules/keyframes/InfoPanel/index.tsx +26 -11
  140. package/resources/Player/modules/keyframes/ModelVideo/index.tsx +36 -3
  141. package/resources/Player/modules/keyframes/PanoTag/index.tsx +52 -97
  142. package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +86 -34
  143. package/resources/Player/modules/keyframes/Prompter/index.tsx +6 -16
  144. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +6 -2
  145. package/resources/Player/typings.ts +15 -1
  146. package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +5 -0
  147. package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +17 -0
  148. package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +4 -0
  149. package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +254 -0
  150. package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +5 -0
  151. package/resources/fivePlugins/CameraMovementPlugin/index.ts +19 -12
  152. package/resources/react/index.tsx +7 -3
  153. package/resources/shared-utils/AduioLike.ts +109 -0
  154. package/resources/shared-utils/addResizeListener.ts +46 -0
  155. package/resources/shared-utils/createTransMatrix.ts +12 -0
  156. package/resources/shared-utils/getFileExpandedName.ts +6 -0
  157. package/resources/shared-utils/getMediaInfo.ts +52 -0
  158. package/resources/shared-utils/setElementDataset.ts +18 -0
  159. package/resources/typings/VreoUnit.ts +41 -3
  160. package/stylesheets/custom/SpatialScenePanel.css +2 -1
  161. package/stylesheets/default.css +350 -84
@@ -1,87 +1,75 @@
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
- var PI_2 = Math.PI * 2;
19
-
14
+ var PI = Math.PI;
15
+ var PI_2 = PI * 2;
20
16
  function formatLatitude(rad) {
21
17
  return rad % PI_2;
22
18
  }
23
-
24
19
  function formatLongitude(rad) {
25
- return (rad % PI_2 + PI_2) % PI_2;
20
+ return rad % PI_2;
26
21
  }
27
-
28
22
  var getLongitudeParams = function getLongitudeParams(from, to, rotation) {
29
- var PI = Math.PI;
30
- var PI_2 = PI * 2;
31
23
  from = formatLongitude(from);
32
- to = formatLongitude(to); // 逆时针旋转,初始值必须是较大的值
24
+ to = formatLongitude(to);
33
25
 
34
- if (rotation === _typings.Rotation.Anticlockwise && from < to) from += PI_2; // 顺时针旋转,结束值必须是较大值
26
+ // 逆时针旋转,初始值必须是较大的值
27
+ if (rotation === _typings.Rotation.Anticlockwise && from > to) to += PI_2;
35
28
 
36
- if (rotation === _typings.Rotation.Clockwise && to < from) to += PI_2; // Loop 旋转,找锐角旋转
29
+ // 顺时针旋转,结束值必须是较大值
30
+ else if (rotation === _typings.Rotation.Clockwise && to > from) from += PI_2;
31
+
32
+ // Loop 旋转,找锐角旋转
37
33
  // 如果 to 比 from 大 180°,逆时针转
38
34
  // 如果 from 比 to 大 180°,顺时针转
39
-
40
- if (rotation === _typings.Rotation.Loop && to - from > PI) return getLongitudeParams(from, to, _typings.Rotation.Anticlockwise);
41
- if (rotation === _typings.Rotation.Loop && from - to > PI) return getLongitudeParams(from, to, _typings.Rotation.Clockwise);
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);
42
36
  return {
43
37
  from: from,
44
38
  to: to
45
39
  };
46
40
  };
47
-
48
41
  function progressNumber(from, to, pst) {
49
42
  return from + (to - from) * pst;
50
43
  }
44
+
51
45
  /**
52
46
  * **运镜插件** 模拟类似于电影运镜效果。
53
47
  */
54
-
55
-
56
48
  var CameraMovementPlugin = function CameraMovementPlugin(five) {
57
49
  var move = function move(args, duration) {
58
50
  var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
59
51
  preload: true
60
52
  };
61
53
  return new Promise( /*#__PURE__*/function () {
62
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve, reject) {
54
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
63
55
  var panoIndex, movePanoOptions;
64
- return regeneratorRuntime.wrap(function _callee$(_context) {
56
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
65
57
  while (1) {
66
58
  switch (_context.prev = _context.next) {
67
59
  case 0:
68
60
  if (opts.asyncStartCallback) {
69
61
  opts.asyncStartCallback();
70
62
  }
71
-
72
63
  if (!(five.panoIndex === undefined)) {
73
64
  _context.next = 3;
74
65
  break;
75
66
  }
76
-
77
67
  return _context.abrupt("return", reject(false));
78
-
79
68
  case 3:
80
69
  if (!(args.mode && args.mode !== five.currentMode)) {
81
70
  _context.next = 6;
82
71
  break;
83
72
  }
84
-
85
73
  _context.next = 6;
86
74
  return new Promise(function (resolve) {
87
75
  if (!args.mode) return;
@@ -99,44 +87,34 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
99
87
  panoIndex: args.panoIndex || undefined
100
88
  });
101
89
  });
102
-
103
90
  case 6:
104
91
  if (!(args.mode === _five.Five.Mode.Floorplan)) {
105
92
  _context.next = 8;
106
93
  break;
107
94
  }
108
-
109
95
  return _context.abrupt("return", resolve(true));
110
-
111
96
  case 8:
112
97
  if (!(opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
113
98
  _context.next = 11;
114
99
  break;
115
100
  }
116
-
117
101
  _context.next = 11;
118
102
  return five.preloadPano(args.panoIndex);
119
-
120
103
  case 11:
121
104
  if (opts.asyncEndCallback) {
122
105
  opts.asyncEndCallback();
123
106
  }
124
-
125
107
  if (!(args.panoIndex === undefined && args.fov === undefined && args.latitude === undefined && args.longitude === undefined)) {
126
108
  _context.next = 14;
127
109
  break;
128
110
  }
129
-
130
111
  return _context.abrupt("return", resolve(true));
131
-
132
112
  case 14:
133
113
  panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
134
-
135
114
  if (!(panoIndex !== undefined)) {
136
115
  _context.next = 21;
137
116
  break;
138
117
  }
139
-
140
118
  movePanoOptions = Object.assign(args, {
141
119
  duration: duration,
142
120
  // 移动耗时
@@ -148,18 +126,14 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
148
126
  resolve(true);
149
127
  } // 移动开始
150
128
  // effect: args.transEffect || 'fade',
151
-
152
129
  });
153
130
  _context.next = 19;
154
131
  return five.moveToPano(panoIndex, movePanoOptions);
155
-
156
132
  case 19:
157
133
  _context.next = 22;
158
134
  break;
159
-
160
135
  case 21:
161
136
  reject(false);
162
-
163
137
  case 22:
164
138
  case "end":
165
139
  return _context.stop();
@@ -167,24 +141,21 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
167
141
  }
168
142
  }, _callee);
169
143
  }));
170
-
171
144
  return function (_x, _x2) {
172
145
  return _ref.apply(this, arguments);
173
146
  };
174
147
  }());
175
148
  };
176
-
177
149
  var getAnimeParams = function getAnimeParams(args) {
178
- var currentFiveState = five.state; // latitude
179
-
150
+ var currentFiveState = five.state;
151
+ // latitude
180
152
  var fromLatitude = formatLatitude(currentFiveState.latitude);
181
- var toLatitude = formatLatitude(args.latitude); // longitude
182
-
153
+ var toLatitude = formatLatitude(args.latitude);
154
+ // longitude
183
155
  var _getLongitudeParams = getLongitudeParams(currentFiveState.longitude, args.longitude, args.rotation || _typings.Rotation.Loop),
184
- fromLongitude = _getLongitudeParams.from,
185
- toLongitude = _getLongitudeParams.to; // fov
186
-
187
-
156
+ fromLongitude = _getLongitudeParams.from,
157
+ toLongitude = _getLongitudeParams.to;
158
+ // fov
188
159
  var fromFov = currentFiveState.fov;
189
160
  var toFov = args.fov;
190
161
  return {
@@ -200,48 +171,40 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
200
171
  }
201
172
  };
202
173
  };
203
-
204
174
  var rotate = /*#__PURE__*/function () {
205
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(args, duration) {
175
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(args, duration) {
206
176
  var opts,
207
- _getAnimeParams,
208
- from,
209
- to,
210
- _args2 = arguments;
211
-
212
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
177
+ _getAnimeParams,
178
+ from,
179
+ to,
180
+ _args2 = arguments;
181
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
213
182
  while (1) {
214
183
  switch (_context2.prev = _context2.next) {
215
184
  case 0:
216
185
  opts = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
217
-
218
186
  if (opts.asyncStartCallback) {
219
187
  opts.asyncStartCallback();
220
- } // 先切换模型再出旋转效果
221
-
188
+ }
222
189
 
190
+ // 先切换模型再出旋转效果
223
191
  if (!(args.mode && five.currentMode !== args.mode)) {
224
192
  _context2.next = 5;
225
193
  break;
226
194
  }
227
-
228
195
  _context2.next = 5;
229
196
  return five.changeMode(args.mode);
230
-
231
197
  case 5:
232
198
  if (!(args.mode === _five.Five.Mode.Panorama && five.currentMode === _five.Five.Mode.Panorama && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
233
199
  _context2.next = 11;
234
200
  break;
235
201
  }
236
-
237
202
  if (!opts.preload) {
238
203
  _context2.next = 9;
239
204
  break;
240
205
  }
241
-
242
206
  _context2.next = 9;
243
207
  return five.preloadPano(args.panoIndex);
244
-
245
208
  case 9:
246
209
  _context2.next = 11;
247
210
  return new Promise(function (resolve, reject) {
@@ -257,49 +220,43 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
257
220
  effect: 'fade'
258
221
  });
259
222
  });
260
-
261
223
  case 11:
262
224
  if (opts.asyncEndCallback) {
263
225
  opts.asyncEndCallback();
264
226
  }
265
-
266
227
  _getAnimeParams = getAnimeParams(args), from = _getAnimeParams.from, to = _getAnimeParams.to;
267
228
  _context2.next = 15;
268
229
  return new Promise(function (resolve, reject) {
269
230
  var onUpdate = function onUpdate(_ref3) {
270
231
  var progress = _ref3.progress;
271
232
  var state = {};
272
- state.longitude = progressNumber(from.longitude, to.longitude, progress);
233
+ state.longitude = progressNumber(from.longitude, to.longitude, progress) % PI_2;
273
234
  state.latitude = progressNumber(from.latitude, to.latitude, progress);
274
235
  state.fov = progressNumber(from.fov, to.fov, progress);
275
236
  five.setState(state, true);
276
237
  };
277
-
278
238
  var onComplete = function onComplete() {
279
239
  resolve(true);
280
240
  };
281
-
282
241
  var onDestroy = function onDestroy() {
283
242
  resolve(false);
284
243
  };
285
-
286
- var animeDuration = args.rotateSpeed ? Math.ceil(Math.abs(to.longitude - from.longitude) / args.rotateSpeed * 1000) : duration;
244
+ var animeDuration = duration;
245
+ if (args.rotation === _typings.Rotation.Loop) {
246
+ animeDuration = args.rotateSpeed ? Math.ceil(Math.abs(to.longitude - from.longitude) / args.rotateSpeed * 1000) : duration;
247
+ }
287
248
  var tween = (0, _tween.tweenProgress)(animeDuration, _tween.Easing.Linear.None).onUpdate(onUpdate).onComplete(onComplete).onDestroy(onDestroy);
288
-
289
249
  if (args.rotation === _typings.Rotation.Loop) {
290
250
  tween.repeat(Infinity).yoyo(true);
291
251
  }
292
-
293
252
  setTimeout(function () {
294
253
  // 总时间到了之后强制结束,同时也是 Loop 模式的结束方式
295
254
  tween.destroy();
296
255
  resolve(true);
297
256
  }, duration);
298
257
  });
299
-
300
258
  case 15:
301
259
  return _context2.abrupt("return", _context2.sent);
302
-
303
260
  case 16:
304
261
  case "end":
305
262
  return _context2.stop();
@@ -307,16 +264,13 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
307
264
  }
308
265
  }, _callee2);
309
266
  }));
310
-
311
267
  return function rotate(_x3, _x4) {
312
268
  return _ref2.apply(this, arguments);
313
269
  };
314
270
  }();
315
-
316
271
  return {
317
272
  move: move,
318
273
  rotate: rotate
319
274
  };
320
275
  };
321
-
322
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";
@@ -1,34 +1,22 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
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); }
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.ModelTVVideoPlugin = void 0;
9
-
10
8
  var THREE = _interopRequireWildcard(require("three"));
11
-
12
9
  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); }
13
-
14
10
  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; }
15
-
16
11
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
17
-
18
12
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
-
20
13
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
-
22
14
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
23
-
24
15
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
25
-
26
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
27
-
17
+ 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; }
28
18
  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); } }
29
-
30
19
  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); }); }; }
31
-
32
20
  var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
33
21
  var videoElement = _ref.videoElement;
34
22
  var state = {
@@ -39,18 +27,15 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
39
27
  enabled: false,
40
28
  videoElement: videoElement
41
29
  };
42
-
43
30
  var setMuted = function setMuted(muted) {
44
31
  if (state.videoTexture) {
45
32
  state.videoTexture.image.muted = muted;
46
33
  state.videoTexture.image.play();
47
34
  }
48
35
  };
49
-
50
36
  var getMuted = function getMuted() {
51
37
  if (state.videoTexture) return state.videoTexture.image.muted;else return true;
52
38
  };
53
-
54
39
  var enable = function enable() {
55
40
  if (state.enabled) return;
56
41
  if (!state.videoTexture) return;
@@ -59,13 +44,10 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
59
44
  state.videoMeshes.forEach(function (mesh) {
60
45
  return five.scene.add(mesh);
61
46
  });
62
-
63
47
  var play = function play() {
64
48
  if (!state.videoTexture) return;
65
-
66
49
  var timeupdate = function timeupdate() {
67
50
  var _state$videoTexture;
68
-
69
51
  if (!state.videoTexture) return;
70
52
  (_state$videoTexture = state.videoTexture) === null || _state$videoTexture === void 0 ? void 0 : _state$videoTexture.image.removeEventListener('timeupdate', timeupdate);
71
53
  state.videoTextureEnabled = true;
@@ -74,21 +56,17 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
74
56
  });
75
57
  five.needsRender = true;
76
58
  };
77
-
78
59
  state.videoTexture.image.addEventListener('timeupdate', timeupdate);
79
-
80
60
  if (state.videoTexture && state.videoMeshes.length) {
81
61
  state.videoTexture.image.play();
82
62
  }
83
63
  };
84
-
85
64
  if (five.model.loaded) play();else {
86
65
  return five.once('modelLoaded', function () {
87
66
  return play();
88
67
  });
89
68
  }
90
69
  };
91
-
92
70
  var disable = function disable() {
93
71
  if (!state.enabled) return;
94
72
  state.enabled = false;
@@ -101,47 +79,36 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
101
79
  state.videoMeshes = [];
102
80
  five.needsRender = true;
103
81
  };
104
-
105
82
  var createPanoVideoMeshes = function createPanoVideoMeshes() {
106
83
  return state.rectPoints.map(function (points, index) {
107
84
  var geometry = new THREE.BufferGeometry();
108
85
  var segments = 128;
109
86
  var verticesArray = [];
110
87
  verticesArray.push(points[0].x, points[0].y, points[0].z);
111
-
112
88
  for (var i = 1; i < segments; i++) {
113
89
  verticesArray.push(points[0].x + (points[1].x - points[0].x) * i / segments, points[0].y + (points[1].y - points[0].y) * i / segments, points[0].z + (points[1].z - points[0].z) * i / segments);
114
90
  }
115
-
116
91
  verticesArray.push(points[1].x, points[1].y, points[1].z);
117
92
  verticesArray.push(points[2].x, points[2].y, points[2].z);
118
-
119
93
  for (var _i = 1; _i < segments; _i++) {
120
94
  verticesArray.push(points[2].x + (points[3].x - points[2].x) * _i / segments, points[2].y + (points[3].y - points[2].y) * _i / segments, points[2].z + (points[3].z - points[2].z) * _i / segments);
121
95
  }
122
-
123
96
  verticesArray.push(points[3].x, points[3].y, points[3].z);
124
97
  var uvArray = [];
125
98
  uvArray.push(0, 1);
126
-
127
99
  for (var _i2 = 1; _i2 < segments; _i2++) {
128
100
  uvArray.push(0, 1 - _i2 / segments);
129
101
  }
130
-
131
102
  uvArray.push(0, 0);
132
103
  uvArray.push(1, 0);
133
-
134
104
  for (var _i3 = 1; _i3 < segments; _i3++) {
135
105
  uvArray.push(1, _i3 / segments);
136
106
  }
137
-
138
107
  uvArray.push(1, 1);
139
108
  var indicesArray = [];
140
-
141
109
  for (var _i4 = 0; _i4 < segments; _i4++) {
142
110
  indicesArray.push(_i4, _i4 + 1, segments * 2 - _i4, _i4, segments * 2 - _i4, segments * 2 + 1 - _i4);
143
111
  }
144
-
145
112
  geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(verticesArray), 3));
146
113
  geometry.setAttribute('uv', new THREE.BufferAttribute(new Float32Array(uvArray), 2));
147
114
  geometry.setIndex(new THREE.BufferAttribute(new Uint32Array(indicesArray), 1));
@@ -155,7 +122,6 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
155
122
  return mesh;
156
123
  });
157
124
  };
158
-
159
125
  var getImageTexture = function getImageTexture(source) {
160
126
  var texture = new THREE.TextureLoader().load(source);
161
127
  texture.minFilter = THREE.LinearFilter;
@@ -163,11 +129,9 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
163
129
  texture.format = THREE.RGBFormat;
164
130
  return texture;
165
131
  };
166
-
167
132
  var getVideoTexture = function getVideoTexture(source, video) {
168
133
  return new Promise(function (resolve, reject) {
169
134
  var xhr = new XMLHttpRequest();
170
-
171
135
  xhr.onreadystatechange = function () {
172
136
  if (xhr.readyState == 4) {
173
137
  if (xhr.status == 200) {
@@ -191,21 +155,18 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
191
155
  }
192
156
  }
193
157
  };
194
-
195
158
  xhr.onerror = function (error) {
196
159
  return reject(error);
197
160
  };
198
-
199
161
  xhr.open('GET', source);
200
162
  xhr.responseType = 'blob';
201
163
  xhr.send();
202
164
  });
203
165
  };
204
-
205
166
  var load = /*#__PURE__*/function () {
206
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(data, videoElement) {
167
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, videoElement) {
207
168
  var video_src, video_poster_src, points;
208
- return regeneratorRuntime.wrap(function _callee$(_context) {
169
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
209
170
  while (1) {
210
171
  switch (_context.prev = _context.next) {
211
172
  case 0:
@@ -214,25 +175,21 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
214
175
  state.rectPoints = points.map(function (items) {
215
176
  return items.map(function (_ref3) {
216
177
  var x = _ref3.x,
217
- y = _ref3.y,
218
- z = _ref3.z;
178
+ y = _ref3.y,
179
+ z = _ref3.z;
219
180
  return new THREE.Vector3(x, y, z);
220
181
  });
221
182
  });
222
183
  state.imageTexture = getImageTexture(video_poster_src);
223
-
224
184
  if (videoElement) {
225
185
  state.videoElement = videoElement;
226
186
  }
227
-
228
187
  _context.next = 7;
229
188
  return getVideoTexture(state.videoSource, state.videoElement);
230
-
231
189
  case 7:
232
190
  state.videoTexture = _context.sent;
233
191
  state.enabled = !!data.enable;
234
192
  if (state.enabled) enable();
235
-
236
193
  case 10:
237
194
  case "end":
238
195
  return _context.stop();
@@ -240,22 +197,18 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
240
197
  }
241
198
  }, _callee);
242
199
  }));
243
-
244
200
  return function load(_x, _x2) {
245
201
  return _ref2.apply(this, arguments);
246
202
  };
247
203
  }();
248
-
249
204
  five.on('modeChange', function () {
250
205
  return setMuted(true);
251
206
  });
252
207
  five.on('wantsTapGesture', function (raycaster) {
253
208
  if (!state.enabled) return;
254
-
255
209
  var _raycaster$intersectO = raycaster.intersectObjects(five.scene.children, true),
256
- _raycaster$intersectO2 = _slicedToArray(_raycaster$intersectO, 1),
257
- intersect = _raycaster$intersectO2[0];
258
-
210
+ _raycaster$intersectO2 = _slicedToArray(_raycaster$intersectO, 1),
211
+ intersect = _raycaster$intersectO2[0];
259
212
  if (!!intersect && /^video/.test(intersect.object.name)) {
260
213
  if (state.videoTexture) setMuted(!state.videoTexture.image.muted);
261
214
  return false;
@@ -274,11 +227,9 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
274
227
  }).filter(function (vector) {
275
228
  vector = vector.clone().sub(cameraPosition).normalize();
276
229
  var raycaster = new THREE.Raycaster(cameraPosition, vector);
277
-
278
230
  var _raycaster$intersectO3 = raycaster.intersectObjects(five.scene.children, true),
279
- _raycaster$intersectO4 = _slicedToArray(_raycaster$intersectO3, 1),
280
- intersect = _raycaster$intersectO4[0];
281
-
231
+ _raycaster$intersectO4 = _slicedToArray(_raycaster$intersectO3, 1),
232
+ intersect = _raycaster$intersectO4[0];
282
233
  return !!intersect && /^video/.test(intersect.object.name);
283
234
  }).length >= 2;
284
235
  });
@@ -286,7 +237,8 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
286
237
  });
287
238
  five.on('renderFrame', function () {
288
239
  state.videoMeshes.forEach(function (meshes) {
289
- if (meshes) //@ts-ignore
240
+ if (meshes)
241
+ //@ts-ignore
290
242
  meshes.needsRender = true;
291
243
  });
292
244
  });
@@ -301,5 +253,4 @@ var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
301
253
  load: load
302
254
  };
303
255
  };
304
-
305
256
  exports.ModelTVVideoPlugin = ModelTVVideoPlugin;