@realsee/dnalogel 2.0.0-alpha.12 → 2.0.0-alpha.13
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/dist/CSS3DRenderPlugin/index.js +17 -14
- package/dist/CameraMovementPlugin/index.js +40 -15
- package/dist/ModelChassisCompassPlugin/index.js +32 -6
- package/dist/ModelEntryDoorGuidePlugin/index.js +48 -18
- package/dist/ModelItemLabelPlugin/index.js +18 -17
- package/dist/ModelRoomLabelPlugin/index.js +67 -26
- package/dist/PanoCompassPlugin/index.js +311 -164
- package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
- package/dist/PanoMeasurePlugin/index.js +1337 -583
- package/dist/PanoRulerPlugin/index.js +32 -5
- package/dist/PanoSpatialTagPlugin/index.js +64 -29
- package/dist/floorplan/ModelFloorplanPlugin/index.js +586 -362
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +311 -153
- package/dist/index.es.js +2663 -1341
- package/dist/index.js +2667 -1345
- package/dist/index.umd.js +2667 -1345
- package/docs/assets/main.js +1 -1
- package/docs/classes/ModelRoomLabelController.html +6 -6
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ModelFloorplanErrorType.html +1 -1
- package/docs/interfaces/LineJson.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
- package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
- package/docs/modules.html +12 -12
- package/libs/CSS3DRenderPlugin/index.js +16 -13
- package/libs/CameraMovementPlugin/index.js +24 -15
- package/libs/ModelChassisCompassPlugin/index.js +14 -5
- package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
- package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +12 -10
- package/libs/ModelItemLabelPlugin/index.js +5 -3
- package/libs/ModelItemLabelPlugin/utils/parseData.js +1 -4
- package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
- package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +3 -3
- package/libs/PanoCompassPlugin/index.js +225 -128
- package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
- package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
- package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
- package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
- package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
- package/libs/PanoMeasurePlugin/Model/index.js +30 -5
- package/libs/PanoMeasurePlugin/Model/line.js +60 -10
- package/libs/PanoMeasurePlugin/Model/point.js +24 -4
- package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
- package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
- package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
- package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
- package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
- package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
- package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
- package/libs/PanoMeasurePlugin/utils/line.js +8 -7
- package/libs/PanoRulerPlugin/index.js +16 -5
- package/libs/PanoSpatialTagPlugin/index.js +11 -9
- package/libs/floorplan/Components/BaseImage.js +10 -5
- package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
- package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
- package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +7 -2
- package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +456 -273
- package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
- package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +231 -108
- package/libs/floorplan/utils/formatData.js +43 -28
- package/libs/floorplan/utils/formatPosition.js +1 -1
- package/libs/shared-utils/Subscribe.js +8 -1
- package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
- package/libs/shared-utils/createCanvasTextTexture.js +6 -5
- package/libs/shared-utils/five/changeMode.js +23 -12
- package/libs/shared-utils/getPxmm.js +1 -1
- package/libs/shared-utils/math/evenNumber.js +1 -1
- package/libs/shared-utils/three/loadFbxObj.js +20 -9
- package/libs/shared-utils/three/loadTexture.js +17 -6
- package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
- package/libs/shared-utils/tinyEJSrender.js +36 -6
- package/libs/shared-utils/to.js +21 -10
- package/libs/shared-utils/useDebounce.js +1 -1
- package/libs/shared-utils/useThrottle.js +2 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -41
|
@@ -29,6 +29,31 @@ function _interopNamespace(e) {
|
|
|
29
29
|
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
30
30
|
var TWEEN__default = /*#__PURE__*/_interopDefaultLegacy(TWEEN);
|
|
31
31
|
|
|
32
|
+
/*! *****************************************************************************
|
|
33
|
+
Copyright (c) Microsoft Corporation.
|
|
34
|
+
|
|
35
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
36
|
+
purpose with or without fee is hereby granted.
|
|
37
|
+
|
|
38
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
39
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
40
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
41
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
42
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
43
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
44
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
45
|
+
***************************************************************************** */
|
|
46
|
+
|
|
47
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
48
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
49
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
50
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
51
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
52
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
53
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
32
57
|
const roomInfoIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZIAAABCCAYAAAB9y1BhAAAAAXNSR0IArs4c6QAADh5JREFUeAHtnVuPLDcVhedwC/dACKAICDxEIBQpygNI/Ab+MX8B8YCQEAjxgBAQLsm5Jjkn58r6Sl4jT52qnu4zXd121dqSx67q7ip7eXsv721XzcVFJAgEgSAQBIJAEAgCQeC4CLx48eKbSu+RH/fKuVoQWB8Cn1tfk9KiIHAUBH6tq/xKiTwSBILADgRCJDvAyUebRuAbpfXxSDatBmn8Pgh8YZ8v5TtBYIMIvFCbSZEgEASuQSBEcg1A+XizCDzfbMvT8CBwIAIhkgMBy9c3g0CIZDNdnYbeFIEQyU0RzO/XikCIZK09m3YdHYEQydEhzQVXgkCIZCUdmWYsj0CIZHmMc4c+EchCe5/9llqfAYEQyRlAzy27QCAeSRfdlEq2gECIpIVeSB1aRAAiudVixVKnINAaAiGS1nok9WkFAUJb8Upa6Y3Uo2kEQiRNd08qd0YEQiJnBD+37guBEElf/ZXang6BEMnpsM6dOkcgRNJ5B66x+nrjLmsTX1J6bSJHZ7+o9HklynWaOse1eKcc+XVlvxYFEnlfaThWfb7mcsn5nPRM6WmVU55KfO+J0mdKj8f5rVu3skNMoET6RSBE0m/fdVNzGWII4StKXy65y18t58aEAVGcUjDkGHsLhIOYfCC1xUT4QDJjgnmkc58qkT8saSiLeCCkSBBoBoEQSTNd0V9FZADRH8iAGfvXS06Zc5CFCePQt0y3EFaq61CX1ayjC56U8br24sKd+kAuJhkI55OSPi75pyIcvKNIEFgcgRDJ4hD3ewMZLDwDXqfOq9RNFCYOCAMPYx851BDjIXiWzky9Tpyvw0kOL/nc+Jh7DyGqko+P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sXT2pBP1VyaSQiCse9Coqa27LApBIPE+BEKkLwSk32zRHESDkp0zkSDQBALF9uKdYHunnkthwo7tfXQqQjmYSNQImBACIU2xIuGreB8CIdIvAtJzNogMosHI4mYkCDSHgPTUXspU2ItoEIvzEArlxWRvIlGFWTSnsnWF+b1dKAhk8QrrHpEgsDgC0ndi0oNoEBIuiASBZhGQvnqCz/KCJ/jYZtto7DPRoUU2N11LJIXxqNyUC0VFqeCTpRlP94gEgZMhIL0nbDCIdJswQSQINI9AIRRsNRP+KfvOkgNrKEddr5660YUqw3k8EAhkbvsuCztPVSF7JDqMBIF1IKAxcOl5S8eZLEWCQDcIFBtO2Kv2UOr645lAKkex4VeIpLo5jHbls1KD4eYaWIu4R+UeyYLA2RHQWGAADiJ9P9u2StcheRB4VQSkyzgD2PQppwBH4MaEMpBFRSDcqCYQx9ggDphr0QUb3SMSBJpAQGPiciei9P6oYYAmGphKbA4B6TRrJ+j1HKHYzh8cZbpVBowXZ8bgQhzPNJAOvvD4QjkOAj0hUAbdUOVMoHrqudT1OgSk2zgLkAl2n/LYvh9s900kutYV4UIvQiBXMMlBEAgCQWA1CBRCgUjmHAkI5vk+PACR1BcZmGmfH64GzTQkCASBILBhBAqhgEC9rDFGJI7FGJEcB4EgEASCQBAIAkEgCASBIBAEgkAQCAJBIAgEgSAQBIJAEAgCm0fg/x4jQQWGalpFAAAAAElFTkSuQmCC';
|
|
33
58
|
|
|
34
59
|
function getRoomInfoInstance() {
|
|
@@ -80,18 +105,20 @@ function getRoomInfoInstance() {
|
|
|
80
105
|
}
|
|
81
106
|
|
|
82
107
|
const textureLoader = new THREE__namespace.TextureLoader();
|
|
83
|
-
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
texture
|
|
88
|
-
|
|
108
|
+
function loadTexture(url) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
return new Promise((resolve, reject) => {
|
|
111
|
+
textureLoader.load(url, resolve, undefined, reject);
|
|
112
|
+
}).then((texture) => {
|
|
113
|
+
texture.encoding = THREE__namespace.sRGBEncoding;
|
|
114
|
+
return texture;
|
|
115
|
+
});
|
|
89
116
|
});
|
|
90
117
|
}
|
|
91
118
|
|
|
92
119
|
function evenNumber(num, config) {
|
|
93
120
|
const roundNum = Math.round(num);
|
|
94
|
-
return roundNum % 2 === 0 ? roundNum : roundNum + Number(config
|
|
121
|
+
return roundNum % 2 === 0 ? roundNum : roundNum + Number((config === null || config === void 0 ? void 0 : config.smaller) ? -1 : 1);
|
|
95
122
|
}
|
|
96
123
|
|
|
97
124
|
function centerPoint(point1, point2) {
|
|
@@ -128,24 +155,25 @@ function createResizeObserver(func, element) {
|
|
|
128
155
|
const CSS3DRenderPlugin = (five) => {
|
|
129
156
|
const state = { disposeCallbacks: [] };
|
|
130
157
|
const create3DDomContainer = (...params) => {
|
|
158
|
+
var _a, _b, _c;
|
|
131
159
|
const points = params[0].map((point) => (point instanceof THREE.Vector3 ? point : transformPositionToVector3(point)));
|
|
132
160
|
const config = params[1];
|
|
133
|
-
if (points
|
|
161
|
+
if ((points === null || points === void 0 ? void 0 : points.length) < 4)
|
|
134
162
|
return console.error('points must be equal or greater than than 4');
|
|
135
|
-
if (!five
|
|
136
|
-
return console.error('five.model.loaded is: ', five
|
|
163
|
+
if (!((_a = five === null || five === void 0 ? void 0 : five.model) === null || _a === void 0 ? void 0 : _a.loaded))
|
|
164
|
+
return console.error('five.model.loaded is: ', (_b = five === null || five === void 0 ? void 0 : five.model) === null || _b === void 0 ? void 0 : _b.loaded);
|
|
137
165
|
const fiveElement = five.getElement();
|
|
138
166
|
if (!fiveElement)
|
|
139
167
|
return console.error('five.getElement() is ' + fiveElement);
|
|
140
168
|
const disposers = [];
|
|
141
|
-
const ratio = config
|
|
169
|
+
const ratio = (config === null || config === void 0 ? void 0 : config.ratio) || 0.00216;
|
|
142
170
|
if (ratio <= 0.00215)
|
|
143
171
|
console.warn('if you need click css3DElement on safari, ratio must be greater than 0.00215');
|
|
144
|
-
const dpr = config
|
|
145
|
-
const mode = config
|
|
146
|
-
const autoRender = config
|
|
147
|
-
const behindFiveContainer = config
|
|
148
|
-
const container = config
|
|
172
|
+
const dpr = (config === null || config === void 0 ? void 0 : config.dpr) || 1;
|
|
173
|
+
const mode = (config === null || config === void 0 ? void 0 : config.mode) || 'front';
|
|
174
|
+
const autoRender = (_c = config === null || config === void 0 ? void 0 : config.autoRender) !== null && _c !== void 0 ? _c : true;
|
|
175
|
+
const behindFiveContainer = (config === null || config === void 0 ? void 0 : config.behindFiveContainer) || fiveElement.parentElement || document.body;
|
|
176
|
+
const container = (config === null || config === void 0 ? void 0 : config.container) || document.createElement('div');
|
|
149
177
|
container.classList.add('__Dnalogel-plugin--CSS3DRenderPlugin');
|
|
150
178
|
// 获取css3DObject, 如果mode为behind的话,一起获取mesh
|
|
151
179
|
const { css3DObject, mesh } = createObject(points, { ratio, dpr, container, mode });
|
|
@@ -183,8 +211,9 @@ const CSS3DRenderPlugin = (five) => {
|
|
|
183
211
|
css3DRenderer.render(scene, five.camera);
|
|
184
212
|
};
|
|
185
213
|
return () => {
|
|
214
|
+
var _a;
|
|
186
215
|
scene.add(css3DObject);
|
|
187
|
-
resizeObserver
|
|
216
|
+
(_a = resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.observe) === null || _a === void 0 ? void 0 : _a.call(resizeObserver);
|
|
188
217
|
renderEveryFrame();
|
|
189
218
|
if (mode === 'behind' && mesh) {
|
|
190
219
|
five.scene.add(mesh);
|
|
@@ -208,7 +237,8 @@ const CSS3DRenderPlugin = (five) => {
|
|
|
208
237
|
}
|
|
209
238
|
// ======= INIT END =======
|
|
210
239
|
const dispose = () => {
|
|
211
|
-
|
|
240
|
+
var _a;
|
|
241
|
+
disposers.forEach((d) => d === null || d === void 0 ? void 0 : d());
|
|
212
242
|
scene.remove(css3DObject);
|
|
213
243
|
if (scene.children.length === 0) {
|
|
214
244
|
if (typeof stateMode.requestAnimationFrameId === 'number') {
|
|
@@ -220,7 +250,7 @@ const CSS3DRenderPlugin = (five) => {
|
|
|
220
250
|
if (mode === 'behind')
|
|
221
251
|
state.behindMode = undefined;
|
|
222
252
|
if (!state.behindMode && !state.frontMode) {
|
|
223
|
-
resizeObserver
|
|
253
|
+
(_a = resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.unobserve) === null || _a === void 0 ? void 0 : _a.call(resizeObserver);
|
|
224
254
|
}
|
|
225
255
|
}
|
|
226
256
|
return true;
|
|
@@ -285,7 +315,7 @@ const CSS3DRenderPlugin = (five) => {
|
|
|
285
315
|
return {
|
|
286
316
|
create3DDomContainer,
|
|
287
317
|
disposeAll: () => {
|
|
288
|
-
state.disposeCallbacks.forEach((d) => d
|
|
318
|
+
state.disposeCallbacks.forEach((d) => d === null || d === void 0 ? void 0 : d());
|
|
289
319
|
state.disposeCallbacks = [];
|
|
290
320
|
},
|
|
291
321
|
};
|
|
@@ -322,24 +352,53 @@ function requestAnimationFrameInterval(callback, frame = 60) {
|
|
|
322
352
|
// export { default as tween } from './tween'
|
|
323
353
|
|
|
324
354
|
class BetterTween extends TWEEN__default["default"].Tween {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
355
|
+
constructor() {
|
|
356
|
+
super(...arguments);
|
|
357
|
+
Object.defineProperty(this, "disposeMethods", {
|
|
358
|
+
enumerable: true,
|
|
359
|
+
configurable: true,
|
|
360
|
+
writable: true,
|
|
361
|
+
value: []
|
|
362
|
+
});
|
|
363
|
+
Object.defineProperty(this, "animationFrameDisposer", {
|
|
364
|
+
enumerable: true,
|
|
365
|
+
configurable: true,
|
|
366
|
+
writable: true,
|
|
367
|
+
value: void 0
|
|
368
|
+
});
|
|
369
|
+
Object.defineProperty(this, "onDispose", {
|
|
370
|
+
enumerable: true,
|
|
371
|
+
configurable: true,
|
|
372
|
+
writable: true,
|
|
373
|
+
value: (callback) => {
|
|
374
|
+
this.disposeMethods.push(callback);
|
|
375
|
+
return this;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
Object.defineProperty(this, "play", {
|
|
379
|
+
enumerable: true,
|
|
380
|
+
configurable: true,
|
|
381
|
+
writable: true,
|
|
382
|
+
value: () => {
|
|
383
|
+
this.start(0);
|
|
384
|
+
this.animationFrameDisposer = requestAnimationFrameInterval((time) => this.update(time));
|
|
385
|
+
return this;
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
Object.defineProperty(this, "dispose", {
|
|
389
|
+
enumerable: true,
|
|
390
|
+
configurable: true,
|
|
391
|
+
writable: true,
|
|
392
|
+
value: () => {
|
|
393
|
+
var _a;
|
|
394
|
+
this.stop();
|
|
395
|
+
(_a = this.animationFrameDisposer) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
396
|
+
this.disposeMethods.forEach((fn) => fn());
|
|
397
|
+
this.disposeMethods = [];
|
|
398
|
+
TWEEN__default["default"].remove(this);
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
}
|
|
343
402
|
}
|
|
344
403
|
function tweenProgress(duration, easing = TWEEN__default["default"].Easing.Linear.None) {
|
|
345
404
|
const tween = new BetterTween({ progress: 0 }).to({ progress: 1 });
|
|
@@ -358,17 +417,166 @@ const PanoCompassPlugin = function (five, config) {
|
|
|
358
417
|
return new PanoCompassController(five, config);
|
|
359
418
|
};
|
|
360
419
|
class PanoCompassController {
|
|
361
|
-
five;
|
|
362
|
-
data;
|
|
363
|
-
config;
|
|
364
|
-
group = new THREE__namespace.Group();
|
|
365
|
-
modelLoaded = false;
|
|
366
|
-
roomInfoInstance;
|
|
367
|
-
roomInfoWrapperInstance;
|
|
368
|
-
compassMeshTween;
|
|
369
|
-
compassMesh;
|
|
370
|
-
entryDoorMesh;
|
|
371
420
|
constructor(five, config) {
|
|
421
|
+
Object.defineProperty(this, "five", {
|
|
422
|
+
enumerable: true,
|
|
423
|
+
configurable: true,
|
|
424
|
+
writable: true,
|
|
425
|
+
value: void 0
|
|
426
|
+
});
|
|
427
|
+
Object.defineProperty(this, "data", {
|
|
428
|
+
enumerable: true,
|
|
429
|
+
configurable: true,
|
|
430
|
+
writable: true,
|
|
431
|
+
value: void 0
|
|
432
|
+
});
|
|
433
|
+
Object.defineProperty(this, "config", {
|
|
434
|
+
enumerable: true,
|
|
435
|
+
configurable: true,
|
|
436
|
+
writable: true,
|
|
437
|
+
value: void 0
|
|
438
|
+
});
|
|
439
|
+
Object.defineProperty(this, "group", {
|
|
440
|
+
enumerable: true,
|
|
441
|
+
configurable: true,
|
|
442
|
+
writable: true,
|
|
443
|
+
value: new THREE__namespace.Group()
|
|
444
|
+
});
|
|
445
|
+
Object.defineProperty(this, "modelLoaded", {
|
|
446
|
+
enumerable: true,
|
|
447
|
+
configurable: true,
|
|
448
|
+
writable: true,
|
|
449
|
+
value: false
|
|
450
|
+
});
|
|
451
|
+
Object.defineProperty(this, "roomInfoInstance", {
|
|
452
|
+
enumerable: true,
|
|
453
|
+
configurable: true,
|
|
454
|
+
writable: true,
|
|
455
|
+
value: void 0
|
|
456
|
+
});
|
|
457
|
+
Object.defineProperty(this, "roomInfoWrapperInstance", {
|
|
458
|
+
enumerable: true,
|
|
459
|
+
configurable: true,
|
|
460
|
+
writable: true,
|
|
461
|
+
value: void 0
|
|
462
|
+
});
|
|
463
|
+
Object.defineProperty(this, "compassMeshTween", {
|
|
464
|
+
enumerable: true,
|
|
465
|
+
configurable: true,
|
|
466
|
+
writable: true,
|
|
467
|
+
value: void 0
|
|
468
|
+
});
|
|
469
|
+
Object.defineProperty(this, "compassMesh", {
|
|
470
|
+
enumerable: true,
|
|
471
|
+
configurable: true,
|
|
472
|
+
writable: true,
|
|
473
|
+
value: void 0
|
|
474
|
+
});
|
|
475
|
+
Object.defineProperty(this, "entryDoorMesh", {
|
|
476
|
+
enumerable: true,
|
|
477
|
+
configurable: true,
|
|
478
|
+
writable: true,
|
|
479
|
+
value: void 0
|
|
480
|
+
});
|
|
481
|
+
Object.defineProperty(this, "dispose", {
|
|
482
|
+
enumerable: true,
|
|
483
|
+
configurable: true,
|
|
484
|
+
writable: true,
|
|
485
|
+
value: () => {
|
|
486
|
+
var _a, _b, _c, _d;
|
|
487
|
+
this.five.scene.remove(this.group);
|
|
488
|
+
this.group.remove(...this.group.children);
|
|
489
|
+
(_b = (_a = this.compassMesh) === null || _a === void 0 ? void 0 : _a.material.map) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
490
|
+
(_d = (_c = this.entryDoorMesh) === null || _c === void 0 ? void 0 : _c.material.map) === null || _d === void 0 ? void 0 : _d.dispose();
|
|
491
|
+
this.five.off('panoArrived', this.onFivePanoArrived);
|
|
492
|
+
this.five.off('panoWillArrive', this.onFivePanoWillArrive);
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
Object.defineProperty(this, "onFiveFistPanoLoaded", {
|
|
496
|
+
enumerable: true,
|
|
497
|
+
configurable: true,
|
|
498
|
+
writable: true,
|
|
499
|
+
value: () => {
|
|
500
|
+
this.modelLoaded = true;
|
|
501
|
+
if (this.data)
|
|
502
|
+
this.init();
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
Object.defineProperty(this, "onFivePanoWillArrive", {
|
|
506
|
+
enumerable: true,
|
|
507
|
+
configurable: true,
|
|
508
|
+
writable: true,
|
|
509
|
+
value: (panoIndex) => {
|
|
510
|
+
var _a, _b;
|
|
511
|
+
if (panoIndex === this.five.panoIndex)
|
|
512
|
+
return;
|
|
513
|
+
(_a = this.compassMeshTween) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
514
|
+
(_b = this.compassMesh) === null || _b === void 0 ? void 0 : _b.material.setValues({ opacity: 0 });
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
Object.defineProperty(this, "onFivePanoArrived", {
|
|
518
|
+
enumerable: true,
|
|
519
|
+
configurable: true,
|
|
520
|
+
writable: true,
|
|
521
|
+
value: (panoIndex) => {
|
|
522
|
+
var _a, _b, _c, _d;
|
|
523
|
+
// ======== fix compass position ========
|
|
524
|
+
const standingPosition = this.five.work.observers[panoIndex].standingPosition;
|
|
525
|
+
if (this.compassMesh) {
|
|
526
|
+
// 指南针上移 0.01m,防止与地板重合
|
|
527
|
+
this.compassMesh.position.copy(standingPosition.clone().setY(standingPosition.y + 0.01));
|
|
528
|
+
if (this.compassMesh.material.opacity !== 0)
|
|
529
|
+
return;
|
|
530
|
+
(_a = this.compassMeshTween) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
531
|
+
this.compassMeshTween = tweenProgress(1000)
|
|
532
|
+
.onUpdate(({ progress }) => {
|
|
533
|
+
var _a;
|
|
534
|
+
(_a = this.compassMesh) === null || _a === void 0 ? void 0 : _a.material.setValues({ opacity: progress });
|
|
535
|
+
this.five.needsRender = true;
|
|
536
|
+
})
|
|
537
|
+
.play();
|
|
538
|
+
}
|
|
539
|
+
// ======== fix entry door label position and rotation ========
|
|
540
|
+
if (this.entryDoorMesh) {
|
|
541
|
+
const entryDoorPosition = new THREE__namespace.Vector3(this.data.entrance.position.x, this.data.entrance.position.y, this.data.entrance.position.z);
|
|
542
|
+
const panoToEntryDoorVector = entryDoorPosition
|
|
543
|
+
.clone()
|
|
544
|
+
.setY(standingPosition.y)
|
|
545
|
+
.sub(standingPosition)
|
|
546
|
+
.normalize();
|
|
547
|
+
const compassEntryDoorPosition = standingPosition
|
|
548
|
+
.clone()
|
|
549
|
+
.add(panoToEntryDoorVector.clone().multiplyScalar(0.7))
|
|
550
|
+
.setY(standingPosition.y + 0.01);
|
|
551
|
+
this.entryDoorMesh.rotation.z = new THREE__namespace.Vector3(0, 0, -1).angleTo(panoToEntryDoorVector);
|
|
552
|
+
this.entryDoorMesh.position.copy(compassEntryDoorPosition);
|
|
553
|
+
// 不是客厅时,隐藏入户门指引
|
|
554
|
+
((_b = this.data) === null || _b === void 0 ? void 0 : _b.room_observers[panoIndex].room.type) === 1
|
|
555
|
+
? (_c = this.entryDoorMesh) === null || _c === void 0 ? void 0 : _c.material.setValues({ opacity: 1 })
|
|
556
|
+
: (_d = this.entryDoorMesh) === null || _d === void 0 ? void 0 : _d.material.setValues({ opacity: 0 });
|
|
557
|
+
}
|
|
558
|
+
// ======== fix room info ========
|
|
559
|
+
if (this.roomInfoInstance && this.roomInfoWrapperInstance) {
|
|
560
|
+
this.roomInfoWrapperInstance.css3DObject.position.copy(standingPosition.clone().setY(standingPosition.y + 0.01));
|
|
561
|
+
this.roomInfoInstance.setRoom(this.data.room_observers[panoIndex].room);
|
|
562
|
+
}
|
|
563
|
+
this.five.needsRender = true;
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
Object.defineProperty(this, "onFiveCameraDirectionUpdate", {
|
|
567
|
+
enumerable: true,
|
|
568
|
+
configurable: true,
|
|
569
|
+
writable: true,
|
|
570
|
+
value: ({ longitude, latitude, }) => {
|
|
571
|
+
var _a, _b;
|
|
572
|
+
if (!this.roomInfoWrapperInstance)
|
|
573
|
+
return;
|
|
574
|
+
this.roomInfoWrapperInstance.css3DObject.rotation.z = longitude;
|
|
575
|
+
latitude > 0.66 && this.five.getCurrentState().mode === 'Panorama'
|
|
576
|
+
? (_a = this.roomInfoInstance) === null || _a === void 0 ? void 0 : _a.show()
|
|
577
|
+
: (_b = this.roomInfoInstance) === null || _b === void 0 ? void 0 : _b.hide();
|
|
578
|
+
}
|
|
579
|
+
});
|
|
372
580
|
this.five = five;
|
|
373
581
|
this.config = config;
|
|
374
582
|
this.five.scene.add(this.group);
|
|
@@ -383,70 +591,65 @@ class PanoCompassController {
|
|
|
383
591
|
if (this.modelLoaded)
|
|
384
592
|
this.init();
|
|
385
593
|
}
|
|
386
|
-
|
|
387
|
-
this
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
this.
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
this.
|
|
407
|
-
this.
|
|
408
|
-
}
|
|
409
|
-
if (this.data.entrance != null) {
|
|
410
|
-
this.entryDoorMesh = await this.loadEntryDoorMesh();
|
|
411
|
-
this.roomInfoWrapperInstance = this.loadRoomInfo();
|
|
412
|
-
this.roomInfoInstance = getRoomInfoInstance();
|
|
413
|
-
this.entryDoorMesh.rotateX(-Math.PI / 2);
|
|
414
|
-
if (this.roomInfoWrapperInstance)
|
|
415
|
-
this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
|
|
416
|
-
this.group.add(this.entryDoorMesh);
|
|
417
|
-
}
|
|
418
|
-
this.onFivePanoArrived(this.five.panoIndex || 0);
|
|
419
|
-
this.five.needsRender = true;
|
|
594
|
+
init() {
|
|
595
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
596
|
+
if (!this.data || !this.modelLoaded)
|
|
597
|
+
return;
|
|
598
|
+
const northRad = this.data.north_rad;
|
|
599
|
+
if (northRad != null) {
|
|
600
|
+
this.compassMesh = yield this.loadCompassMesh();
|
|
601
|
+
this.compassMesh.rotateX(-Math.PI / 2);
|
|
602
|
+
this.compassMesh.rotateZ(northRad - Math.PI / 2);
|
|
603
|
+
this.group.add(this.compassMesh);
|
|
604
|
+
}
|
|
605
|
+
if (this.data.entrance != null) {
|
|
606
|
+
this.entryDoorMesh = yield this.loadEntryDoorMesh();
|
|
607
|
+
this.roomInfoWrapperInstance = this.loadRoomInfo();
|
|
608
|
+
this.roomInfoInstance = getRoomInfoInstance();
|
|
609
|
+
this.entryDoorMesh.rotateX(-Math.PI / 2);
|
|
610
|
+
if (this.roomInfoWrapperInstance)
|
|
611
|
+
this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
|
|
612
|
+
this.group.add(this.entryDoorMesh);
|
|
613
|
+
}
|
|
614
|
+
this.onFivePanoArrived(this.five.panoIndex || 0);
|
|
615
|
+
this.five.needsRender = true;
|
|
616
|
+
});
|
|
420
617
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
618
|
+
loadCompassMesh() {
|
|
619
|
+
var _a;
|
|
620
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
621
|
+
const compassImageUrl = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.compassImageUrl) ||
|
|
622
|
+
'//vrlab-image4.ljcdn.com/release/web/v3/north-point-circle.96498e69.png';
|
|
623
|
+
const compassTexture = yield loadTexture(compassImageUrl);
|
|
624
|
+
const compassGeometry = new THREE__namespace.CircleGeometry(0.7, 32);
|
|
625
|
+
const compassMaterial = new THREE__namespace.MeshBasicMaterial({
|
|
626
|
+
map: compassTexture,
|
|
627
|
+
transparent: true,
|
|
628
|
+
opacity: 0,
|
|
629
|
+
depthTest: false,
|
|
630
|
+
});
|
|
631
|
+
const compassMesh = new THREE__namespace.Mesh(compassGeometry, compassMaterial);
|
|
632
|
+
compassMesh.name = 'pano-compass-mesh';
|
|
633
|
+
return compassMesh;
|
|
431
634
|
});
|
|
432
|
-
const compassMesh = new THREE__namespace.Mesh(compassGeometry, compassMaterial);
|
|
433
|
-
compassMesh.name = 'pano-compass-mesh';
|
|
434
|
-
return compassMesh;
|
|
435
635
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
636
|
+
loadEntryDoorMesh() {
|
|
637
|
+
var _a;
|
|
638
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
639
|
+
const entryDoorImageUrl = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.entryDoorImageUrl) ||
|
|
640
|
+
'//vrlab-image4.ljcdn.com/release/web/enterDoor.831b8208.png';
|
|
641
|
+
const entryDoorTexture = yield loadTexture(entryDoorImageUrl);
|
|
642
|
+
const entryDoorGeometry = new THREE__namespace.PlaneGeometry(0.2, 0.16);
|
|
643
|
+
const entryDoorMaterial = new THREE__namespace.MeshBasicMaterial({
|
|
644
|
+
map: entryDoorTexture,
|
|
645
|
+
transparent: true,
|
|
646
|
+
opacity: 0.8,
|
|
647
|
+
depthTest: false,
|
|
648
|
+
});
|
|
649
|
+
const entryDoorMesh = new THREE__namespace.Mesh(entryDoorGeometry, entryDoorMaterial);
|
|
650
|
+
entryDoorMesh.name = 'pano-compass-entry-door';
|
|
651
|
+
return entryDoorMesh;
|
|
446
652
|
});
|
|
447
|
-
const entryDoorMesh = new THREE__namespace.Mesh(entryDoorGeometry, entryDoorMaterial);
|
|
448
|
-
entryDoorMesh.name = 'pano-compass-entry-door';
|
|
449
|
-
return entryDoorMesh;
|
|
450
653
|
}
|
|
451
654
|
loadRoomInfo() {
|
|
452
655
|
const points = [
|
|
@@ -458,62 +661,6 @@ class PanoCompassController {
|
|
|
458
661
|
const roomInfo = CSS3DRenderPlugin(this.five).create3DDomContainer(points);
|
|
459
662
|
return roomInfo;
|
|
460
663
|
}
|
|
461
|
-
onFivePanoWillArrive = (panoIndex) => {
|
|
462
|
-
if (panoIndex === this.five.panoIndex)
|
|
463
|
-
return;
|
|
464
|
-
this.compassMeshTween?.dispose();
|
|
465
|
-
this.compassMesh?.material.setValues({ opacity: 0 });
|
|
466
|
-
};
|
|
467
|
-
onFivePanoArrived = (panoIndex) => {
|
|
468
|
-
// ======== fix compass position ========
|
|
469
|
-
const standingPosition = this.five.work.observers[panoIndex].standingPosition;
|
|
470
|
-
if (this.compassMesh) {
|
|
471
|
-
// 指南针上移 0.01m,防止与地板重合
|
|
472
|
-
this.compassMesh.position.copy(standingPosition.clone().setY(standingPosition.y + 0.01));
|
|
473
|
-
if (this.compassMesh.material.opacity !== 0)
|
|
474
|
-
return;
|
|
475
|
-
this.compassMeshTween?.dispose();
|
|
476
|
-
this.compassMeshTween = tweenProgress(1000)
|
|
477
|
-
.onUpdate(({ progress }) => {
|
|
478
|
-
this.compassMesh?.material.setValues({ opacity: progress });
|
|
479
|
-
this.five.needsRender = true;
|
|
480
|
-
})
|
|
481
|
-
.play();
|
|
482
|
-
}
|
|
483
|
-
// ======== fix entry door label position and rotation ========
|
|
484
|
-
if (this.entryDoorMesh) {
|
|
485
|
-
const entryDoorPosition = new THREE__namespace.Vector3(this.data.entrance.position.x, this.data.entrance.position.y, this.data.entrance.position.z);
|
|
486
|
-
const panoToEntryDoorVector = entryDoorPosition
|
|
487
|
-
.clone()
|
|
488
|
-
.setY(standingPosition.y)
|
|
489
|
-
.sub(standingPosition)
|
|
490
|
-
.normalize();
|
|
491
|
-
const compassEntryDoorPosition = standingPosition
|
|
492
|
-
.clone()
|
|
493
|
-
.add(panoToEntryDoorVector.clone().multiplyScalar(0.7))
|
|
494
|
-
.setY(standingPosition.y + 0.01);
|
|
495
|
-
this.entryDoorMesh.rotation.z = new THREE__namespace.Vector3(0, 0, -1).angleTo(panoToEntryDoorVector);
|
|
496
|
-
this.entryDoorMesh.position.copy(compassEntryDoorPosition);
|
|
497
|
-
// 不是客厅时,隐藏入户门指引
|
|
498
|
-
this.data?.room_observers[panoIndex].room.type === 1
|
|
499
|
-
? this.entryDoorMesh?.material.setValues({ opacity: 1 })
|
|
500
|
-
: this.entryDoorMesh?.material.setValues({ opacity: 0 });
|
|
501
|
-
}
|
|
502
|
-
// ======== fix room info ========
|
|
503
|
-
if (this.roomInfoInstance && this.roomInfoWrapperInstance) {
|
|
504
|
-
this.roomInfoWrapperInstance.css3DObject.position.copy(standingPosition.clone().setY(standingPosition.y + 0.01));
|
|
505
|
-
this.roomInfoInstance.setRoom(this.data.room_observers[panoIndex].room);
|
|
506
|
-
}
|
|
507
|
-
this.five.needsRender = true;
|
|
508
|
-
};
|
|
509
|
-
onFiveCameraDirectionUpdate = ({ longitude, latitude, }) => {
|
|
510
|
-
if (!this.roomInfoWrapperInstance)
|
|
511
|
-
return;
|
|
512
|
-
this.roomInfoWrapperInstance.css3DObject.rotation.z = longitude;
|
|
513
|
-
latitude > 0.66 && this.five.getCurrentState().mode === 'Panorama'
|
|
514
|
-
? this.roomInfoInstance?.show()
|
|
515
|
-
: this.roomInfoInstance?.hide();
|
|
516
|
-
};
|
|
517
664
|
}
|
|
518
665
|
|
|
519
666
|
exports.PanoCompassPlugin = PanoCompassPlugin;
|
|
@@ -52,20 +52,22 @@ const PanoCursorRaycasterPlugin = (five) => {
|
|
|
52
52
|
return { clear, pointAxesHelperMesh };
|
|
53
53
|
};
|
|
54
54
|
const canSeePoint = (point, distanceError = 0) => {
|
|
55
|
-
|
|
55
|
+
var _a, _b;
|
|
56
|
+
const cameraPosition = (_a = five === null || five === void 0 ? void 0 : five.camera) === null || _a === void 0 ? void 0 : _a.position;
|
|
56
57
|
if (!cameraPosition)
|
|
57
58
|
return false;
|
|
58
59
|
const distance = point.distanceTo(cameraPosition);
|
|
59
60
|
const direction = point.sub(cameraPosition).normalize();
|
|
60
61
|
const raycaster = new three.Raycaster(cameraPosition, direction);
|
|
61
|
-
const intersection = five.model.intersectRaycaster(raycaster)
|
|
62
|
+
const intersection = (_b = five.model.intersectRaycaster(raycaster)) === null || _b === void 0 ? void 0 : _b[0];
|
|
62
63
|
return !(intersection && intersection.distance + distanceError < distance);
|
|
63
64
|
};
|
|
64
65
|
const intersection = () => {
|
|
65
66
|
return state.intersection;
|
|
66
67
|
};
|
|
67
68
|
const destroy = () => {
|
|
68
|
-
|
|
69
|
+
var _a, _b;
|
|
70
|
+
(_b = (_a = state.disposers) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (d) => d === null || d === void 0 ? void 0 : d());
|
|
69
71
|
five.off('intersectionOnModelUpdate', updateIntersection);
|
|
70
72
|
five.off('intersectionHidden', clearIntersection);
|
|
71
73
|
};
|