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