@realsee/vreo 2.4.0 → 2.4.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 +12 -22
- package/lib/PlayController/index.js +70 -137
- package/lib/Player/App.d.ts +2 -2
- package/lib/Player/App.js +1 -28
- package/lib/Player/Controller.d.ts +3 -3
- package/lib/Player/Controller.js +46 -110
- package/lib/Player/custom/SpatialScenePanel/index.d.ts +2 -2
- package/lib/Player/custom/SpatialScenePanel/index.js +75 -72
- package/lib/Player/hooks.d.ts +3 -3
- package/lib/Player/hooks.js +0 -10
- package/lib/Player/index.js +109 -175
- package/lib/Player/modules/Drawer/index.d.ts +2 -2
- package/lib/Player/modules/Drawer/index.js +2 -21
- package/lib/Player/modules/PopUp/index.d.ts +2 -2
- package/lib/Player/modules/PopUp/index.js +1 -12
- package/lib/Player/modules/ResizeObserver/index.d.ts +2 -2
- package/lib/Player/modules/ResizeObserver/index.js +0 -8
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +146 -245
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +7 -23
- package/lib/Player/modules/VideoAgent/index.d.ts +2 -2
- package/lib/Player/modules/VideoAgent/index.js +2 -20
- package/lib/Player/modules/Wave/index.d.ts +2 -2
- package/lib/Player/modules/Wave/index.js +12 -34
- package/lib/Player/modules/keyframes/BgMusic/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/BgMusic/index.js +41 -64
- package/lib/Player/modules/keyframes/CameraMovement/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/CameraMovement/index.js +42 -71
- package/lib/Player/modules/keyframes/InfoPanel/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/InfoPanel/index.js +16 -47
- package/lib/Player/modules/keyframes/ModelVideo/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/ModelVideo/index.js +52 -83
- package/lib/Player/modules/keyframes/PanoEffect/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/PanoEffect/index.js +16 -40
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -9
- package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -1
- package/lib/Player/modules/keyframes/PanoTag/index.js +6 -25
- package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +31 -50
- package/lib/Player/modules/keyframes/Prompter/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/Prompter/index.js +11 -29
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +25 -29
- package/lib/Player/modules/keyframes/VideoEffect/index.d.ts +2 -2
- package/lib/Player/modules/keyframes/VideoEffect/index.js +52 -87
- package/lib/Player/typings.d.ts +7 -4
- 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.d.ts +1 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +42 -81
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +3 -7
- package/lib/fivePlugins/CameraMovementPlugin/index.js +181 -241
- package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +4 -4
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -12
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +37 -87
- package/lib/index.js +0 -1
- package/lib/react/index.d.ts +2 -1
- package/lib/react/index.js +10 -35
- package/lib/shared-utils/Audio.js +57 -106
- package/lib/shared-utils/AudioLike.d.ts +1 -1
- package/lib/shared-utils/AudioLike.js +19 -46
- package/lib/shared-utils/Preloader.js +2 -10
- package/lib/shared-utils/addResizeListener.d.ts +1 -1
- package/lib/shared-utils/addResizeListener.js +0 -5
- package/lib/shared-utils/animationFrame/BetterTween.d.ts +1 -1
- package/lib/shared-utils/animationFrame/BetterTween.js +14 -45
- package/lib/shared-utils/animationFrame/index.d.ts +1 -2
- package/lib/shared-utils/animationFrame/index.js +3 -12
- package/lib/shared-utils/animationFrame/tween.d.ts +2 -2
- package/lib/shared-utils/animationFrame/tween.js +3 -14
- package/lib/shared-utils/createTransMatrix.js +1 -10
- package/lib/shared-utils/getFileExpandedName.js +0 -1
- package/lib/shared-utils/getMediaInfo.d.ts +3 -3
- package/lib/shared-utils/getMediaInfo.js +0 -10
- package/lib/shared-utils/setElementDataset.js +0 -2
- package/lib/typings/VreoUnit.d.ts +16 -16
- package/lib/typings/VreoUnit.js +115 -47
- package/package.json +3 -2
|
@@ -1,31 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.SpatialScenePanel = SpatialScenePanel;
|
|
11
|
-
|
|
12
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
|
|
14
10
|
var React = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
11
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
17
|
-
|
|
18
12
|
var _three = require("three");
|
|
19
|
-
|
|
20
13
|
var _BetterTween = require("../../../shared-utils/animationFrame/BetterTween");
|
|
21
|
-
|
|
22
14
|
var _CSS3DRenderPlugin = require("../../../fivePlugins/CSS3DRenderPlugin");
|
|
23
|
-
|
|
24
15
|
var _VreoUnit = require("../../../typings/VreoUnit");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
|
+
// __debug__
|
|
18
|
+
// const mockData: SpatialScenePanelData = {
|
|
19
|
+
// customType: 'SpatialScenePanel',
|
|
20
|
+
// "stateList": [
|
|
21
|
+
// {
|
|
22
|
+
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___fc42f951076607a22fd5c54f005ba553.png",
|
|
23
|
+
// "text": "窗帘关闭"
|
|
24
|
+
// },
|
|
25
|
+
// {
|
|
26
|
+
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___b331e7ad732debc07250a169a3393b13.png",
|
|
27
|
+
// "text": "摄像头休眠"
|
|
28
|
+
// },
|
|
29
|
+
// {
|
|
30
|
+
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___2e425a81ac0ad88232d50d4e52a9abfa.png",
|
|
31
|
+
// "text": "氛围音乐"
|
|
32
|
+
// },
|
|
33
|
+
// {
|
|
34
|
+
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___bff48bb81cde37aa6a319d6f5d56e3a4.png",
|
|
35
|
+
// "text": "空调打开"
|
|
36
|
+
// }
|
|
37
|
+
// ],
|
|
38
|
+
// "temperature": "27",
|
|
39
|
+
// "title": "沉浸式回家"
|
|
40
|
+
// }
|
|
29
41
|
|
|
30
42
|
// const getSphere = (position: Vector3, color = 0xffff00) => {
|
|
31
43
|
// const geometry = new SphereGeometry(0.05, 32, 16)
|
|
@@ -34,28 +46,27 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
34
46
|
// sphere.position.copy(position)
|
|
35
47
|
// return sphere
|
|
36
48
|
// }
|
|
49
|
+
|
|
37
50
|
var searchV1 = function searchV1(_ref) {
|
|
38
51
|
var five = _ref.five,
|
|
39
|
-
|
|
52
|
+
dom = _ref.dom;
|
|
40
53
|
var cameraDirection = new _three.Vector3();
|
|
41
54
|
five.camera.getWorldDirection(cameraDirection);
|
|
42
55
|
var cameraPosition = five.camera.position;
|
|
43
|
-
|
|
44
56
|
var _five$model$intersect = five.model.intersectRaycaster(new _three.Raycaster(cameraPosition, cameraDirection)),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
_five$model$intersect2 = (0, _slicedToArray2["default"])(_five$model$intersect, 1),
|
|
58
|
+
intersect = _five$model$intersect2[0];
|
|
48
59
|
var point = five.project2d(intersect.point);
|
|
49
|
-
var widescreen = window.innerWidth > 560 ? true : false;
|
|
50
|
-
|
|
60
|
+
var widescreen = window.innerWidth > 560 ? true : false;
|
|
61
|
+
// const width = dom!.clientWidth
|
|
51
62
|
var height = dom.clientHeight;
|
|
52
63
|
dom.style.left = point.x + 'px';
|
|
53
64
|
dom.style.top = point.y - height / 2 + 'px';
|
|
54
65
|
var rect = dom.getBoundingClientRect();
|
|
55
66
|
var left = rect.left,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
top = rect.top,
|
|
68
|
+
bottom = rect.bottom,
|
|
69
|
+
right = rect.right;
|
|
59
70
|
var leftBottom = new _three.Vector3(left, bottom);
|
|
60
71
|
var leftTop = new _three.Vector3(left, top);
|
|
61
72
|
var rightTop = new _three.Vector3(right, top);
|
|
@@ -65,23 +76,24 @@ var searchV1 = function searchV1(_ref) {
|
|
|
65
76
|
point.setY(-(point.y / window.innerHeight) * 2 + (widescreen ? 1.35 : 1.125));
|
|
66
77
|
point.setZ(0.5);
|
|
67
78
|
return point.unproject(five.camera).addScaledVector(cameraDirection, 0.2);
|
|
68
|
-
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// __debug__
|
|
69
82
|
// const colors = [0xdc143c, 0xffff00, 0x0000ff, 0x008000]
|
|
70
83
|
// points.forEach((p, index) => five.scene.add(getSphere(p, colors[index])))
|
|
71
|
-
// 判断是手机 150
|
|
72
84
|
|
|
85
|
+
// 判断是手机 150
|
|
73
86
|
var ratio = leftBottom.distanceTo(rightBottom) / (widescreen ? 150 : 120);
|
|
74
87
|
return {
|
|
75
88
|
points: points,
|
|
76
89
|
ratio: ratio
|
|
77
90
|
};
|
|
78
91
|
};
|
|
92
|
+
|
|
79
93
|
/**
|
|
80
94
|
* 空间场景面板
|
|
81
95
|
* @returns
|
|
82
96
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
97
|
function SpatialScenePanel(props) {
|
|
86
98
|
var timeoutRef = React.useRef(null);
|
|
87
99
|
var ref = React.useRef(null);
|
|
@@ -91,84 +103,78 @@ function SpatialScenePanel(props) {
|
|
|
91
103
|
if (!ref.current) {
|
|
92
104
|
return;
|
|
93
105
|
}
|
|
94
|
-
|
|
95
106
|
var callback = function callback(keyframe) {
|
|
96
107
|
if (keyframe.data.customType !== 'SpatialScenePanel') {
|
|
97
108
|
return;
|
|
98
109
|
}
|
|
110
|
+
var data = keyframe.data;
|
|
99
111
|
|
|
100
|
-
|
|
101
|
-
|
|
112
|
+
// const data = mockData
|
|
102
113
|
var _searchV = searchV1({
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
114
|
+
five: props.five,
|
|
115
|
+
dom: ref.current
|
|
116
|
+
}),
|
|
117
|
+
points = _searchV.points,
|
|
118
|
+
ratio = _searchV.ratio;
|
|
109
119
|
var _ref2 = rendererRef.current.create3DDomContainer(points, {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
ratio: ratio,
|
|
121
|
+
autoRender: false
|
|
122
|
+
}) || {},
|
|
123
|
+
container = _ref2.container,
|
|
124
|
+
dispose = _ref2.dispose,
|
|
125
|
+
css3DObject = _ref2.css3DObject,
|
|
126
|
+
render = _ref2.render;
|
|
118
127
|
Object.assign(window, {
|
|
119
128
|
$css3DObject: css3DObject
|
|
120
129
|
});
|
|
121
130
|
if (!container) return;
|
|
122
|
-
|
|
123
|
-
_reactDom["default"].render( /*#__PURE__*/React.createElement(Panel, {
|
|
131
|
+
_reactDom["default"].render(/*#__PURE__*/React.createElement(Panel, {
|
|
124
132
|
ref: function ref(_ref3) {
|
|
125
133
|
return panelRef.current = _ref3;
|
|
126
134
|
},
|
|
127
135
|
data: data
|
|
128
136
|
}), container);
|
|
129
|
-
|
|
130
137
|
var startRotateY = -(Math.PI * 2) / 9;
|
|
131
138
|
var lastRotateY = 0;
|
|
132
139
|
(0, _BetterTween.tweenProgress)(1000).onUpdate(function (_ref4) {
|
|
133
140
|
var progress = _ref4.progress;
|
|
134
141
|
var needRotateY = Math.PI / 90 * 11 * progress;
|
|
135
142
|
var rotateY = needRotateY - lastRotateY;
|
|
136
|
-
css3DObject === null || css3DObject === void 0
|
|
137
|
-
|
|
143
|
+
css3DObject === null || css3DObject === void 0 || css3DObject.rotateY(rotateY);
|
|
144
|
+
// css3DObject?.rotateZ
|
|
138
145
|
lastRotateY = needRotateY;
|
|
139
146
|
}).onStart(function () {
|
|
140
|
-
css3DObject === null || css3DObject === void 0
|
|
147
|
+
css3DObject === null || css3DObject === void 0 || css3DObject.rotateY(startRotateY);
|
|
141
148
|
render();
|
|
142
149
|
}).onDispose(function () {
|
|
143
150
|
var _panelRef$current;
|
|
151
|
+
(_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 || _panelRef$current.classList.add('show');
|
|
152
|
+
}).play();
|
|
144
153
|
|
|
145
|
-
|
|
146
|
-
}).play(); // Object.assign(window, { $dispose: () => {
|
|
154
|
+
// Object.assign(window, { $dispose: () => {
|
|
147
155
|
// panelRef.current?.classList.add('hide')
|
|
148
156
|
// setTimeout(() => dispose?.(), 1500)
|
|
149
157
|
// } })
|
|
150
158
|
|
|
151
159
|
var start = keyframe.start,
|
|
152
|
-
|
|
160
|
+
end = keyframe.end;
|
|
153
161
|
timeoutRef.current = setTimeout(function () {
|
|
154
162
|
var _panelRef$current2;
|
|
155
|
-
|
|
156
|
-
(_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0 ? void 0 : _panelRef$current2.classList.add('hide');
|
|
163
|
+
(_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0 || _panelRef$current2.classList.add('hide');
|
|
157
164
|
timeoutRef.current = setTimeout(function () {
|
|
158
|
-
dispose === null || dispose === void 0
|
|
165
|
+
dispose === null || dispose === void 0 || dispose();
|
|
159
166
|
timeoutRef.current = null;
|
|
160
167
|
}, 1500);
|
|
161
168
|
}, end - start);
|
|
162
169
|
};
|
|
163
|
-
|
|
164
170
|
Object.assign(window, {
|
|
165
171
|
$callback: callback
|
|
166
|
-
});
|
|
172
|
+
});
|
|
167
173
|
|
|
174
|
+
// setTimeout(() => {callback()}, 8000)
|
|
168
175
|
props.subscribe.on(_VreoUnit.VreoKeyframeEnum.Custom, callback);
|
|
169
176
|
return function () {
|
|
170
177
|
props.subscribe.off(_VreoUnit.VreoKeyframeEnum.Custom, callback);
|
|
171
|
-
|
|
172
178
|
if (timeoutRef.current) {
|
|
173
179
|
clearTimeout(timeoutRef.current);
|
|
174
180
|
}
|
|
@@ -179,27 +185,22 @@ function SpatialScenePanel(props) {
|
|
|
179
185
|
ref: ref
|
|
180
186
|
});
|
|
181
187
|
}
|
|
182
|
-
/** 背景动画:控制延迟 */
|
|
183
|
-
|
|
184
188
|
|
|
189
|
+
/** 背景动画:控制延迟 */
|
|
185
190
|
function SpatialScenePanelBg() {
|
|
186
191
|
var ref = React.useRef(null);
|
|
187
192
|
var timeoutRef = React.useRef(null);
|
|
188
193
|
React.useEffect(function () {
|
|
189
194
|
if (!ref.current) return;
|
|
190
|
-
|
|
191
195
|
var listener = function listener() {
|
|
192
196
|
var _ref$current;
|
|
193
|
-
|
|
194
|
-
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.setAttribute('class', 'SpatialScenePanel-bg');
|
|
197
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.setAttribute('class', 'SpatialScenePanel-bg');
|
|
195
198
|
timeoutRef.current = setTimeout(function () {
|
|
196
199
|
var _ref$current2;
|
|
197
|
-
|
|
198
|
-
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.setAttribute('class', 'SpatialScenePanel-bg SpatialScenePanel-bg--animation');
|
|
200
|
+
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 || _ref$current2.setAttribute('class', 'SpatialScenePanel-bg SpatialScenePanel-bg--animation');
|
|
199
201
|
timeoutRef.current = null;
|
|
200
202
|
}, 3000);
|
|
201
203
|
};
|
|
202
|
-
|
|
203
204
|
ref.current.addEventListener('animationend', listener);
|
|
204
205
|
return function () {
|
|
205
206
|
if (ref.current) ref.current.removeEventListener('animationend', listener);
|
|
@@ -211,10 +212,8 @@ function SpatialScenePanelBg() {
|
|
|
211
212
|
className: "SpatialScenePanel-bg SpatialScenePanel-bg--animation"
|
|
212
213
|
});
|
|
213
214
|
}
|
|
214
|
-
|
|
215
215
|
var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
|
|
216
|
-
var _props$data, _props$data2, _props$data3
|
|
217
|
-
|
|
216
|
+
var _props$data, _props$data2, _props$data3;
|
|
218
217
|
return /*#__PURE__*/React.createElement("div", {
|
|
219
218
|
className: "SpatialScenePanel",
|
|
220
219
|
ref: myRef
|
|
@@ -228,7 +227,7 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
|
|
|
228
227
|
className: "SpatialScenePanel-temperature"
|
|
229
228
|
}, (_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.temperature, "\u2103")), /*#__PURE__*/React.createElement("div", {
|
|
230
229
|
className: "SpatialScenePanel-body"
|
|
231
|
-
}, (_props$data3 = props.data) === null || _props$data3 === void 0
|
|
230
|
+
}, (_props$data3 = props.data) === null || _props$data3 === void 0 || (_props$data3 = _props$data3.stateList) === null || _props$data3 === void 0 ? void 0 : _props$data3.map(function (state, index) {
|
|
232
231
|
return /*#__PURE__*/React.createElement("div", {
|
|
233
232
|
key: "scene-".concat(state.text),
|
|
234
233
|
className: "SpatialScenePanel-item index_".concat(index)
|
|
@@ -244,8 +243,11 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
|
|
|
244
243
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
245
244
|
className: "SpatialScenePanel-disappear-area"
|
|
246
245
|
}));
|
|
247
|
-
});
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// export function SpatialScenePanel() {
|
|
248
249
|
// // const data = mockData
|
|
250
|
+
|
|
249
251
|
// return (
|
|
250
252
|
// <div className="SpatialScenePanel" >
|
|
251
253
|
// <div className="SpatialScenePanel-show-area">
|
|
@@ -264,6 +266,7 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
|
|
|
264
266
|
// ))}
|
|
265
267
|
// </div>
|
|
266
268
|
// </div>
|
|
269
|
+
|
|
267
270
|
// <div className="SpatialScenePanel-disappear-area"></div>
|
|
268
271
|
// </div>
|
|
269
272
|
// )
|
package/lib/Player/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Vector3 } from 'three';
|
|
2
|
-
export declare function useController():
|
|
3
|
-
export declare function useFiveInstance():
|
|
4
|
-
export declare function useFiveProject2d(): (vector: Vector3) =>
|
|
2
|
+
export declare function useController(): import("./Controller").Controller;
|
|
3
|
+
export declare function useFiveInstance(): import("@realsee/five").Five;
|
|
4
|
+
export declare function useFiveProject2d(): (vector: Vector3) => import("three").Vector2 | null;
|
package/lib/Player/hooks.js
CHANGED
|
@@ -1,38 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.useController = useController;
|
|
9
8
|
exports.useFiveInstance = useFiveInstance;
|
|
10
9
|
exports.useFiveProject2d = useFiveProject2d;
|
|
11
|
-
|
|
12
10
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
11
|
var _Controller = require("./Controller");
|
|
15
|
-
|
|
16
12
|
function useController() {
|
|
17
13
|
var controller = _react["default"].useContext(_Controller.ControllerContext);
|
|
18
|
-
|
|
19
14
|
if (!controller) {
|
|
20
15
|
throw new Error('没有找到 "ControllerContext"');
|
|
21
16
|
}
|
|
22
|
-
|
|
23
17
|
return controller;
|
|
24
18
|
}
|
|
25
|
-
|
|
26
19
|
function useFiveInstance() {
|
|
27
20
|
var controller = useController();
|
|
28
|
-
|
|
29
21
|
if (!controller.five) {
|
|
30
22
|
throw new Error('没有找到 "five" 实例');
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
return controller.five;
|
|
34
25
|
}
|
|
35
|
-
|
|
36
26
|
function useFiveProject2d() {
|
|
37
27
|
var five = useFiveInstance();
|
|
38
28
|
return function (vector) {
|