@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.
Files changed (130) hide show
  1. package/dist/CSS3DRenderPlugin/PanoCompassPlugin/index.d.ts +1 -1
  2. package/dist/CameraMovementPlugin/PanoCompassPlugin/index.d.ts +1 -1
  3. package/dist/CameraMovementPlugin/index.js +15 -40
  4. package/dist/ItemLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
  5. package/dist/ModelChassisCompassPlugin/PanoCompassPlugin/index.d.ts +1 -1
  6. package/dist/ModelChassisCompassPlugin/index.js +5 -30
  7. package/dist/ModelEntryDoorGuidePlugin/PanoCompassPlugin/index.d.ts +1 -1
  8. package/dist/ModelEntryDoorGuidePlugin/index.js +8 -33
  9. package/dist/ModelItemLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
  10. package/dist/ModelRoomLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
  11. package/dist/ModelTVVideoPlugin/PanoCompassPlugin/index.d.ts +1 -1
  12. package/dist/ModelTVVideoPlugin/index.js +3 -28
  13. package/dist/ModelViewPlugin/PanoCompassPlugin/index.d.ts +1 -1
  14. package/dist/PanoCompassPlugin/PanoCompassPlugin/index.d.ts +1 -1
  15. package/dist/PanoCompassPlugin/index.d.ts +1 -1
  16. package/dist/PanoCompassPlugin/index.js +64 -99
  17. package/dist/PanoCursorRaycasterPlugin/PanoCompassPlugin/index.d.ts +1 -1
  18. package/dist/PanoMeasurePlugin/PanoCompassPlugin/index.d.ts +1 -1
  19. package/dist/PanoRulerPlugin/PanoCompassPlugin/index.d.ts +1 -1
  20. package/dist/PanoRulerPlugin/index.js +3 -28
  21. package/dist/PanoRulerProPlugin/PanoCompassPlugin/index.d.ts +1 -1
  22. package/dist/PanoRulerProPlugin/index.js +29 -58
  23. package/dist/PanoSpatialTagPlugin/PanoCompassPlugin/index.d.ts +1 -1
  24. package/dist/floorplan/ModelFloorplanPlugin/PanoCompassPlugin/index.d.ts +1 -1
  25. package/dist/floorplan/ModelFloorplanPlugin/index.js +115 -156
  26. package/dist/floorplan/PanoFloorplanRadarPlugin/PanoCompassPlugin/index.d.ts +1 -1
  27. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +71 -110
  28. package/dist/floorplan/TopviewFloorplanPlugin/PanoCompassPlugin/index.d.ts +1 -1
  29. package/dist/floorplan/TopviewFloorplanPlugin/index.js +114 -159
  30. package/dist/index.es.js +341 -416
  31. package/dist/index.js +341 -416
  32. package/dist/index.umd.js +341 -416
  33. package/docs/assets/search.js +1 -1
  34. package/docs/classes/Magnifier.html +4 -4
  35. package/docs/classes/ModelRoomLabelController.html +4 -4
  36. package/docs/enums/CameraMovementEffect.html +2 -2
  37. package/docs/enums/DIRECTION.html +1 -1
  38. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  39. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  40. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  41. package/docs/enums/Rotation.html +2 -2
  42. package/docs/index.html +2 -2
  43. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  44. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  45. package/docs/interfaces/FloorplanBounding.html +4 -4
  46. package/docs/interfaces/FloorplanData.html +2 -2
  47. package/docs/interfaces/FloorplanEntrance.html +7 -7
  48. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  49. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  50. package/docs/interfaces/FloorplanFloorData.html +2 -2
  51. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  52. package/docs/interfaces/FloorplanObserver.html +2 -2
  53. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  54. package/docs/interfaces/FloorplanPosition.html +2 -2
  55. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  56. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  57. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  58. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  59. package/docs/interfaces/FloorplanServerData.html +2 -2
  60. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  61. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  62. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  63. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  64. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  65. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  66. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  67. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  68. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  69. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  70. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  71. package/docs/interfaces/LineJson.html +1 -1
  72. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  73. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  74. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  75. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  76. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  77. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  78. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  79. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  80. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  81. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  82. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  83. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  84. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  85. package/docs/interfaces/OpenParameter.html +2 -2
  86. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  87. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  88. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  89. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  90. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  91. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  92. package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
  93. package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
  94. package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
  95. package/docs/interfaces/PanoRulerProPluginState.html +1 -1
  96. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  97. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  98. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  99. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  100. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  101. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  102. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  103. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  104. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  105. package/docs/interfaces/Point.html +1 -1
  106. package/docs/interfaces/PointJson.html +1 -1
  107. package/docs/interfaces/Room.html +1 -1
  108. package/docs/interfaces/RoomInfo.html +1 -1
  109. package/docs/interfaces/RoomLabel.html +7 -7
  110. package/docs/interfaces/RoomRules.html +1 -1
  111. package/docs/interfaces/Rooms.html +1 -1
  112. package/docs/modules.html +18 -18
  113. package/libs/CameraMovementPlugin/CameraMovementPlugin.js +15 -24
  114. package/libs/ModelChassisCompassPlugin/Plugin.js +5 -14
  115. package/libs/ModelEntryDoorGuidePlugin/Plugin.js +8 -17
  116. package/libs/ModelTVVideoPlugin/Plugin.js +3 -12
  117. package/libs/PanoCompassPlugin/controller.js +56 -73
  118. package/libs/PanoCompassPlugin/index.d.ts +1 -1
  119. package/libs/PanoRulerPlugin/Plugin.js +3 -12
  120. package/libs/PanoRulerProPlugin/Controller.js +29 -42
  121. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +29 -42
  122. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +43 -60
  123. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +58 -79
  124. package/libs/floorplan/utils/correctFiveState.js +20 -31
  125. package/libs/floorplan/utils/formatData.js +28 -43
  126. package/libs/shared-utils/five/changeMode.js +28 -39
  127. package/libs/shared-utils/three/loadFbxObj.js +9 -20
  128. package/libs/shared-utils/three/loadTexture.js +6 -17
  129. package/libs/shared-utils/to.js +10 -21
  130. 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) => __awaiter(void 0, void 0, void 0, function* () {
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 yield new Promise((resolve) => five$1.once('modelLoaded', () => resolve(_load(roomInfo, roomRules))));
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', () => __awaiter(this, void 0, void 0, function* () {
965
- var _c, _d;
966
- (_d = (_c = this.five.getElement()) === null || _c === void 0 ? void 0 : _c.parentNode) === null || _d === void 0 ? void 0 : _d.append(this.container);
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
- return __awaiter(this, void 0, void 0, function* () {
972
- if (!this.five.work)
973
- return;
974
- const data = serverData.data;
975
- if (!data)
976
- throw new Error('标尺数据依赖不齐全!');
977
- this.panoRulerProData = data;
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
- return __awaiter(this, void 0, void 0, function* () {
1000
- if (this.state.enabled) {
1001
- if (!this.panoRulerProData || !this.container)
1002
- return;
1003
- this.rulerItems = new RulerItems({
1004
- target: this.container,
1005
- props: {
1006
- five: this.five,
1007
- rulerDatas: this.panoRulerProData,
1008
- options: this.state.options,
1009
- },
1010
- });
1011
- }
1012
- else {
1013
- (_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
1014
- this.rulerItems = undefined;
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
- return __awaiter(this, void 0, void 0, function* () {
66
- try {
67
- const data = yield promise;
68
- return [null, data];
69
- }
70
- catch (error) {
71
- if (error instanceof Error)
72
- return [error, null];
73
- return [new Error(''), null];
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
- return __awaiter(this, void 0, void 0, function* () {
3556
- const headers = new Headers({ 'Content-Type': 'text/plain' });
3557
- const getOutlineItem = function (item) {
3558
- return __awaiter(this, void 0, void 0, function* () {
3559
- const outlineItem = {
3560
- index: item.index,
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
- const svgOutlineItems = yield Promise.all(outlines.map(getOutlineItem));
3572
- return svgOutlineItems;
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
- return __awaiter(this, void 0, void 0, function* () {
3621
- const outlines = yield formatOutlines(data.outlines);
3622
- const bounding = data.computed_data.bounding;
3623
- const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
3624
- const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
3625
- const floorplanData = {
3626
- outlines,
3627
- entrance,
3628
- bounding,
3629
- floorDatas,
3630
- observers: data.computed_data.observers.map(formateFloorplanObserver),
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
- return __awaiter(this, void 0, void 0, function* () {
3780
- yield new Promise((resolve, reject) => {
3781
- // 虽然 changeMode 是异步函数,但不代表异步流程结束代表切换 Mode 动画结束
3782
- five.changeMode(...changeModeParams).catch((error) => reject(error));
3783
- five.once('initAnimationEnded', () => {
3784
- const fiveCurrentState = five.getCurrentState();
3785
- const correctMode = changeModeParams[0];
3786
- if (fiveCurrentState.mode !== correctMode)
3787
- reject(new Error('mode 与预期不符'));
3788
- /** 检测当前的 current pose 和传入的 pose 是否一致 */
3789
- const checkPose = () => {
3790
- const correctPose = changeModeParams[1];
3791
- if (!correctPose)
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
- return Object.keys(correctPose).every((key) => {
3794
- const fivePoseItem = fiveCurrentState[key];
3795
- if (fivePoseItem === undefined)
3796
- return true;
3797
- const correctPoseItem = correctPose[key];
3798
- if (typeof fivePoseItem === 'number' && typeof correctPoseItem === 'number') {
3799
- return nearlyEqual(fivePoseItem, correctPoseItem, 2);
3800
- }
3801
- return fivePoseItem === correctPoseItem;
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
- return __awaiter(this, void 0, void 0, function* () {
3835
- // 当前已满足状态,不需要变更
3836
- const result = checkShowState(five, showState);
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 = {}) => __awaiter(this, void 0, void 0, function* () {
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 = {}) => __awaiter(this, void 0, void 0, function* () {
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) => __awaiter(this, void 0, void 0, function* () {
4131
- var _b;
4093
+ value: async (options) => {
4094
+ var _a;
4132
4095
  if (!this.state.enabled)
4133
4096
  return;
4134
- if (!((_b = this.five.model) === null || _b === void 0 ? void 0 : _b.loaded))
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 = () => __awaiter(this, void 0, void 0, function* () {
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] = yield to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
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
- return __awaiter(this, void 0, void 0, function* () {
4432
- function isPluginServerData(serverData) {
4433
- return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
4434
- }
4435
- const _data = serverData;
4436
- if (_data && !_data.version)
4437
- console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
4438
- const copyData = JSON.parse(JSON.stringify(serverData));
4439
- const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
4440
- const prevData = this.data;
4441
- this.data = yield formatData(_serverData);
4442
- this.hooks.emit('dataLoaded', this.data);
4443
- this.hooks.emit('dataChange', this.data, prevData);
4444
- if (state)
4445
- this.updateState(state, userAction);
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 __awaiter(this, void 0, void 0, function* () {
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';