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