@realsee/vreo 1.2.1-alpha.1 → 1.2.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/PlayController/createHTMLAudioElement.js +6 -11
- package/lib/PlayController/index.js +15 -80
- package/lib/Player/App.js +0 -26
- package/lib/Player/Controller.js +23 -100
- package/lib/Player/custom/SpatialScenePanel/index.js +42 -68
- package/lib/Player/hooks.js +0 -10
- package/lib/Player/index.js +24 -86
- package/lib/Player/modules/Drawer/index.js +0 -17
- package/lib/Player/modules/PopUp/index.js +0 -10
- package/lib/Player/modules/ResizeObserver/index.js +0 -8
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +17 -108
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +2 -24
- package/lib/Player/modules/VideoAgent/index.js +0 -17
- package/lib/Player/modules/Wave/index.js +7 -32
- package/lib/Player/modules/keyframes/BgMusic/index.js +7 -23
- package/lib/Player/modules/keyframes/CameraMovement/index.js +3 -27
- package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -29
- package/lib/Player/modules/keyframes/ModelVideo/index.js +3 -29
- package/lib/Player/modules/keyframes/PanoEffect/index.js +15 -43
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -7
- package/lib/Player/modules/keyframes/PanoTag/index.js +5 -22
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +22 -47
- package/lib/Player/modules/keyframes/Prompter/index.js +10 -32
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +18 -25
- package/lib/Player/modules/keyframes/VideoEffect/index.js +12 -47
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +19 -60
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
- package/lib/fivePlugins/CameraMovementPlugin/index.js +28 -76
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +11 -60
- package/lib/index.js +0 -1
- package/lib/react/index.js +7 -34
- package/lib/shared-utils/Audio.js +15 -69
- package/lib/shared-utils/AudioLike.js +5 -39
- package/lib/shared-utils/Preloader.js +0 -7
- package/lib/shared-utils/addResizeListener.js +0 -5
- package/lib/shared-utils/animationFrame/BetterTween.js +2 -38
- package/lib/shared-utils/animationFrame/index.js +2 -10
- package/lib/shared-utils/animationFrame/tween.js +2 -11
- package/lib/shared-utils/createTransMatrix.js +2 -17
- package/lib/shared-utils/getFileExpandedName.js +0 -1
- package/lib/shared-utils/getMediaInfo.js +0 -9
- package/lib/shared-utils/setElementDataset.js +0 -2
- package/lib/typings/VreoUnit.js +0 -15
- package/package.json +2 -2
|
@@ -1,32 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.ModelVideo = ModelVideo;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var THREE = _interopRequireWildcard(require("three"));
|
|
13
|
-
|
|
14
10
|
var _hooks = require("../../../hooks");
|
|
15
|
-
|
|
16
11
|
var _ModelTVVideoPlugin = require("../../../../fivePlugins/ModelTVVideoPlugin");
|
|
17
|
-
|
|
18
12
|
var _createTransMatrix = require("../../../../shared-utils/createTransMatrix");
|
|
19
|
-
|
|
20
13
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
21
|
-
|
|
22
14
|
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); }
|
|
23
|
-
|
|
24
15
|
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; }
|
|
25
|
-
|
|
16
|
+
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; }
|
|
26
17
|
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); } }
|
|
27
|
-
|
|
28
18
|
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); }); }; }
|
|
29
|
-
|
|
30
19
|
function ModelVideo() {
|
|
31
20
|
var controller = (0, _hooks.useController)();
|
|
32
21
|
var five = (0, _hooks.useFiveInstance)();
|
|
@@ -34,38 +23,31 @@ function ModelVideo() {
|
|
|
34
23
|
var timeoutRef = React.useRef();
|
|
35
24
|
React.useEffect(function () {
|
|
36
25
|
var callback = /*#__PURE__*/function () {
|
|
37
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/
|
|
26
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(keyframe) {
|
|
38
27
|
var _controller$configs, _controller$configs$v;
|
|
39
|
-
|
|
40
28
|
var start, end, _ref2, videoSrc, videoPosterSrc, vertexs, matrixWorld, position, points;
|
|
41
|
-
|
|
42
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
29
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
43
30
|
while (1) {
|
|
44
31
|
switch (_context.prev = _context.next) {
|
|
45
32
|
case 0:
|
|
46
33
|
if (!ref.current) {
|
|
47
34
|
ref.current = (0, _ModelTVVideoPlugin.ModelTVVideoPlugin)(five, {});
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
start = keyframe.start, end = keyframe.end;
|
|
51
37
|
_ref2 = keyframe.data, videoSrc = _ref2.videoSrc, videoPosterSrc = _ref2.videoPosterSrc, vertexs = _ref2.vertexs, matrixWorld = _ref2.matrixWorld;
|
|
52
|
-
|
|
53
38
|
position = function () {
|
|
54
39
|
if (vertexs.length < 4) {
|
|
55
40
|
throw new Error('ModelVideo: 顶点数据集合不够,无法组成矩形 ....');
|
|
56
41
|
}
|
|
57
|
-
|
|
58
42
|
if (vertexs.length === 4) {
|
|
59
43
|
return vertexs;
|
|
60
44
|
}
|
|
61
|
-
|
|
62
45
|
var box = new THREE.Box3();
|
|
63
46
|
vertexs.forEach(function (v) {
|
|
64
47
|
return box.expandByPoint(new THREE.Vector3(v.x, v.y, v.z));
|
|
65
48
|
});
|
|
66
49
|
return [new THREE.Vector3(box.min.x, box.max.y, box.max.z), new THREE.Vector3(box.min.x, box.min.y, box.max.z), new THREE.Vector3(box.max.x, box.min.y, box.max.z), new THREE.Vector3(box.max.x, box.max.y, box.max.z)];
|
|
67
50
|
}();
|
|
68
|
-
|
|
69
51
|
points = function () {
|
|
70
52
|
if (matrixWorld) {
|
|
71
53
|
var transMatrix = (0, _createTransMatrix.createTransMatrix)(matrixWorld);
|
|
@@ -78,10 +60,8 @@ function ModelVideo() {
|
|
|
78
60
|
};
|
|
79
61
|
})];
|
|
80
62
|
}
|
|
81
|
-
|
|
82
63
|
return [position];
|
|
83
64
|
}();
|
|
84
|
-
|
|
85
65
|
ref.current.disable();
|
|
86
66
|
_context.next = 8;
|
|
87
67
|
return ref.current.load({
|
|
@@ -89,15 +69,12 @@ function ModelVideo() {
|
|
|
89
69
|
video_poster_src: videoPosterSrc,
|
|
90
70
|
points: points
|
|
91
71
|
}, (_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.modelTVVideo);
|
|
92
|
-
|
|
93
72
|
case 8:
|
|
94
73
|
ref.current.enable();
|
|
95
74
|
timeoutRef.current = setTimeout(function () {
|
|
96
75
|
var _ref$current;
|
|
97
|
-
|
|
98
76
|
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.disable();
|
|
99
77
|
}, end - start);
|
|
100
|
-
|
|
101
78
|
case 10:
|
|
102
79
|
case "end":
|
|
103
80
|
return _context.stop();
|
|
@@ -105,16 +82,13 @@ function ModelVideo() {
|
|
|
105
82
|
}
|
|
106
83
|
}, _callee);
|
|
107
84
|
}));
|
|
108
|
-
|
|
109
85
|
return function callback(_x) {
|
|
110
86
|
return _ref.apply(this, arguments);
|
|
111
87
|
};
|
|
112
88
|
}();
|
|
113
|
-
|
|
114
89
|
controller.on(_VreoUnit.VreoKeyframeEnum.ModelVideo, callback);
|
|
115
90
|
return function () {
|
|
116
91
|
controller.off(_VreoUnit.VreoKeyframeEnum.ModelVideo, callback);
|
|
117
|
-
|
|
118
92
|
if (timeoutRef.current) {
|
|
119
93
|
clearTimeout(timeoutRef.current);
|
|
120
94
|
}
|
|
@@ -1,77 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.PanoEffect = PanoEffect;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _three = require("three");
|
|
13
|
-
|
|
14
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
11
|
var _lineAnime = _interopRequireDefault(require("./lineAnime"));
|
|
17
|
-
|
|
18
12
|
var _hooks = require("../../../hooks");
|
|
19
|
-
|
|
20
13
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
|
|
26
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
17
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
-
|
|
30
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."); }
|
|
31
|
-
|
|
32
19
|
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); }
|
|
33
|
-
|
|
34
20
|
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; }
|
|
35
|
-
|
|
36
21
|
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; }
|
|
37
|
-
|
|
38
22
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
-
|
|
40
23
|
function PanoEffect() {
|
|
41
24
|
var _React$useState = React.useState(null),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
26
|
+
state = _React$useState2[0],
|
|
27
|
+
setState = _React$useState2[1];
|
|
46
28
|
var five = (0, _hooks.useFiveInstance)();
|
|
47
29
|
var lineRef = React.useRef(null);
|
|
48
|
-
|
|
49
30
|
var _React$useState3 = React.useState(null),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
31
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
32
|
+
pos = _React$useState4[0],
|
|
33
|
+
setPos = _React$useState4[1];
|
|
54
34
|
var timeoutRef = React.useRef();
|
|
55
35
|
var controller = (0, _hooks.useController)();
|
|
56
36
|
var project2d = (0, _hooks.useFiveProject2d)();
|
|
57
|
-
|
|
58
37
|
var delLine = function delLine() {
|
|
59
38
|
if (lineRef.current) {
|
|
60
39
|
lineRef.current.dispose();
|
|
61
40
|
}
|
|
62
41
|
};
|
|
63
|
-
|
|
64
42
|
React.useEffect(function () {
|
|
65
43
|
var callback = function callback(keyframe) {
|
|
66
44
|
var start = keyframe.start,
|
|
67
|
-
|
|
68
|
-
|
|
45
|
+
end = keyframe.end,
|
|
46
|
+
data = keyframe.data;
|
|
69
47
|
var videoEffectData = data;
|
|
70
|
-
|
|
71
48
|
var _videoEffectData$twoV = _slicedToArray(videoEffectData.twoVertexs, 2),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
49
|
+
v1 = _videoEffectData$twoV[0],
|
|
50
|
+
v2 = _videoEffectData$twoV[1];
|
|
75
51
|
var p1 = new _three.Vector3(v1.x, v1.y, v1.z);
|
|
76
52
|
var p2 = new _three.Vector3(v2.x, v2.y, v2.z);
|
|
77
53
|
lineRef.current = (0, _lineAnime["default"])(five, p1.clone(), p2.clone());
|
|
@@ -81,7 +57,7 @@ function PanoEffect() {
|
|
|
81
57
|
var p = project2d(center);
|
|
82
58
|
if (!p) return;
|
|
83
59
|
var left = p.x,
|
|
84
|
-
|
|
60
|
+
top = p.y;
|
|
85
61
|
setState({
|
|
86
62
|
center: center,
|
|
87
63
|
distance: distance
|
|
@@ -96,15 +72,12 @@ function PanoEffect() {
|
|
|
96
72
|
delLine();
|
|
97
73
|
}, end - start);
|
|
98
74
|
};
|
|
99
|
-
|
|
100
75
|
controller.on(_VreoUnit.VreoKeyframeEnum.PanoEffect, callback);
|
|
101
76
|
return function () {
|
|
102
77
|
controller.off(_VreoUnit.VreoKeyframeEnum.PanoEffect, callback);
|
|
103
|
-
|
|
104
78
|
if (timeoutRef.current) {
|
|
105
79
|
clearTimeout(timeoutRef.current);
|
|
106
80
|
}
|
|
107
|
-
|
|
108
81
|
delLine();
|
|
109
82
|
};
|
|
110
83
|
}, [controller]);
|
|
@@ -112,19 +85,18 @@ function PanoEffect() {
|
|
|
112
85
|
var callback = function callback() {
|
|
113
86
|
if (!(state !== null && state !== void 0 && state.center)) return;
|
|
114
87
|
var _state$center = state.center,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
88
|
+
x = _state$center.x,
|
|
89
|
+
y = _state$center.y,
|
|
90
|
+
z = _state$center.z;
|
|
118
91
|
var res = project2d(new _three.Vector3(x, y, z));
|
|
119
92
|
if (!res) return;
|
|
120
93
|
var left = res.x,
|
|
121
|
-
|
|
94
|
+
top = res.y;
|
|
122
95
|
setPos({
|
|
123
96
|
left: left,
|
|
124
97
|
top: top
|
|
125
98
|
});
|
|
126
99
|
};
|
|
127
|
-
|
|
128
100
|
five.on('currentStateChange', callback);
|
|
129
101
|
return function () {
|
|
130
102
|
five.off('currentStateChange', callback);
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = lineAnime;
|
|
9
|
-
|
|
10
8
|
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
-
|
|
12
9
|
var _line = require("@realsee/five/line");
|
|
13
|
-
|
|
14
10
|
var _BetterTween = require("../../../../shared-utils/animationFrame/BetterTween");
|
|
15
|
-
|
|
16
11
|
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); }
|
|
17
|
-
|
|
18
12
|
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; }
|
|
19
|
-
|
|
20
13
|
function lineAnime(five, startPoint, endPoint) {
|
|
21
14
|
var pointImage = 'data:image/png;base64,' + 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAAD////////////////////////////////////////PIev5AAAACnRSTlMAG/Py2baba05un7UgfgAAAHJJREFUKM9joBpgLHVSCRdA4metAoJlCJHmVWBgAeNzroKCCVCBLpjACqgJVjCBxRBT2FbBQQJYQAohsBAsUIUQWA4WiEIILAULeCEEloAFtBACizAEMLRgGIphLabDMJ2O6TlM72MGECIIMQIZIxqoBQCPvpJ/e9FaAAAAAABJRU5ErkJggg==';
|
|
22
15
|
var pointTexture = new THREE.TextureLoader().load(pointImage);
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.PanoTag = PanoTag;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _hooks = require("../../../hooks");
|
|
13
|
-
|
|
14
10
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
15
|
-
|
|
16
11
|
var _dnalogel = require("@realsee/dnalogel");
|
|
17
|
-
|
|
18
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); }
|
|
19
|
-
|
|
20
13
|
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; }
|
|
21
|
-
|
|
22
14
|
function PanoTag() {
|
|
23
15
|
var timeoutRef = React.useRef();
|
|
24
16
|
var controller = (0, _hooks.useController)();
|
|
@@ -42,22 +34,19 @@ function PanoTag() {
|
|
|
42
34
|
}));
|
|
43
35
|
React.useEffect(function () {
|
|
44
36
|
var _controller$configs;
|
|
45
|
-
|
|
46
37
|
if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.PanoTag) === false) {
|
|
47
38
|
return;
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
var callback = function callback(keyframe) {
|
|
51
41
|
if (!panoTagPlugin.current) return;
|
|
52
42
|
var start = keyframe.start,
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
end = keyframe.end,
|
|
44
|
+
data = keyframe.data;
|
|
55
45
|
var panoTagData = data;
|
|
56
46
|
var id = Date.now().toString();
|
|
57
47
|
var pointType = 'PointTag';
|
|
58
48
|
var dimensionType = '2D';
|
|
59
49
|
var position = [panoTagData.vertex.x, panoTagData.vertex.y, panoTagData.vertex.z];
|
|
60
|
-
|
|
61
50
|
var tag = function () {
|
|
62
51
|
if (panoTagData.imgUrl) {
|
|
63
52
|
return {
|
|
@@ -88,30 +77,26 @@ function PanoTag() {
|
|
|
88
77
|
}
|
|
89
78
|
};
|
|
90
79
|
}
|
|
91
|
-
}();
|
|
92
|
-
|
|
80
|
+
}();
|
|
93
81
|
|
|
82
|
+
// show
|
|
94
83
|
panoTagPlugin.current.load({
|
|
95
84
|
tagList: [tag]
|
|
96
85
|
});
|
|
97
86
|
var tagInstance = panoTagPlugin.current.getTagById(id);
|
|
98
|
-
|
|
99
87
|
if (tagInstance) {
|
|
100
88
|
tagInstance.state.unfolded = true;
|
|
89
|
+
panoTagPlugin.current.updateRenderAllTags();
|
|
101
90
|
}
|
|
102
|
-
|
|
103
91
|
timeoutRef.current = setTimeout(function () {
|
|
104
92
|
var _tag$hooks;
|
|
105
|
-
|
|
106
93
|
// clear
|
|
107
94
|
var tag = panoTagPlugin.current.getTagById(id);
|
|
108
95
|
if (!tag) return;
|
|
109
|
-
|
|
110
96
|
if (tag.state) {
|
|
111
97
|
tag.state.unfolded = false;
|
|
112
98
|
panoTagPlugin.current.updateRenderAllTags();
|
|
113
99
|
}
|
|
114
|
-
|
|
115
100
|
(_tag$hooks = tag.hooks) === null || _tag$hooks === void 0 ? void 0 : _tag$hooks.on('folded', function () {
|
|
116
101
|
setTimeout(function () {
|
|
117
102
|
if (tag.state) {
|
|
@@ -122,11 +107,9 @@ function PanoTag() {
|
|
|
122
107
|
});
|
|
123
108
|
}, end - start);
|
|
124
109
|
};
|
|
125
|
-
|
|
126
110
|
controller.on(_VreoUnit.VreoKeyframeEnum.PanoTag, callback);
|
|
127
111
|
return function () {
|
|
128
112
|
controller.off(_VreoUnit.VreoKeyframeEnum.PanoTag, callback);
|
|
129
|
-
|
|
130
113
|
if (timeoutRef.current) {
|
|
131
114
|
clearTimeout(timeoutRef.current);
|
|
132
115
|
}
|
|
@@ -1,42 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.PanoTextLabel = PanoTextLabel;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var THREE = _interopRequireWildcard(require("three"));
|
|
13
|
-
|
|
14
10
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
15
|
-
|
|
16
11
|
var _hooks = require("../../../hooks");
|
|
17
|
-
|
|
18
12
|
var _CSS3DRenderPlugin = require("../../../../fivePlugins/CSS3DRenderPlugin");
|
|
19
|
-
|
|
20
13
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
|
|
26
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
17
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
-
|
|
30
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."); }
|
|
31
|
-
|
|
32
19
|
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); }
|
|
33
|
-
|
|
34
20
|
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; }
|
|
35
|
-
|
|
36
21
|
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; }
|
|
37
|
-
|
|
38
22
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
-
|
|
40
23
|
/**
|
|
41
24
|
* 通过传入中心点确定矩形框架容器的四个点:
|
|
42
25
|
* 1. 已知矩形长宽和中心点
|
|
@@ -48,11 +31,11 @@ var calcPoints = function calcPoints(centerPoint, normal, wrapperLength, wrapper
|
|
|
48
31
|
var length = wrapperLength / 375;
|
|
49
32
|
var width = wrapperWidth / 375;
|
|
50
33
|
var geometry = new THREE.PlaneGeometry(length, width);
|
|
51
|
-
|
|
52
34
|
if (normal) {
|
|
53
35
|
var lookPoint = new THREE.Vector3(normal.x + centerPoint.x, normal.y + centerPoint.y, normal.z + centerPoint.z);
|
|
54
36
|
geometry.lookAt(lookPoint);
|
|
55
|
-
}
|
|
37
|
+
}
|
|
38
|
+
// const pointgeometry = new THREE.Geometry()
|
|
56
39
|
// pointgeometry.vertices.push(cameraPosition)
|
|
57
40
|
// const pointmaterial = new THREE.PointsMaterial({
|
|
58
41
|
// color: 0xffffff,
|
|
@@ -60,33 +43,32 @@ var calcPoints = function calcPoints(centerPoint, normal, wrapperLength, wrapper
|
|
|
60
43
|
// })
|
|
61
44
|
// _point = new THREE.Points(pointgeometry, pointmaterial)
|
|
62
45
|
|
|
63
|
-
|
|
64
46
|
var material = new THREE.MeshBasicMaterial({
|
|
65
47
|
color: 0xffff00,
|
|
66
48
|
side: THREE.DoubleSide
|
|
67
49
|
});
|
|
68
50
|
var plane = new THREE.Mesh(geometry, material);
|
|
69
51
|
var v0 = centerPoint.clone();
|
|
70
|
-
plane.position.copy(v0);
|
|
52
|
+
plane.position.copy(v0);
|
|
71
53
|
|
|
54
|
+
// 计算传入的四个点的坐标
|
|
72
55
|
var _plane$geometry$verti = _slicedToArray(plane.geometry.vertices, 4),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
56
|
+
v1 = _plane$geometry$verti[0],
|
|
57
|
+
v2 = _plane$geometry$verti[1],
|
|
58
|
+
v3 = _plane$geometry$verti[2],
|
|
59
|
+
v4 = _plane$geometry$verti[3];
|
|
78
60
|
var downLeft = v0.clone().add(v4);
|
|
79
61
|
var downRight = v0.clone().add(v3);
|
|
80
62
|
var upLeft = v0.clone().add(v2);
|
|
81
|
-
var upRight = v0.clone().add(v1);
|
|
63
|
+
var upRight = v0.clone().add(v1);
|
|
82
64
|
|
|
65
|
+
// 插件使用要求:矩形四个点位数据,顺序为**必须**为左下、右下、右上、左上
|
|
83
66
|
return [downLeft, downRight, upRight, upLeft];
|
|
84
67
|
};
|
|
68
|
+
|
|
85
69
|
/**
|
|
86
70
|
* 空间文本标签。
|
|
87
71
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
72
|
function PanoTextLabel() {
|
|
91
73
|
var timeoutRef = React.useRef();
|
|
92
74
|
var controller = (0, _hooks.useController)();
|
|
@@ -94,39 +76,35 @@ function PanoTextLabel() {
|
|
|
94
76
|
var ref = React.useRef();
|
|
95
77
|
React.useEffect(function () {
|
|
96
78
|
var _controller$configs;
|
|
97
|
-
|
|
98
79
|
if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.PanoTextLabel) === false) {
|
|
99
80
|
return;
|
|
100
81
|
}
|
|
101
|
-
|
|
102
82
|
var callback = function callback(keyframe) {
|
|
103
83
|
var _panoTextLabelData$no, _panoTextLabelData$no2, _panoTextLabelData$no3;
|
|
104
|
-
|
|
105
84
|
var start = keyframe.start,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var panoTextLabelData = data;
|
|
109
|
-
|
|
85
|
+
end = keyframe.end,
|
|
86
|
+
data = keyframe.data;
|
|
87
|
+
var panoTextLabelData = data;
|
|
88
|
+
// 增加无文本情况的判断
|
|
110
89
|
if (data.text === '') return;
|
|
111
90
|
var _panoTextLabelData$ve = panoTextLabelData.vertex,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
91
|
+
x = _panoTextLabelData$ve.x,
|
|
92
|
+
y = _panoTextLabelData$ve.y,
|
|
93
|
+
z = _panoTextLabelData$ve.z;
|
|
115
94
|
var centerPoint = new THREE.Vector3(x, y, z);
|
|
116
|
-
var normal = new THREE.Vector3((_panoTextLabelData$no = panoTextLabelData.normal) === null || _panoTextLabelData$no === void 0 ? void 0 : _panoTextLabelData$no.x, (_panoTextLabelData$no2 = panoTextLabelData.normal) === null || _panoTextLabelData$no2 === void 0 ? void 0 : _panoTextLabelData$no2.y, (_panoTextLabelData$no3 = panoTextLabelData.normal) === null || _panoTextLabelData$no3 === void 0 ? void 0 : _panoTextLabelData$no3.z);
|
|
117
|
-
|
|
95
|
+
var normal = new THREE.Vector3((_panoTextLabelData$no = panoTextLabelData.normal) === null || _panoTextLabelData$no === void 0 ? void 0 : _panoTextLabelData$no.x, (_panoTextLabelData$no2 = panoTextLabelData.normal) === null || _panoTextLabelData$no2 === void 0 ? void 0 : _panoTextLabelData$no2.y, (_panoTextLabelData$no3 = panoTextLabelData.normal) === null || _panoTextLabelData$no3 === void 0 ? void 0 : _panoTextLabelData$no3.z);
|
|
96
|
+
// 生成传入的四个点,将文本框最大宽度定在200px,最高高度在30px
|
|
118
97
|
var wrapperLength = 200;
|
|
119
98
|
var wrapperWidth = 30;
|
|
120
99
|
var points = calcPoints(centerPoint, panoTextLabelData.normal && normal, wrapperLength, wrapperWidth);
|
|
121
100
|
if (!ref.current) ref.current = (0, _CSS3DRenderPlugin.CSS3DRenderPlugin)(five);
|
|
122
101
|
var container = ref.current.create3DDomContainer(points);
|
|
123
|
-
var css3DObject = container === null || container === void 0 ? void 0 : container.css3DObject;
|
|
124
|
-
|
|
102
|
+
var css3DObject = container === null || container === void 0 ? void 0 : container.css3DObject;
|
|
103
|
+
// 将获取的mesh进行旋转操作,根据欧拉角去进行mesh的变换
|
|
125
104
|
if (data.quaternion) {
|
|
126
105
|
var quaternion = new THREE.Quaternion(data.quaternion.x, data.quaternion.y, data.quaternion.z, data.quaternion.w);
|
|
127
106
|
css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.quaternion.copy(quaternion);
|
|
128
107
|
}
|
|
129
|
-
|
|
130
108
|
if (container !== null && container !== void 0 && container.container) _reactDom["default"].render( /*#__PURE__*/React.createElement("div", {
|
|
131
109
|
className: "PanoTextLabel PanoTextLabel--notHidden"
|
|
132
110
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -139,15 +117,12 @@ function PanoTextLabel() {
|
|
|
139
117
|
}, data.text || ''))), container === null || container === void 0 ? void 0 : container.container);
|
|
140
118
|
timeoutRef.current = setTimeout(function () {
|
|
141
119
|
var _ref$current;
|
|
142
|
-
|
|
143
120
|
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.disposeAll();
|
|
144
121
|
}, end - start);
|
|
145
122
|
};
|
|
146
|
-
|
|
147
123
|
controller.on(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
|
|
148
124
|
return function () {
|
|
149
125
|
controller.off(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
|
|
150
|
-
|
|
151
126
|
if (timeoutRef.current) {
|
|
152
127
|
clearTimeout(timeoutRef.current);
|
|
153
128
|
}
|