@realsee/dnalogel 2.0.0-alpha.42 → 2.0.0-alpha.43
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/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/CameraMovementPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/CameraMovementPlugin/index.js +15 -40
- package/dist/ItemLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelChassisCompassPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelChassisCompassPlugin/index.js +5 -30
- package/dist/ModelEntryDoorGuidePlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelEntryDoorGuidePlugin/index.js +8 -33
- package/dist/ModelItemLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelRoomLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelTVVideoPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelTVVideoPlugin/index.js +3 -28
- package/dist/ModelViewPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoCompassPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoCompassPlugin/index.js +64 -99
- package/dist/PanoCursorRaycasterPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoMeasurePlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoRulerPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoRulerPlugin/index.js +3 -28
- package/dist/PanoRulerProPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoRulerProPlugin/index.js +29 -58
- package/dist/PanoSpatialTagPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/floorplan/ModelFloorplanPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/floorplan/ModelFloorplanPlugin/index.js +115 -156
- package/dist/floorplan/PanoFloorplanRadarPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +71 -110
- package/dist/floorplan/TopviewFloorplanPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +114 -159
- package/dist/index.es.js +341 -416
- package/dist/index.js +341 -416
- package/dist/index.umd.js +341 -416
- package/docs/assets/search.js +1 -1
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- package/docs/enums/CameraMovementEffect.html +2 -2
- package/docs/enums/DIRECTION.html +1 -1
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/Rotation.html +2 -2
- package/docs/index.html +2 -2
- package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
- package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/FloorplanBounding.html +4 -4
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +7 -7
- package/docs/interfaces/FloorplanExtraObject.html +3 -3
- package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
- package/docs/interfaces/FloorplanFloorData.html +2 -2
- package/docs/interfaces/FloorplanImagePosition.html +2 -2
- package/docs/interfaces/FloorplanObserver.html +2 -2
- package/docs/interfaces/FloorplanOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanPosition.html +2 -2
- package/docs/interfaces/FloorplanRoomItem.html +6 -6
- package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
- package/docs/interfaces/FloorplanServerBounding.html +4 -4
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +7 -7
- package/docs/interfaces/FloorplanServerFloorData.html +2 -2
- package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
- package/docs/interfaces/FloorplanServerObserver.html +2 -2
- package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanServerPosition.html +2 -2
- package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
- package/docs/interfaces/ItemLabelPluginData.html +1 -1
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ItemLabelPluginParametersType.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/ModelItemLabelPluginData.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/ModelViewPluginExportType.html +1 -1
- package/docs/interfaces/OpenParameter.html +2 -2
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
- package/docs/interfaces/PanoMeasureParameterType.html +1 -1
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginState.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
- package/docs/interfaces/Point.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/Room.html +1 -1
- package/docs/interfaces/RoomInfo.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/RoomRules.html +1 -1
- package/docs/interfaces/Rooms.html +1 -1
- package/docs/modules.html +18 -18
- package/libs/CameraMovementPlugin/CameraMovementPlugin.js +15 -24
- package/libs/ModelChassisCompassPlugin/Plugin.js +5 -14
- package/libs/ModelEntryDoorGuidePlugin/Plugin.js +8 -17
- package/libs/ModelTVVideoPlugin/Plugin.js +3 -12
- package/libs/PanoCompassPlugin/controller.js +56 -73
- package/libs/PanoCompassPlugin/index.d.ts +1 -1
- package/libs/PanoRulerPlugin/Plugin.js +3 -12
- package/libs/PanoRulerProPlugin/Controller.js +29 -42
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +29 -42
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +43 -60
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +58 -79
- package/libs/floorplan/utils/correctFiveState.js +20 -31
- package/libs/floorplan/utils/formatData.js +28 -43
- package/libs/shared-utils/five/changeMode.js +28 -39
- package/libs/shared-utils/three/loadFbxObj.js +9 -20
- package/libs/shared-utils/three/loadTexture.js +6 -17
- package/libs/shared-utils/to.js +10 -21
- package/package.json +14 -14
|
@@ -5,31 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var five = require('@realsee/five');
|
|
6
6
|
var three = require('three');
|
|
7
7
|
|
|
8
|
-
/******************************************************************************
|
|
9
|
-
Copyright (c) Microsoft Corporation.
|
|
10
|
-
|
|
11
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
12
|
-
purpose with or without fee is hereby granted.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
18
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
-
***************************************************************************** */
|
|
22
|
-
|
|
23
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
24
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
26
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
27
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
28
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
29
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
8
|
/**
|
|
34
9
|
* 平面几何相关数学函数
|
|
35
10
|
*/
|
|
@@ -402,7 +377,7 @@ const PanoRulerPlugin = (five$1, params) => {
|
|
|
402
377
|
freshRule();
|
|
403
378
|
return true;
|
|
404
379
|
};
|
|
405
|
-
const load = (_roomInfo, _roomRules, options) =>
|
|
380
|
+
const load = async (_roomInfo, _roomRules, options) => {
|
|
406
381
|
const roomInfo = _roomInfo || params.roomInfo;
|
|
407
382
|
const roomRules = _roomRules || params.roomRules;
|
|
408
383
|
if (!roomInfo || !roomRules) {
|
|
@@ -414,9 +389,9 @@ const PanoRulerPlugin = (five$1, params) => {
|
|
|
414
389
|
return _load(roomInfo, roomRules);
|
|
415
390
|
}
|
|
416
391
|
else {
|
|
417
|
-
return
|
|
392
|
+
return await new Promise((resolve) => five$1.once('modelLoaded', () => resolve(_load(roomInfo, roomRules))));
|
|
418
393
|
}
|
|
419
|
-
}
|
|
394
|
+
};
|
|
420
395
|
if (params.roomInfo && params.roomRules) {
|
|
421
396
|
load(params.roomInfo, params.roomRules);
|
|
422
397
|
}
|
|
@@ -4,4 +4,4 @@ import type { PanoCompassPluginParameterType } from './typings';
|
|
|
4
4
|
export declare type PanoCompassPluginExportType = PanoCompassController;
|
|
5
5
|
export declare const PanoCompassPlugin: FivePlugin<PanoCompassPluginParameterType, PanoCompassPluginExportType>;
|
|
6
6
|
export default PanoCompassPlugin;
|
|
7
|
-
export type { PanoCompassPluginParameterType } from './typings';
|
|
7
|
+
export type { PanoCompassPluginParameterType, PanoCompassPluginData } from './typings';
|
|
@@ -7,31 +7,6 @@ var five = require('@realsee/five');
|
|
|
7
7
|
var svelte = require('svelte');
|
|
8
8
|
var three = require('three');
|
|
9
9
|
|
|
10
|
-
/******************************************************************************
|
|
11
|
-
Copyright (c) Microsoft Corporation.
|
|
12
|
-
|
|
13
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
14
|
-
purpose with or without fee is hereby granted.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
17
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
18
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
19
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
20
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
21
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
22
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
23
|
-
***************************************************************************** */
|
|
24
|
-
|
|
25
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
10
|
const _requestAnimationFrame = window.requestAnimationFrame || ((fn) => setTimeout(fn, 16));
|
|
36
11
|
function nextFrame(fn, delay = 0) {
|
|
37
12
|
if (delay <= 0)
|
|
@@ -961,22 +936,20 @@ class Controller {
|
|
|
961
936
|
if ((_a = params.options) === null || _a === void 0 ? void 0 : _a.className)
|
|
962
937
|
this.container.classList.add((_b = params.options) === null || _b === void 0 ? void 0 : _b.className);
|
|
963
938
|
}
|
|
964
|
-
this.five.once('modelLoaded', () =>
|
|
965
|
-
var
|
|
966
|
-
(
|
|
967
|
-
})
|
|
939
|
+
this.five.once('modelLoaded', async () => {
|
|
940
|
+
var _a, _b;
|
|
941
|
+
(_b = (_a = this.five.getElement()) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.append(this.container);
|
|
942
|
+
});
|
|
968
943
|
this.five.once('dispose', () => this.dispose());
|
|
969
944
|
}
|
|
970
|
-
load(serverData) {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
this.state.loaded = true;
|
|
979
|
-
});
|
|
945
|
+
async load(serverData) {
|
|
946
|
+
if (!this.five.work)
|
|
947
|
+
return;
|
|
948
|
+
const data = serverData.data;
|
|
949
|
+
if (!data)
|
|
950
|
+
throw new Error('标尺数据依赖不齐全!');
|
|
951
|
+
this.panoRulerProData = data;
|
|
952
|
+
this.state.loaded = true;
|
|
980
953
|
}
|
|
981
954
|
enable() {
|
|
982
955
|
if (!this.state.loaded)
|
|
@@ -994,26 +967,24 @@ class Controller {
|
|
|
994
967
|
this.render();
|
|
995
968
|
return true;
|
|
996
969
|
}
|
|
997
|
-
render() {
|
|
970
|
+
async render() {
|
|
998
971
|
var _a;
|
|
999
|
-
|
|
1000
|
-
if (this.
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
this.
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
972
|
+
if (this.state.enabled) {
|
|
973
|
+
if (!this.panoRulerProData || !this.container)
|
|
974
|
+
return;
|
|
975
|
+
this.rulerItems = new RulerItems({
|
|
976
|
+
target: this.container,
|
|
977
|
+
props: {
|
|
978
|
+
five: this.five,
|
|
979
|
+
rulerDatas: this.panoRulerProData,
|
|
980
|
+
options: this.state.options,
|
|
981
|
+
},
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
(_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
986
|
+
this.rulerItems = undefined;
|
|
987
|
+
}
|
|
1017
988
|
}
|
|
1018
989
|
dispose() {
|
|
1019
990
|
if (this.container) {
|
|
@@ -4,4 +4,4 @@ import type { PanoCompassPluginParameterType } from './typings';
|
|
|
4
4
|
export declare type PanoCompassPluginExportType = PanoCompassController;
|
|
5
5
|
export declare const PanoCompassPlugin: FivePlugin<PanoCompassPluginParameterType, PanoCompassPluginExportType>;
|
|
6
6
|
export default PanoCompassPlugin;
|
|
7
|
-
export type { PanoCompassPluginParameterType } from './typings';
|
|
7
|
+
export type { PanoCompassPluginParameterType, PanoCompassPluginData } from './typings';
|
|
@@ -4,4 +4,4 @@ import type { PanoCompassPluginParameterType } from './typings';
|
|
|
4
4
|
export declare type PanoCompassPluginExportType = PanoCompassController;
|
|
5
5
|
export declare const PanoCompassPlugin: FivePlugin<PanoCompassPluginParameterType, PanoCompassPluginExportType>;
|
|
6
6
|
export default PanoCompassPlugin;
|
|
7
|
-
export type { PanoCompassPluginParameterType } from './typings';
|
|
7
|
+
export type { PanoCompassPluginParameterType, PanoCompassPluginData } from './typings';
|
|
@@ -30,49 +30,22 @@ function _interopNamespace(e) {
|
|
|
30
30
|
|
|
31
31
|
var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
|
|
32
32
|
|
|
33
|
-
/******************************************************************************
|
|
34
|
-
Copyright (c) Microsoft Corporation.
|
|
35
|
-
|
|
36
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
37
|
-
purpose with or without fee is hereby granted.
|
|
38
|
-
|
|
39
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
40
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
41
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
42
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
43
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
44
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
45
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
46
|
-
***************************************************************************** */
|
|
47
|
-
|
|
48
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
49
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
50
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
51
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
52
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
53
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
54
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
33
|
/**
|
|
59
34
|
* 传入一个 Promise
|
|
60
35
|
* 无异常,返回 [null, data]
|
|
61
36
|
* 有异常,则返回 [Error, undefined]
|
|
62
37
|
* 用于替代 try&catch 处理 await 异常的方案
|
|
63
38
|
*/
|
|
64
|
-
function to(promise) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
});
|
|
39
|
+
async function to(promise) {
|
|
40
|
+
try {
|
|
41
|
+
const data = await promise;
|
|
42
|
+
return [null, data];
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error instanceof Error)
|
|
46
|
+
return [error, null];
|
|
47
|
+
return [new Error(''), null];
|
|
48
|
+
}
|
|
76
49
|
}
|
|
77
50
|
|
|
78
51
|
/**
|
|
@@ -3551,26 +3524,22 @@ class Main extends internal.SvelteComponent {
|
|
|
3551
3524
|
}
|
|
3552
3525
|
}
|
|
3553
3526
|
|
|
3554
|
-
function formatOutlines(outlines) {
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
const
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
url: item.url,
|
|
3562
|
-
svgUrl: item.svg_url,
|
|
3563
|
-
};
|
|
3564
|
-
if (item.svg_url) {
|
|
3565
|
-
const svgContent = yield fetch(item.svg_url, { headers }).then((res) => res.text());
|
|
3566
|
-
outlineItem.svgContent = svgContent;
|
|
3567
|
-
}
|
|
3568
|
-
return outlineItem;
|
|
3569
|
-
});
|
|
3527
|
+
async function formatOutlines(outlines) {
|
|
3528
|
+
const headers = new Headers({ 'Content-Type': 'text/plain' });
|
|
3529
|
+
const getOutlineItem = async function (item) {
|
|
3530
|
+
const outlineItem = {
|
|
3531
|
+
index: item.index,
|
|
3532
|
+
url: item.url,
|
|
3533
|
+
svgUrl: item.svg_url,
|
|
3570
3534
|
};
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3535
|
+
if (item.svg_url) {
|
|
3536
|
+
const svgContent = await fetch(item.svg_url, { headers }).then((res) => res.text());
|
|
3537
|
+
outlineItem.svgContent = svgContent;
|
|
3538
|
+
}
|
|
3539
|
+
return outlineItem;
|
|
3540
|
+
};
|
|
3541
|
+
const svgOutlineItems = await Promise.all(outlines.map(getOutlineItem));
|
|
3542
|
+
return svgOutlineItems;
|
|
3574
3543
|
}
|
|
3575
3544
|
function formatRoom(data) {
|
|
3576
3545
|
const floorplanRoomItem = {
|
|
@@ -3616,21 +3585,19 @@ function formatFloorplanEntrance(data) {
|
|
|
3616
3585
|
};
|
|
3617
3586
|
return floorplanEntrance;
|
|
3618
3587
|
}
|
|
3619
|
-
function formatData(data) {
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
return floorplanData;
|
|
3633
|
-
});
|
|
3588
|
+
async function formatData(data) {
|
|
3589
|
+
const outlines = await formatOutlines(data.outlines);
|
|
3590
|
+
const bounding = data.computed_data.bounding;
|
|
3591
|
+
const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
|
|
3592
|
+
const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
|
|
3593
|
+
const floorplanData = {
|
|
3594
|
+
outlines,
|
|
3595
|
+
entrance,
|
|
3596
|
+
bounding,
|
|
3597
|
+
floorDatas,
|
|
3598
|
+
observers: data.computed_data.observers.map(formateFloorplanObserver),
|
|
3599
|
+
};
|
|
3600
|
+
return floorplanData;
|
|
3634
3601
|
}
|
|
3635
3602
|
|
|
3636
3603
|
/**
|
|
@@ -3775,37 +3742,35 @@ function nearlyEqual(num1, num2, accuracy = 4) {
|
|
|
3775
3742
|
/** 等待 five changeMode 结束
|
|
3776
3743
|
* @description Promise 的状态只代表 mode 与预期是否一致,不保证参数的一致性
|
|
3777
3744
|
*/
|
|
3778
|
-
function changeMode(five, changeModeParams) {
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
five.
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
const
|
|
3790
|
-
|
|
3791
|
-
|
|
3745
|
+
async function changeMode(five, changeModeParams) {
|
|
3746
|
+
await new Promise((resolve, reject) => {
|
|
3747
|
+
// 虽然 changeMode 是异步函数,但不代表异步流程结束代表切换 Mode 动画结束
|
|
3748
|
+
five.changeMode(...changeModeParams).catch((error) => reject(error));
|
|
3749
|
+
five.once('initAnimationEnded', () => {
|
|
3750
|
+
const fiveCurrentState = five.getCurrentState();
|
|
3751
|
+
const correctMode = changeModeParams[0];
|
|
3752
|
+
if (fiveCurrentState.mode !== correctMode)
|
|
3753
|
+
reject(new Error('mode 与预期不符'));
|
|
3754
|
+
/** 检测当前的 current pose 和传入的 pose 是否一致 */
|
|
3755
|
+
const checkPose = () => {
|
|
3756
|
+
const correctPose = changeModeParams[1];
|
|
3757
|
+
if (!correctPose)
|
|
3758
|
+
return true;
|
|
3759
|
+
return Object.keys(correctPose).every((key) => {
|
|
3760
|
+
const fivePoseItem = fiveCurrentState[key];
|
|
3761
|
+
if (fivePoseItem === undefined)
|
|
3792
3762
|
return true;
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
const checkPoseResult = checkPose();
|
|
3805
|
-
if (!checkPoseResult)
|
|
3806
|
-
reject(new Error('five pose 与预期不符'));
|
|
3807
|
-
resolve();
|
|
3808
|
-
});
|
|
3763
|
+
const correctPoseItem = correctPose[key];
|
|
3764
|
+
if (typeof fivePoseItem === 'number' && typeof correctPoseItem === 'number') {
|
|
3765
|
+
return nearlyEqual(fivePoseItem, correctPoseItem, 2);
|
|
3766
|
+
}
|
|
3767
|
+
return fivePoseItem === correctPoseItem;
|
|
3768
|
+
});
|
|
3769
|
+
};
|
|
3770
|
+
const checkPoseResult = checkPose();
|
|
3771
|
+
if (!checkPoseResult)
|
|
3772
|
+
reject(new Error('five pose 与预期不符'));
|
|
3773
|
+
resolve();
|
|
3809
3774
|
});
|
|
3810
3775
|
});
|
|
3811
3776
|
}
|
|
@@ -3830,29 +3795,27 @@ function checkShowState(five, showState) {
|
|
|
3830
3795
|
* 2. 内置了相应的动画时间计算
|
|
3831
3796
|
* 3. 纠正成功会返回 true,失败「可能会被用户行为中断」会返回 false
|
|
3832
3797
|
*/
|
|
3833
|
-
function correctFiveState(five, showState, userAction = true) {
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
if (result === true)
|
|
3838
|
-
return;
|
|
3839
|
-
const currentFiveState = five.getCurrentState();
|
|
3840
|
-
// 纠正 mode
|
|
3841
|
-
if (currentFiveState.mode !== showState.mode) {
|
|
3842
|
-
const [changeModeError] = yield to(changeMode(five, [showState.mode, showState, undefined, userAction]));
|
|
3843
|
-
if (changeModeError)
|
|
3844
|
-
throw new Error(FloorplanErrorType.ChangeModeError);
|
|
3845
|
-
return;
|
|
3846
|
-
}
|
|
3847
|
-
// 纠正相机状态
|
|
3848
|
-
// 根据 latitude、longitude、fov 计算动画时间,最多 1s
|
|
3849
|
-
const { latitude, longitude, fov } = currentFiveState;
|
|
3850
|
-
const time = Math.min(1000, Math.max(200, Math.abs(latitude - Math.PI / 2) * 1000, (longitude > Math.PI ? 2 * Math.PI - longitude : longitude) * 500, Math.abs(fov - showState.fov) * 10));
|
|
3851
|
-
const [updateCameraError] = yield to(five.updateCamera(showState, time, userAction));
|
|
3852
|
-
if (updateCameraError)
|
|
3853
|
-
throw new Error(FloorplanErrorType.UpdateCameraError);
|
|
3798
|
+
async function correctFiveState(five, showState, userAction = true) {
|
|
3799
|
+
// 当前已满足状态,不需要变更
|
|
3800
|
+
const result = checkShowState(five, showState);
|
|
3801
|
+
if (result === true)
|
|
3854
3802
|
return;
|
|
3855
|
-
|
|
3803
|
+
const currentFiveState = five.getCurrentState();
|
|
3804
|
+
// 纠正 mode
|
|
3805
|
+
if (currentFiveState.mode !== showState.mode) {
|
|
3806
|
+
const [changeModeError] = await to(changeMode(five, [showState.mode, showState, undefined, userAction]));
|
|
3807
|
+
if (changeModeError)
|
|
3808
|
+
throw new Error(FloorplanErrorType.ChangeModeError);
|
|
3809
|
+
return;
|
|
3810
|
+
}
|
|
3811
|
+
// 纠正相机状态
|
|
3812
|
+
// 根据 latitude、longitude、fov 计算动画时间,最多 1s
|
|
3813
|
+
const { latitude, longitude, fov } = currentFiveState;
|
|
3814
|
+
const time = Math.min(1000, Math.max(200, Math.abs(latitude - Math.PI / 2) * 1000, (longitude > Math.PI ? 2 * Math.PI - longitude : longitude) * 500, Math.abs(fov - showState.fov) * 10));
|
|
3815
|
+
const [updateCameraError] = await to(five.updateCamera(showState, time, userAction));
|
|
3816
|
+
if (updateCameraError)
|
|
3817
|
+
throw new Error(FloorplanErrorType.UpdateCameraError);
|
|
3818
|
+
return;
|
|
3856
3819
|
}
|
|
3857
3820
|
|
|
3858
3821
|
function changeModelCanvasOpacity(five, opacity, duration = 300) {
|
|
@@ -4037,7 +4000,7 @@ class Controller extends Controller$1 {
|
|
|
4037
4000
|
enumerable: true,
|
|
4038
4001
|
configurable: true,
|
|
4039
4002
|
writable: true,
|
|
4040
|
-
value: (options = {}) =>
|
|
4003
|
+
value: async (options = {}) => {
|
|
4041
4004
|
if (!this.state.enabled)
|
|
4042
4005
|
return;
|
|
4043
4006
|
// 已经展示完成了,不做任何操作
|
|
@@ -4046,14 +4009,14 @@ class Controller extends Controller$1 {
|
|
|
4046
4009
|
const userAction = options.userAction !== undefined ? options.userAction : true;
|
|
4047
4010
|
this.updateState({ visible: true }, userAction);
|
|
4048
4011
|
this._show(options);
|
|
4049
|
-
}
|
|
4012
|
+
}
|
|
4050
4013
|
});
|
|
4051
4014
|
/** 隐藏户型图 */
|
|
4052
4015
|
Object.defineProperty(this, "hide", {
|
|
4053
4016
|
enumerable: true,
|
|
4054
4017
|
configurable: true,
|
|
4055
4018
|
writable: true,
|
|
4056
|
-
value: (options = {}) =>
|
|
4019
|
+
value: async (options = {}) => {
|
|
4057
4020
|
if (!this.state.enabled)
|
|
4058
4021
|
return;
|
|
4059
4022
|
this.isHiddenByHideFunc = true;
|
|
@@ -4061,7 +4024,7 @@ class Controller extends Controller$1 {
|
|
|
4061
4024
|
return;
|
|
4062
4025
|
this.updateState({ visible: false }, options.userAction || true);
|
|
4063
4026
|
this._hide(options);
|
|
4064
|
-
}
|
|
4027
|
+
}
|
|
4065
4028
|
});
|
|
4066
4029
|
/** 更新户型图大小 */
|
|
4067
4030
|
Object.defineProperty(this, "updateSize", {
|
|
@@ -4127,11 +4090,11 @@ class Controller extends Controller$1 {
|
|
|
4127
4090
|
enumerable: true,
|
|
4128
4091
|
configurable: true,
|
|
4129
4092
|
writable: true,
|
|
4130
|
-
value: (options) =>
|
|
4131
|
-
var
|
|
4093
|
+
value: async (options) => {
|
|
4094
|
+
var _a;
|
|
4132
4095
|
if (!this.state.enabled)
|
|
4133
4096
|
return;
|
|
4134
|
-
if (!((
|
|
4097
|
+
if (!((_a = this.five.model) === null || _a === void 0 ? void 0 : _a.loaded))
|
|
4135
4098
|
throw new Error(FloorplanErrorType.ModelNotLoaded);
|
|
4136
4099
|
if (!this.data)
|
|
4137
4100
|
throw new Error(FloorplanErrorType.DataNotLoaded);
|
|
@@ -4145,7 +4108,7 @@ class Controller extends Controller$1 {
|
|
|
4145
4108
|
userAction: true,
|
|
4146
4109
|
};
|
|
4147
4110
|
const mergedOptions = Object.assign(Object.assign({}, baseShowOpts), options);
|
|
4148
|
-
const getShowPromise = () =>
|
|
4111
|
+
const getShowPromise = async () => {
|
|
4149
4112
|
this.hooks.emit('show', { userAction: mergedOptions.userAction, auto: mergedOptions.isAutoShow });
|
|
4150
4113
|
let hasRejected = false;
|
|
4151
4114
|
let externalErrorMsg;
|
|
@@ -4153,7 +4116,7 @@ class Controller extends Controller$1 {
|
|
|
4153
4116
|
hasRejected = true;
|
|
4154
4117
|
externalErrorMsg = errorMsg;
|
|
4155
4118
|
};
|
|
4156
|
-
const [correctError] =
|
|
4119
|
+
const [correctError] = await to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
|
|
4157
4120
|
if (correctError)
|
|
4158
4121
|
throw correctError;
|
|
4159
4122
|
// 异步结束要判断当前是不是被中断了
|
|
@@ -4171,7 +4134,7 @@ class Controller extends Controller$1 {
|
|
|
4171
4134
|
const renderDuration = mergedOptions.immediately ? 0 : SHOW_ANIME_DURATION;
|
|
4172
4135
|
changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
|
|
4173
4136
|
this.render(renderDuration);
|
|
4174
|
-
}
|
|
4137
|
+
};
|
|
4175
4138
|
this.showPromise = getShowPromise()
|
|
4176
4139
|
.then(() => {
|
|
4177
4140
|
this.hooks.emit('showAnimationEnded', {
|
|
@@ -4193,7 +4156,7 @@ class Controller extends Controller$1 {
|
|
|
4193
4156
|
this.showRejection = undefined;
|
|
4194
4157
|
});
|
|
4195
4158
|
return this.showPromise;
|
|
4196
|
-
}
|
|
4159
|
+
}
|
|
4197
4160
|
});
|
|
4198
4161
|
Object.defineProperty(this, "_hide", {
|
|
4199
4162
|
enumerable: true,
|
|
@@ -4427,24 +4390,22 @@ class Controller extends Controller$1 {
|
|
|
4427
4390
|
five.once('dispose', this.dispose);
|
|
4428
4391
|
this.addEventListener();
|
|
4429
4392
|
}
|
|
4430
|
-
load(serverData, state, userAction = true) {
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
this.render();
|
|
4447
|
-
});
|
|
4393
|
+
async load(serverData, state, userAction = true) {
|
|
4394
|
+
function isPluginServerData(serverData) {
|
|
4395
|
+
return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
|
|
4396
|
+
}
|
|
4397
|
+
const _data = serverData;
|
|
4398
|
+
if (_data && !_data.version)
|
|
4399
|
+
console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
|
|
4400
|
+
const copyData = JSON.parse(JSON.stringify(serverData));
|
|
4401
|
+
const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
|
|
4402
|
+
const prevData = this.data;
|
|
4403
|
+
this.data = await formatData(_serverData);
|
|
4404
|
+
this.hooks.emit('dataLoaded', this.data);
|
|
4405
|
+
this.hooks.emit('dataChange', this.data, prevData);
|
|
4406
|
+
if (state)
|
|
4407
|
+
this.updateState(state, userAction);
|
|
4408
|
+
this.render();
|
|
4448
4409
|
}
|
|
4449
4410
|
/** 把插件的渲染DOM插入到对应的容器中去 */
|
|
4450
4411
|
appendTo(wrapper) {
|
|
@@ -4492,10 +4453,8 @@ class Controller extends Controller$1 {
|
|
|
4492
4453
|
return;
|
|
4493
4454
|
this.render();
|
|
4494
4455
|
}
|
|
4495
|
-
formatData(serverData) {
|
|
4496
|
-
return
|
|
4497
|
-
return yield formatData(serverData.data);
|
|
4498
|
-
});
|
|
4456
|
+
async formatData(serverData) {
|
|
4457
|
+
return await formatData(serverData.data);
|
|
4499
4458
|
}
|
|
4500
4459
|
updateState(state, userAction) {
|
|
4501
4460
|
const prevState = this.state;
|
|
@@ -4,4 +4,4 @@ import type { PanoCompassPluginParameterType } from './typings';
|
|
|
4
4
|
export declare type PanoCompassPluginExportType = PanoCompassController;
|
|
5
5
|
export declare const PanoCompassPlugin: FivePlugin<PanoCompassPluginParameterType, PanoCompassPluginExportType>;
|
|
6
6
|
export default PanoCompassPlugin;
|
|
7
|
-
export type { PanoCompassPluginParameterType } from './typings';
|
|
7
|
+
export type { PanoCompassPluginParameterType, PanoCompassPluginData } from './typings';
|