@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
package/dist/index.js CHANGED
@@ -1023,31 +1023,6 @@ exports.FLOOR_PLAN_ATTACHED_TO = void 0;
1023
1023
  FLOOR_PLAN_ATTACHED_TO[FLOOR_PLAN_ATTACHED_TO["BOUNDING_CENTER"] = 3] = "BOUNDING_CENTER";
1024
1024
  })(exports.FLOOR_PLAN_ATTACHED_TO || (exports.FLOOR_PLAN_ATTACHED_TO = {}));
1025
1025
 
1026
- /******************************************************************************
1027
- Copyright (c) Microsoft Corporation.
1028
-
1029
- Permission to use, copy, modify, and/or distribute this software for any
1030
- purpose with or without fee is hereby granted.
1031
-
1032
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1033
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1034
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1035
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1036
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1037
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1038
- PERFORMANCE OF THIS SOFTWARE.
1039
- ***************************************************************************** */
1040
-
1041
- function __awaiter(thisArg, _arguments, P, generator) {
1042
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1043
- return new (P || (P = Promise))(function (resolve, reject) {
1044
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1045
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1046
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1047
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1048
- });
1049
- }
1050
-
1051
1026
  /**
1052
1027
  * 检查一个值是否是狭义上的对象
1053
1028
  * @param {any} value 要检查的值
@@ -4551,26 +4526,22 @@ class Main$1 extends internal.SvelteComponent {
4551
4526
 
4552
4527
  const FLOORPLAN_EXTRA_OBJECT_IMAGE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALaADAAQAAAABAAAAMAAAAADe2FZjAAAEF0lEQVRoBe2WzWskRRiHf13V092TxI2oEzYeVDwITtyDuCiihwiCePGgxIM3vYgHL4J4UIhBRA8i/gPqyUvWg7AiIuIeloDiYUHJLOK6BPwIk9nNODM9Xf1RVe1b3elJRjCZmQ6euqGmuqer33rq4e23GqiOykBloDJQGagMVAYqA5WBykBlYFYD1qwP/tdzaZqOx9zYOLxeX0+L5yzLGp0X/03a25MOnGRcBtx+6Rlo9SL08G4EooFnxa8Yiivox5/h5Ys/4cl7NVorNDRnngX+0MIkVMeMSf23zyKML8J7/Dy8hwF2Buh9CnS+AEQIdLspBuGb+M7/qLW4qJrNpsLapjYhpwVnx3BMfCtNNx3Etc9xywvnMf80wG8HmQainw0RxSGrnmeBp+8k5/j9S0HbvXb5io0Lz880/0wPHV1NlhLd316He+4xOCv5ragF7L9PrH1qBJyB0626x/lC+qrSvH5r/W+n1WpxUM5nMY4GPeH8lHJaPgfeAFQHCL+ntkXT+vnUc3W6pvTIwC0wy3rA4dwLmK2avZ7Eo9uKBuYJfgJscbs8dLCxDMt+EOEPBEZNEWyBYHqTz6bPXrzUnNrSShxHIsYiOL69zrCGLLcLqJP68tB+9w5wj+YhWDafQ2s61wNqxjZhmrQ2pvMFCEvXuCUZ7wqH794ZWs28LJqlTXSUyuksF2M/yOwqgkx2c1ADa4wLAQRk2sAGQQakhN6yFC2hltfz5kSY44NKQeeh+vtI/SSzWhg2CzCgmWISmKUGmaYFBDfCSymnfxJ6/+ospVcWOLLp5DGP/y0P/Rp66O99DQNq7Po3Ds0a0wY+My2QSv2N2mO/OyxR2o6UQk+Lv7yJ06JYSnnolZVU9cUn2O9SmaMWGFBqYXRwbqAJWIi94TX5biotpcGl1DXZ6LnqIbNDTnmUgi52Mv5l5ysMxIcZcGjy2DTK4ZHlcBC14zeSge4qphICjj3bS0A7o9nSp2TOkm7aZ8bGZy/jxhO87V91G0+dfY/Z7BWIIK9KYUi5qy/Hf8YfBG3sqJTHiQWhmTVkbip+wX3x6volVSx+LPAxF+VLXhZ8VQ+iP2Rta/iWe5v42Fngj0BbdnRTXh12ZIcKhTaGbcYjybRwXBU1lu9KlndXp04NM52poKWO0RZsviNaP9a6grkO972+st05pXhE5c1hTEluJy7XUejGUQNLMbAmTdWY1rKBLW3aTJqBZ7nZkb36DhYCreeYHbMUXHvaYi5XDK70EcgulmRjm77wNtenzuXCbmnTRaAx493rbGf3Jr/njMzj920CnKdUaFCjlDioy7NYNvOdGrQJNgI32/L2tkXfFPlxgToqjWVhD6KdLnQRdARf/HHQz2r2X2Gqy8pAZaAyUBmoDFQGKgP/q4F/AJYg9/s0ZoABAAAAAElFTkSuQmCC';
4553
4528
 
4554
- function formatOutlines(outlines) {
4555
- return __awaiter(this, void 0, void 0, function* () {
4556
- const headers = new Headers({ 'Content-Type': 'text/plain' });
4557
- const getOutlineItem = function (item) {
4558
- return __awaiter(this, void 0, void 0, function* () {
4559
- const outlineItem = {
4560
- index: item.index,
4561
- url: item.url,
4562
- svgUrl: item.svg_url,
4563
- };
4564
- if (item.svg_url) {
4565
- const svgContent = yield fetch(item.svg_url, { headers }).then((res) => res.text());
4566
- outlineItem.svgContent = svgContent;
4567
- }
4568
- return outlineItem;
4569
- });
4529
+ async function formatOutlines(outlines) {
4530
+ const headers = new Headers({ 'Content-Type': 'text/plain' });
4531
+ const getOutlineItem = async function (item) {
4532
+ const outlineItem = {
4533
+ index: item.index,
4534
+ url: item.url,
4535
+ svgUrl: item.svg_url,
4570
4536
  };
4571
- const svgOutlineItems = yield Promise.all(outlines.map(getOutlineItem));
4572
- return svgOutlineItems;
4573
- });
4537
+ if (item.svg_url) {
4538
+ const svgContent = await fetch(item.svg_url, { headers }).then((res) => res.text());
4539
+ outlineItem.svgContent = svgContent;
4540
+ }
4541
+ return outlineItem;
4542
+ };
4543
+ const svgOutlineItems = await Promise.all(outlines.map(getOutlineItem));
4544
+ return svgOutlineItems;
4574
4545
  }
4575
4546
  function formatRoom(data) {
4576
4547
  const floorplanRoomItem = {
@@ -4616,21 +4587,19 @@ function formatFloorplanEntrance(data) {
4616
4587
  };
4617
4588
  return floorplanEntrance;
4618
4589
  }
4619
- function formatData(data) {
4620
- return __awaiter(this, void 0, void 0, function* () {
4621
- const outlines = yield formatOutlines(data.outlines);
4622
- const bounding = data.computed_data.bounding;
4623
- const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
4624
- const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
4625
- const floorplanData = {
4626
- outlines,
4627
- entrance,
4628
- bounding,
4629
- floorDatas,
4630
- observers: data.computed_data.observers.map(formateFloorplanObserver),
4631
- };
4632
- return floorplanData;
4633
- });
4590
+ async function formatData(data) {
4591
+ const outlines = await formatOutlines(data.outlines);
4592
+ const bounding = data.computed_data.bounding;
4593
+ const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
4594
+ const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
4595
+ const floorplanData = {
4596
+ outlines,
4597
+ entrance,
4598
+ bounding,
4599
+ floorDatas,
4600
+ observers: data.computed_data.observers.map(formateFloorplanObserver),
4601
+ };
4602
+ return floorplanData;
4634
4603
  }
4635
4604
  function formatExtraObjects(data, five, floorplanData) {
4636
4605
  const extraObjects = data.map((object) => {
@@ -4725,37 +4694,35 @@ function nearlyEqual(num1, num2, accuracy = 4) {
4725
4694
  /** 等待 five changeMode 结束
4726
4695
  * @description Promise 的状态只代表 mode 与预期是否一致,不保证参数的一致性
4727
4696
  */
4728
- function changeMode(five, changeModeParams) {
4729
- return __awaiter(this, void 0, void 0, function* () {
4730
- yield new Promise((resolve, reject) => {
4731
- // 虽然 changeMode 是异步函数,但不代表异步流程结束代表切换 Mode 动画结束
4732
- five.changeMode(...changeModeParams).catch((error) => reject(error));
4733
- five.once('initAnimationEnded', () => {
4734
- const fiveCurrentState = five.getCurrentState();
4735
- const correctMode = changeModeParams[0];
4736
- if (fiveCurrentState.mode !== correctMode)
4737
- reject(new Error('mode 与预期不符'));
4738
- /** 检测当前的 current pose 和传入的 pose 是否一致 */
4739
- const checkPose = () => {
4740
- const correctPose = changeModeParams[1];
4741
- if (!correctPose)
4697
+ async function changeMode(five, changeModeParams) {
4698
+ await new Promise((resolve, reject) => {
4699
+ // 虽然 changeMode 是异步函数,但不代表异步流程结束代表切换 Mode 动画结束
4700
+ five.changeMode(...changeModeParams).catch((error) => reject(error));
4701
+ five.once('initAnimationEnded', () => {
4702
+ const fiveCurrentState = five.getCurrentState();
4703
+ const correctMode = changeModeParams[0];
4704
+ if (fiveCurrentState.mode !== correctMode)
4705
+ reject(new Error('mode 与预期不符'));
4706
+ /** 检测当前的 current pose 和传入的 pose 是否一致 */
4707
+ const checkPose = () => {
4708
+ const correctPose = changeModeParams[1];
4709
+ if (!correctPose)
4710
+ return true;
4711
+ return Object.keys(correctPose).every((key) => {
4712
+ const fivePoseItem = fiveCurrentState[key];
4713
+ if (fivePoseItem === undefined)
4742
4714
  return true;
4743
- return Object.keys(correctPose).every((key) => {
4744
- const fivePoseItem = fiveCurrentState[key];
4745
- if (fivePoseItem === undefined)
4746
- return true;
4747
- const correctPoseItem = correctPose[key];
4748
- if (typeof fivePoseItem === 'number' && typeof correctPoseItem === 'number') {
4749
- return nearlyEqual(fivePoseItem, correctPoseItem, 2);
4750
- }
4751
- return fivePoseItem === correctPoseItem;
4752
- });
4753
- };
4754
- const checkPoseResult = checkPose();
4755
- if (!checkPoseResult)
4756
- reject(new Error('five pose 与预期不符'));
4757
- resolve();
4758
- });
4715
+ const correctPoseItem = correctPose[key];
4716
+ if (typeof fivePoseItem === 'number' && typeof correctPoseItem === 'number') {
4717
+ return nearlyEqual(fivePoseItem, correctPoseItem, 2);
4718
+ }
4719
+ return fivePoseItem === correctPoseItem;
4720
+ });
4721
+ };
4722
+ const checkPoseResult = checkPose();
4723
+ if (!checkPoseResult)
4724
+ reject(new Error('five pose 与预期不符'));
4725
+ resolve();
4759
4726
  });
4760
4727
  });
4761
4728
  }
@@ -5102,24 +5069,22 @@ class Controller$3 extends Controller$4 {
5102
5069
  five.once('dispose', this.dispose);
5103
5070
  this.addEventListener();
5104
5071
  }
5105
- load(serverData, state, userAction = true) {
5106
- return __awaiter(this, void 0, void 0, function* () {
5107
- function isPluginServerData(serverData) {
5108
- return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
5109
- }
5110
- const _data = serverData;
5111
- if (_data && !_data.version)
5112
- console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
5113
- const copyData = JSON.parse(JSON.stringify(serverData));
5114
- const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
5115
- const prevData = this.data;
5116
- this.data = yield formatData(_serverData);
5117
- this.hooks.emit('dataLoaded', this.data);
5118
- this.hooks.emit('dataChange', this.data, prevData);
5119
- if (state)
5120
- this.updateState(state, userAction);
5121
- this.render();
5122
- });
5072
+ async load(serverData, state, userAction = true) {
5073
+ function isPluginServerData(serverData) {
5074
+ return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
5075
+ }
5076
+ const _data = serverData;
5077
+ if (_data && !_data.version)
5078
+ console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
5079
+ const copyData = JSON.parse(JSON.stringify(serverData));
5080
+ const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
5081
+ const prevData = this.data;
5082
+ this.data = await formatData(_serverData);
5083
+ this.hooks.emit('dataLoaded', this.data);
5084
+ this.hooks.emit('dataChange', this.data, prevData);
5085
+ if (state)
5086
+ this.updateState(state, userAction);
5087
+ this.render();
5123
5088
  }
5124
5089
  /** 更新户型图位置 */
5125
5090
  updatePosition() {
@@ -5144,25 +5109,21 @@ class Controller$3 extends Controller$4 {
5144
5109
  this.render();
5145
5110
  return this;
5146
5111
  }
5147
- show(options = {}) {
5148
- return __awaiter(this, void 0, void 0, function* () {
5149
- // 已经展示完成了,不做任何操作
5150
- if (this.state.visible)
5151
- return;
5152
- const userAction = options.userAction !== undefined ? options.userAction : true;
5153
- this.updateState({ visible: true }, userAction);
5154
- this._show({ userAction });
5155
- });
5112
+ async show(options = {}) {
5113
+ // 已经展示完成了,不做任何操作
5114
+ if (this.state.visible)
5115
+ return;
5116
+ const userAction = options.userAction !== undefined ? options.userAction : true;
5117
+ this.updateState({ visible: true }, userAction);
5118
+ this._show({ userAction });
5156
5119
  }
5157
- hide(options = {}) {
5158
- return __awaiter(this, void 0, void 0, function* () {
5159
- this.isHiddenByHideFunc = true;
5160
- if (!this.state.visible)
5161
- return;
5162
- const userAction = options.userAction !== undefined ? options.userAction : true;
5163
- this.updateState({ visible: false }, userAction);
5164
- this._hide({ userAction });
5165
- });
5120
+ async hide(options = {}) {
5121
+ this.isHiddenByHideFunc = true;
5122
+ if (!this.state.visible)
5123
+ return;
5124
+ const userAction = options.userAction !== undefined ? options.userAction : true;
5125
+ this.updateState({ visible: false }, userAction);
5126
+ this._hide({ userAction });
5166
5127
  }
5167
5128
  enable(options = {}) {
5168
5129
  if (this.state.enabled)
@@ -5192,42 +5153,36 @@ class Controller$3 extends Controller$4 {
5192
5153
  state.visible ? this._show(options) : this._hide(options);
5193
5154
  }
5194
5155
  }
5195
- formatData(serverData) {
5196
- return __awaiter(this, void 0, void 0, function* () {
5197
- return yield formatData(serverData.data);
5198
- });
5156
+ async formatData(serverData) {
5157
+ return await formatData(serverData.data);
5199
5158
  }
5200
- _show(options) {
5201
- return __awaiter(this, void 0, void 0, function* () {
5202
- if (!this.state.enabled)
5203
- return;
5204
- this.isHiddenByHideFunc = false;
5205
- const { userAction } = options;
5206
- this.hooks.emit('show', { userAction });
5207
- if (this.five.getCurrentState().mode !== 'Topview') {
5208
- yield changeMode(this.five, ['Topview', undefined, undefined, userAction]);
5209
- }
5210
- this.five.model.show(this.floorIndex);
5211
- this.updatePosition();
5212
- this.updateSize();
5213
- const renderDuration = 500;
5214
- const modelOpacity = this.state.config.modelOpacity;
5215
- changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5216
- this.hooks.emit('showAnimationEnded', { userAction });
5217
- this.render();
5218
- });
5159
+ async _show(options) {
5160
+ if (!this.state.enabled)
5161
+ return;
5162
+ this.isHiddenByHideFunc = false;
5163
+ const { userAction } = options;
5164
+ this.hooks.emit('show', { userAction });
5165
+ if (this.five.getCurrentState().mode !== 'Topview') {
5166
+ await changeMode(this.five, ['Topview', undefined, undefined, userAction]);
5167
+ }
5168
+ this.five.model.show(this.floorIndex);
5169
+ this.updatePosition();
5170
+ this.updateSize();
5171
+ const renderDuration = 500;
5172
+ const modelOpacity = this.state.config.modelOpacity;
5173
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5174
+ this.hooks.emit('showAnimationEnded', { userAction });
5175
+ this.render();
5219
5176
  }
5220
- _hide(options) {
5221
- return __awaiter(this, void 0, void 0, function* () {
5222
- if (!this.state.enabled)
5223
- return;
5224
- const { userAction } = options;
5225
- this.hooks.emit('hide', { userAction });
5226
- const modelOpacity = 1;
5227
- const renderDuration = 0;
5228
- changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5229
- this.render();
5230
- });
5177
+ async _hide(options) {
5178
+ if (!this.state.enabled)
5179
+ return;
5180
+ const { userAction } = options;
5181
+ this.hooks.emit('hide', { userAction });
5182
+ const modelOpacity = 1;
5183
+ const renderDuration = 0;
5184
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5185
+ this.render();
5231
5186
  }
5232
5187
  _enable(options) {
5233
5188
  const { userAction } = options;
@@ -6280,55 +6235,49 @@ class Controller$2 extends Controller$4 {
6280
6235
  // =============== init Listener ===============
6281
6236
  five.once('dispose', this.dispose);
6282
6237
  }
6283
- load(serverData, state, userAction = true) {
6284
- return __awaiter(this, void 0, void 0, function* () {
6285
- // const loadImage = async () => {
6286
- // const floorIndex = this.five.work.observers[this.five.getCurrentState().panoIndex].floorIndex
6287
- // // 当有 svgString 时,没有加载过程
6288
- // if (floorplanData.outlines[floorIndex]?.svgContent) return
6289
- // // 如果当前楼层图片不存在,不存在加载过程
6290
- // const nowFloorImageSrc = floorplanData.outlines[floorIndex]?.url
6291
- // if (!nowFloorImageSrc) return
6292
- // // 图片加载完成时再 render
6293
- // await new Promise<void>((resolve) => {
6294
- // const nowFloorImage = new Image()
6295
- // nowFloorImage.src = nowFloorImageSrc
6296
- // nowFloorImage.onload = () => resolve()
6297
- // })
6298
- // }
6299
- // await loadImage()
6300
- function isPluginServerData(serverData) {
6301
- return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
6302
- }
6303
- const copyData = JSON.parse(JSON.stringify(serverData));
6304
- const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
6305
- const prevData = this.data;
6306
- this.data = yield formatData(_serverData);
6307
- this.hooks.emit('dataLoaded', this.data);
6308
- this.hooks.emit('dataChange', this.data, prevData);
6309
- if (state)
6310
- this.updateState(state, userAction);
6311
- this.render();
6312
- });
6238
+ async load(serverData, state, userAction = true) {
6239
+ // const loadImage = async () => {
6240
+ // const floorIndex = this.five.work.observers[this.five.getCurrentState().panoIndex].floorIndex
6241
+ // // 当有 svgString 时,没有加载过程
6242
+ // if (floorplanData.outlines[floorIndex]?.svgContent) return
6243
+ // // 如果当前楼层图片不存在,不存在加载过程
6244
+ // const nowFloorImageSrc = floorplanData.outlines[floorIndex]?.url
6245
+ // if (!nowFloorImageSrc) return
6246
+ // // 图片加载完成时再 render
6247
+ // await new Promise<void>((resolve) => {
6248
+ // const nowFloorImage = new Image()
6249
+ // nowFloorImage.src = nowFloorImageSrc
6250
+ // nowFloorImage.onload = () => resolve()
6251
+ // })
6252
+ // }
6253
+ // await loadImage()
6254
+ function isPluginServerData(serverData) {
6255
+ return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
6256
+ }
6257
+ const copyData = JSON.parse(JSON.stringify(serverData));
6258
+ const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
6259
+ const prevData = this.data;
6260
+ this.data = await formatData(_serverData);
6261
+ this.hooks.emit('dataLoaded', this.data);
6262
+ this.hooks.emit('dataChange', this.data, prevData);
6263
+ if (state)
6264
+ this.updateState(state, userAction);
6265
+ this.render();
6313
6266
  }
6314
- show(options = {}) {
6315
- return __awaiter(this, void 0, void 0, function* () {
6316
- // 已经展示完成了,不做任何操作
6317
- if (this.state.visible)
6318
- return;
6319
- const userAction = options.userAction !== undefined ? options.userAction : true;
6320
- this.updateState({ visible: true }, userAction);
6321
- this._show({ userAction });
6322
- });
6267
+ async show(options = {}) {
6268
+ // 已经展示完成了,不做任何操作
6269
+ if (this.state.visible)
6270
+ return;
6271
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6272
+ this.updateState({ visible: true }, userAction);
6273
+ this._show({ userAction });
6323
6274
  }
6324
- hide(options = {}) {
6325
- return __awaiter(this, void 0, void 0, function* () {
6326
- if (!this.state.visible)
6327
- return;
6328
- const userAction = options.userAction !== undefined ? options.userAction : true;
6329
- this.updateState({ visible: false }, userAction);
6330
- this._hide({ userAction });
6331
- });
6275
+ async hide(options = {}) {
6276
+ if (!this.state.visible)
6277
+ return;
6278
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6279
+ this.updateState({ visible: false }, userAction);
6280
+ this._hide({ userAction });
6332
6281
  }
6333
6282
  enable(options = {}) {
6334
6283
  if (this.state.enabled)
@@ -6373,10 +6322,8 @@ class Controller$2 extends Controller$4 {
6373
6322
  this.extraObjects = formatExtraObjects(data, this.five, this.data);
6374
6323
  this.render();
6375
6324
  }
6376
- formatData(serverData) {
6377
- return __awaiter(this, void 0, void 0, function* () {
6378
- return yield formatData(serverData.data);
6379
- });
6325
+ async formatData(serverData) {
6326
+ return await formatData(serverData.data);
6380
6327
  }
6381
6328
  _enable(options) {
6382
6329
  const { userAction } = options;
@@ -6436,18 +6383,16 @@ const PanoFloorplanRadarPlugin = (five, params) => {
6436
6383
  * 有异常,则返回 [Error, undefined]
6437
6384
  * 用于替代 try&catch 处理 await 异常的方案
6438
6385
  */
6439
- function to(promise) {
6440
- return __awaiter(this, void 0, void 0, function* () {
6441
- try {
6442
- const data = yield promise;
6443
- return [null, data];
6444
- }
6445
- catch (error) {
6446
- if (error instanceof Error)
6447
- return [error, null];
6448
- return [new Error(''), null];
6449
- }
6450
- });
6386
+ async function to(promise) {
6387
+ try {
6388
+ const data = await promise;
6389
+ return [null, data];
6390
+ }
6391
+ catch (error) {
6392
+ if (error instanceof Error)
6393
+ return [error, null];
6394
+ return [new Error(''), null];
6395
+ }
6451
6396
  }
6452
6397
 
6453
6398
  var FloorplanErrorType;
@@ -6492,29 +6437,27 @@ function checkShowState(five, showState) {
6492
6437
  * 2. 内置了相应的动画时间计算
6493
6438
  * 3. 纠正成功会返回 true,失败「可能会被用户行为中断」会返回 false
6494
6439
  */
6495
- function correctFiveState(five, showState, userAction = true) {
6496
- return __awaiter(this, void 0, void 0, function* () {
6497
- // 当前已满足状态,不需要变更
6498
- const result = checkShowState(five, showState);
6499
- if (result === true)
6500
- return;
6501
- const currentFiveState = five.getCurrentState();
6502
- // 纠正 mode
6503
- if (currentFiveState.mode !== showState.mode) {
6504
- const [changeModeError] = yield to(changeMode(five, [showState.mode, showState, undefined, userAction]));
6505
- if (changeModeError)
6506
- throw new Error(FloorplanErrorType.ChangeModeError);
6507
- return;
6508
- }
6509
- // 纠正相机状态
6510
- // 根据 latitude、longitude、fov 计算动画时间,最多 1s
6511
- const { latitude, longitude, fov } = currentFiveState;
6512
- 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));
6513
- const [updateCameraError] = yield to(five.updateCamera(showState, time, userAction));
6514
- if (updateCameraError)
6515
- throw new Error(FloorplanErrorType.UpdateCameraError);
6440
+ async function correctFiveState(five, showState, userAction = true) {
6441
+ // 当前已满足状态,不需要变更
6442
+ const result = checkShowState(five, showState);
6443
+ if (result === true)
6516
6444
  return;
6517
- });
6445
+ const currentFiveState = five.getCurrentState();
6446
+ // 纠正 mode
6447
+ if (currentFiveState.mode !== showState.mode) {
6448
+ const [changeModeError] = await to(changeMode(five, [showState.mode, showState, undefined, userAction]));
6449
+ if (changeModeError)
6450
+ throw new Error(FloorplanErrorType.ChangeModeError);
6451
+ return;
6452
+ }
6453
+ // 纠正相机状态
6454
+ // 根据 latitude、longitude、fov 计算动画时间,最多 1s
6455
+ const { latitude, longitude, fov } = currentFiveState;
6456
+ 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));
6457
+ const [updateCameraError] = await to(five.updateCamera(showState, time, userAction));
6458
+ if (updateCameraError)
6459
+ throw new Error(FloorplanErrorType.UpdateCameraError);
6460
+ return;
6518
6461
  }
6519
6462
 
6520
6463
  /** 当前 five 的相机视角是否满足户型图自动隐藏条件
@@ -6683,7 +6626,7 @@ class Controller$1 extends Controller$4 {
6683
6626
  enumerable: true,
6684
6627
  configurable: true,
6685
6628
  writable: true,
6686
- value: (options = {}) => __awaiter(this, void 0, void 0, function* () {
6629
+ value: async (options = {}) => {
6687
6630
  if (!this.state.enabled)
6688
6631
  return;
6689
6632
  // 已经展示完成了,不做任何操作
@@ -6692,14 +6635,14 @@ class Controller$1 extends Controller$4 {
6692
6635
  const userAction = options.userAction !== undefined ? options.userAction : true;
6693
6636
  this.updateState({ visible: true }, userAction);
6694
6637
  this._show(options);
6695
- })
6638
+ }
6696
6639
  });
6697
6640
  /** 隐藏户型图 */
6698
6641
  Object.defineProperty(this, "hide", {
6699
6642
  enumerable: true,
6700
6643
  configurable: true,
6701
6644
  writable: true,
6702
- value: (options = {}) => __awaiter(this, void 0, void 0, function* () {
6645
+ value: async (options = {}) => {
6703
6646
  if (!this.state.enabled)
6704
6647
  return;
6705
6648
  this.isHiddenByHideFunc = true;
@@ -6707,7 +6650,7 @@ class Controller$1 extends Controller$4 {
6707
6650
  return;
6708
6651
  this.updateState({ visible: false }, options.userAction || true);
6709
6652
  this._hide(options);
6710
- })
6653
+ }
6711
6654
  });
6712
6655
  /** 更新户型图大小 */
6713
6656
  Object.defineProperty(this, "updateSize", {
@@ -6773,11 +6716,11 @@ class Controller$1 extends Controller$4 {
6773
6716
  enumerable: true,
6774
6717
  configurable: true,
6775
6718
  writable: true,
6776
- value: (options) => __awaiter(this, void 0, void 0, function* () {
6777
- var _b;
6719
+ value: async (options) => {
6720
+ var _a;
6778
6721
  if (!this.state.enabled)
6779
6722
  return;
6780
- if (!((_b = this.five.model) === null || _b === void 0 ? void 0 : _b.loaded))
6723
+ if (!((_a = this.five.model) === null || _a === void 0 ? void 0 : _a.loaded))
6781
6724
  throw new Error(FloorplanErrorType.ModelNotLoaded);
6782
6725
  if (!this.data)
6783
6726
  throw new Error(FloorplanErrorType.DataNotLoaded);
@@ -6791,7 +6734,7 @@ class Controller$1 extends Controller$4 {
6791
6734
  userAction: true,
6792
6735
  };
6793
6736
  const mergedOptions = Object.assign(Object.assign({}, baseShowOpts), options);
6794
- const getShowPromise = () => __awaiter(this, void 0, void 0, function* () {
6737
+ const getShowPromise = async () => {
6795
6738
  this.hooks.emit('show', { userAction: mergedOptions.userAction, auto: mergedOptions.isAutoShow });
6796
6739
  let hasRejected = false;
6797
6740
  let externalErrorMsg;
@@ -6799,7 +6742,7 @@ class Controller$1 extends Controller$4 {
6799
6742
  hasRejected = true;
6800
6743
  externalErrorMsg = errorMsg;
6801
6744
  };
6802
- const [correctError] = yield to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
6745
+ const [correctError] = await to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
6803
6746
  if (correctError)
6804
6747
  throw correctError;
6805
6748
  // 异步结束要判断当前是不是被中断了
@@ -6817,7 +6760,7 @@ class Controller$1 extends Controller$4 {
6817
6760
  const renderDuration = mergedOptions.immediately ? 0 : SHOW_ANIME_DURATION;
6818
6761
  changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
6819
6762
  this.render(renderDuration);
6820
- });
6763
+ };
6821
6764
  this.showPromise = getShowPromise()
6822
6765
  .then(() => {
6823
6766
  this.hooks.emit('showAnimationEnded', {
@@ -6839,7 +6782,7 @@ class Controller$1 extends Controller$4 {
6839
6782
  this.showRejection = undefined;
6840
6783
  });
6841
6784
  return this.showPromise;
6842
- })
6785
+ }
6843
6786
  });
6844
6787
  Object.defineProperty(this, "_hide", {
6845
6788
  enumerable: true,
@@ -7073,24 +7016,22 @@ class Controller$1 extends Controller$4 {
7073
7016
  five.once('dispose', this.dispose);
7074
7017
  this.addEventListener();
7075
7018
  }
7076
- load(serverData, state, userAction = true) {
7077
- return __awaiter(this, void 0, void 0, function* () {
7078
- function isPluginServerData(serverData) {
7079
- return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
7080
- }
7081
- const _data = serverData;
7082
- if (_data && !_data.version)
7083
- console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
7084
- const copyData = JSON.parse(JSON.stringify(serverData));
7085
- const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
7086
- const prevData = this.data;
7087
- this.data = yield formatData(_serverData);
7088
- this.hooks.emit('dataLoaded', this.data);
7089
- this.hooks.emit('dataChange', this.data, prevData);
7090
- if (state)
7091
- this.updateState(state, userAction);
7092
- this.render();
7093
- });
7019
+ async load(serverData, state, userAction = true) {
7020
+ function isPluginServerData(serverData) {
7021
+ return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
7022
+ }
7023
+ const _data = serverData;
7024
+ if (_data && !_data.version)
7025
+ console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
7026
+ const copyData = JSON.parse(JSON.stringify(serverData));
7027
+ const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
7028
+ const prevData = this.data;
7029
+ this.data = await formatData(_serverData);
7030
+ this.hooks.emit('dataLoaded', this.data);
7031
+ this.hooks.emit('dataChange', this.data, prevData);
7032
+ if (state)
7033
+ this.updateState(state, userAction);
7034
+ this.render();
7094
7035
  }
7095
7036
  /** 把插件的渲染DOM插入到对应的容器中去 */
7096
7037
  appendTo(wrapper) {
@@ -7138,10 +7079,8 @@ class Controller$1 extends Controller$4 {
7138
7079
  return;
7139
7080
  this.render();
7140
7081
  }
7141
- formatData(serverData) {
7142
- return __awaiter(this, void 0, void 0, function* () {
7143
- return yield formatData(serverData.data);
7144
- });
7082
+ async formatData(serverData) {
7083
+ return await formatData(serverData.data);
7145
7084
  }
7146
7085
  updateState(state, userAction) {
7147
7086
  const prevState = this.state;
@@ -7369,10 +7308,10 @@ const ModelChassisCompassPlugin = (five, params) => {
7369
7308
  const defaultNorthRad = (_a = params.north_rad) !== null && _a !== void 0 ? _a : undefined;
7370
7309
  // 局部状态
7371
7310
  const state = {};
7372
- const load = (data) => __awaiter(void 0, void 0, void 0, function* () {
7373
- var _b;
7311
+ const load = async (data) => {
7312
+ var _a;
7374
7313
  const fbxUrl = (data === null || data === void 0 ? void 0 : data.fbx_url) || defaultFbxUrl;
7375
- const northRad = (_b = data === null || data === void 0 ? void 0 : data.north_rad) !== null && _b !== void 0 ? _b : defaultNorthRad;
7314
+ const northRad = (_a = data === null || data === void 0 ? void 0 : data.north_rad) !== null && _a !== void 0 ? _a : defaultNorthRad;
7376
7315
  if (typeof northRad !== 'number') {
7377
7316
  throw new Error('"northRad"配置参数缺失:未配置指南针指向!');
7378
7317
  }
@@ -7381,7 +7320,7 @@ const ModelChassisCompassPlugin = (five, params) => {
7381
7320
  const zOffset = bounding.max.z - bounding.min.z;
7382
7321
  const maxOffset = Math.max(xOffset, zOffset);
7383
7322
  const fbxLoader = new FBXLoader.FBXLoader();
7384
- const object = yield fbxLoader.loadAsync(fbxUrl);
7323
+ const object = await fbxLoader.loadAsync(fbxUrl);
7385
7324
  transfromToMeshBasicMaterial(object, {
7386
7325
  transparent: true,
7387
7326
  side: THREE__namespace.DoubleSide,
@@ -7395,7 +7334,7 @@ const ModelChassisCompassPlugin = (five, params) => {
7395
7334
  bject3d2LocalMatrix(object, { position, rotation, scale });
7396
7335
  state.object = object;
7397
7336
  return true;
7398
- });
7337
+ };
7399
7338
  const onCameraUpdate = ({ latitude }) => {
7400
7339
  if (!state.object)
7401
7340
  return;
@@ -7465,25 +7404,25 @@ const ModelEntryDoorGuidePlugin = (five, params) => {
7465
7404
  const defaultRad = (_c = params.rad) !== null && _c !== void 0 ? _c : undefined;
7466
7405
  const defaultFbxUrl = params.fbx_url || '//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx';
7467
7406
  const mixers = [];
7468
- const load = (data) => __awaiter(void 0, void 0, void 0, function* () {
7469
- var _d, _e, _f, _g, _h, _j, _k;
7470
- const position = (_d = data === null || data === void 0 ? void 0 : data.position) !== null && _d !== void 0 ? _d : defaultModelPosition;
7407
+ const load = async (data) => {
7408
+ var _a, _b, _c, _d, _e, _f, _g;
7409
+ const position = (_a = data === null || data === void 0 ? void 0 : data.position) !== null && _a !== void 0 ? _a : defaultModelPosition;
7471
7410
  if (!position)
7472
7411
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): position is undefined`);
7473
7412
  const modelPosition = transformPositionToVector3(position);
7474
- const rad = (_e = data === null || data === void 0 ? void 0 : data.rad) !== null && _e !== void 0 ? _e : defaultRad;
7475
- const fbxUrl = (_f = data === null || data === void 0 ? void 0 : data.fbx_url) !== null && _f !== void 0 ? _f : defaultFbxUrl;
7413
+ const rad = (_b = data === null || data === void 0 ? void 0 : data.rad) !== null && _b !== void 0 ? _b : defaultRad;
7414
+ const fbxUrl = (_c = data === null || data === void 0 ? void 0 : data.fbx_url) !== null && _c !== void 0 ? _c : defaultFbxUrl;
7476
7415
  state.rad = rad;
7477
7416
  if (rad === undefined)
7478
7417
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): rad is ${rad}`);
7479
7418
  // 加载模型
7480
- const object = yield new FBXLoader.FBXLoader().loadAsync(fbxUrl);
7419
+ const object = await new FBXLoader.FBXLoader().loadAsync(fbxUrl);
7481
7420
  // 设置位置
7482
7421
  object.position.copy(modelPosition);
7483
7422
  object.rotation.z = rad;
7484
7423
  object.scale.set(0.8, 0.8, 0.8);
7485
7424
  transfromToMeshBasicMaterial(object, { transparent: true, side: THREE__namespace.DoubleSide });
7486
- const textMesh = (_k = (_j = (_h = (_g = object.children) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.children) === null || _j === void 0 ? void 0 : _j[3]) === null || _k === void 0 ? void 0 : _k.clone();
7425
+ const textMesh = (_g = (_f = (_e = (_d = object.children) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.children) === null || _f === void 0 ? void 0 : _f[3]) === null || _g === void 0 ? void 0 : _g.clone();
7487
7426
  if (!textMesh)
7488
7427
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): textMesh is ${textMesh}`);
7489
7428
  textMesh.material = new THREE.MeshBasicMaterial({ transparent: true, map: createCanvasTextTexture('入户门') });
@@ -7491,7 +7430,7 @@ const ModelEntryDoorGuidePlugin = (five, params) => {
7491
7430
  object.children[0].add(textMesh);
7492
7431
  state.object = object;
7493
7432
  return true;
7494
- });
7433
+ };
7495
7434
  const initAnimation = () => {
7496
7435
  if (state.animation)
7497
7436
  return;
@@ -7728,21 +7667,21 @@ const getLongitudeParams = (from, to, rotation) => {
7728
7667
  */
7729
7668
  const CameraMovementPlugin = (five$1) => {
7730
7669
  const state = {};
7731
- const move = (args, duration, opts = { preload: true }) => __awaiter(void 0, void 0, void 0, function* () {
7670
+ const move = async (args, duration, opts = { preload: true }) => {
7732
7671
  if (state.interruptCallback) {
7733
7672
  state.interruptCallback(false);
7734
7673
  }
7735
7674
  if (opts.asyncStartCallback) {
7736
- yield opts.asyncStartCallback();
7675
+ await opts.asyncStartCallback();
7737
7676
  }
7738
7677
  if (args.mode && args.mode !== five$1.currentMode) {
7739
- yield five$1.changeMode(args.mode);
7678
+ await five$1.changeMode(args.mode);
7740
7679
  }
7741
7680
  if (opts.preload && args.panoIndex !== undefined && args.panoIndex !== five$1.panoIndex) {
7742
- yield five$1.preloadPano(args.panoIndex);
7681
+ await five$1.preloadPano(args.panoIndex);
7743
7682
  }
7744
7683
  if (opts.asyncEndCallback) {
7745
- yield opts.asyncEndCallback();
7684
+ await opts.asyncEndCallback();
7746
7685
  }
7747
7686
  if (args.panoIndex === undefined &&
7748
7687
  args.fov === undefined &&
@@ -7750,7 +7689,7 @@ const CameraMovementPlugin = (five$1) => {
7750
7689
  args.longitude === undefined) {
7751
7690
  return true;
7752
7691
  }
7753
- return yield new Promise((resolve, reject) => {
7692
+ return await new Promise((resolve, reject) => {
7754
7693
  const panoIndex = args.panoIndex !== undefined ? args.panoIndex : five$1.panoIndex;
7755
7694
  if (panoIndex !== undefined) {
7756
7695
  five$1.moveToPano(panoIndex, Object.assign({
@@ -7763,7 +7702,7 @@ const CameraMovementPlugin = (five$1) => {
7763
7702
  reject(false);
7764
7703
  }
7765
7704
  });
7766
- });
7705
+ };
7767
7706
  const getAnimeParams = (args) => {
7768
7707
  const currentFiveState = five$1.state;
7769
7708
  // latitude
@@ -7779,20 +7718,20 @@ const CameraMovementPlugin = (five$1) => {
7779
7718
  to: { latitude: toLatitude, longitude: toLongitude, fov: toFov },
7780
7719
  };
7781
7720
  };
7782
- const rotate = (args, duration, opts = {}) => __awaiter(void 0, void 0, void 0, function* () {
7721
+ const rotate = async (args, duration, opts = {}) => {
7783
7722
  if (state.interruptCallback) {
7784
7723
  state.interruptCallback(false);
7785
7724
  }
7786
7725
  if (opts.asyncStartCallback) {
7787
- yield opts.asyncStartCallback();
7726
+ await opts.asyncStartCallback();
7788
7727
  }
7789
7728
  if (five$1.currentMode !== five.Five.Mode.Panorama) {
7790
- yield five$1.changeMode(five.Five.Mode.Panorama);
7729
+ await five$1.changeMode(five.Five.Mode.Panorama);
7791
7730
  }
7792
7731
  if (args.panoIndex !== undefined && args.panoIndex !== five$1.panoIndex) {
7793
7732
  if (opts.preload)
7794
- yield five$1.preloadPano(args.panoIndex);
7795
- yield new Promise((resolve, reject) => {
7733
+ await five$1.preloadPano(args.panoIndex);
7734
+ await new Promise((resolve, reject) => {
7796
7735
  if (!args.panoIndex) {
7797
7736
  resolve(true);
7798
7737
  return;
@@ -7804,10 +7743,10 @@ const CameraMovementPlugin = (five$1) => {
7804
7743
  });
7805
7744
  }
7806
7745
  if (opts.asyncEndCallback) {
7807
- yield opts.asyncEndCallback();
7746
+ await opts.asyncEndCallback();
7808
7747
  }
7809
7748
  const { from, to } = getAnimeParams(args);
7810
- return yield new Promise((resolve) => {
7749
+ return await new Promise((resolve) => {
7811
7750
  const onUpdate = ({ progress }) => {
7812
7751
  const state = {};
7813
7752
  state.longitude = progressNumber(from.longitude, to.longitude, progress);
@@ -7849,7 +7788,7 @@ const CameraMovementPlugin = (five$1) => {
7849
7788
  state.interruptCallback(true);
7850
7789
  }, duration);
7851
7790
  });
7852
- });
7791
+ };
7853
7792
  return {
7854
7793
  move,
7855
7794
  rotate,
@@ -8209,7 +8148,7 @@ const PanoRulerPlugin = (five$1, params) => {
8209
8148
  freshRule();
8210
8149
  return true;
8211
8150
  };
8212
- const load = (_roomInfo, _roomRules, options) => __awaiter(void 0, void 0, void 0, function* () {
8151
+ const load = async (_roomInfo, _roomRules, options) => {
8213
8152
  const roomInfo = _roomInfo || params.roomInfo;
8214
8153
  const roomRules = _roomRules || params.roomRules;
8215
8154
  if (!roomInfo || !roomRules) {
@@ -8221,9 +8160,9 @@ const PanoRulerPlugin = (five$1, params) => {
8221
8160
  return _load(roomInfo, roomRules);
8222
8161
  }
8223
8162
  else {
8224
- return yield new Promise((resolve) => five$1.once('modelLoaded', () => resolve(_load(roomInfo, roomRules))));
8163
+ return await new Promise((resolve) => five$1.once('modelLoaded', () => resolve(_load(roomInfo, roomRules))));
8225
8164
  }
8226
- });
8165
+ };
8227
8166
  if (params.roomInfo && params.roomRules) {
8228
8167
  load(params.roomInfo, params.roomRules);
8229
8168
  }
@@ -9133,22 +9072,20 @@ class Controller {
9133
9072
  if ((_a = params.options) === null || _a === void 0 ? void 0 : _a.className)
9134
9073
  this.container.classList.add((_b = params.options) === null || _b === void 0 ? void 0 : _b.className);
9135
9074
  }
9136
- this.five.once('modelLoaded', () => __awaiter(this, void 0, void 0, function* () {
9137
- var _c, _d;
9138
- (_d = (_c = this.five.getElement()) === null || _c === void 0 ? void 0 : _c.parentNode) === null || _d === void 0 ? void 0 : _d.append(this.container);
9139
- }));
9075
+ this.five.once('modelLoaded', async () => {
9076
+ var _a, _b;
9077
+ (_b = (_a = this.five.getElement()) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.append(this.container);
9078
+ });
9140
9079
  this.five.once('dispose', () => this.dispose());
9141
9080
  }
9142
- load(serverData) {
9143
- return __awaiter(this, void 0, void 0, function* () {
9144
- if (!this.five.work)
9145
- return;
9146
- const data = serverData.data;
9147
- if (!data)
9148
- throw new Error('标尺数据依赖不齐全!');
9149
- this.panoRulerProData = data;
9150
- this.state.loaded = true;
9151
- });
9081
+ async load(serverData) {
9082
+ if (!this.five.work)
9083
+ return;
9084
+ const data = serverData.data;
9085
+ if (!data)
9086
+ throw new Error('标尺数据依赖不齐全!');
9087
+ this.panoRulerProData = data;
9088
+ this.state.loaded = true;
9152
9089
  }
9153
9090
  enable() {
9154
9091
  if (!this.state.loaded)
@@ -9166,26 +9103,24 @@ class Controller {
9166
9103
  this.render();
9167
9104
  return true;
9168
9105
  }
9169
- render() {
9106
+ async render() {
9170
9107
  var _a;
9171
- return __awaiter(this, void 0, void 0, function* () {
9172
- if (this.state.enabled) {
9173
- if (!this.panoRulerProData || !this.container)
9174
- return;
9175
- this.rulerItems = new RulerItems({
9176
- target: this.container,
9177
- props: {
9178
- five: this.five,
9179
- rulerDatas: this.panoRulerProData,
9180
- options: this.state.options,
9181
- },
9182
- });
9183
- }
9184
- else {
9185
- (_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
9186
- this.rulerItems = undefined;
9187
- }
9188
- });
9108
+ if (this.state.enabled) {
9109
+ if (!this.panoRulerProData || !this.container)
9110
+ return;
9111
+ this.rulerItems = new RulerItems({
9112
+ target: this.container,
9113
+ props: {
9114
+ five: this.five,
9115
+ rulerDatas: this.panoRulerProData,
9116
+ options: this.state.options,
9117
+ },
9118
+ });
9119
+ }
9120
+ else {
9121
+ (_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
9122
+ this.rulerItems = undefined;
9123
+ }
9189
9124
  }
9190
9125
  dispose() {
9191
9126
  if (this.container) {
@@ -9254,14 +9189,12 @@ function getRoomInfoInstance() {
9254
9189
  }
9255
9190
 
9256
9191
  const textureLoader = new THREE__namespace.TextureLoader();
9257
- function loadTexture(url) {
9258
- return __awaiter(this, void 0, void 0, function* () {
9259
- return new Promise((resolve, reject) => {
9260
- textureLoader.load(url, resolve, undefined, reject);
9261
- }).then((texture) => {
9262
- texture.encoding = THREE__namespace.sRGBEncoding;
9263
- return texture;
9264
- });
9192
+ async function loadTexture(url) {
9193
+ return new Promise((resolve, reject) => {
9194
+ textureLoader.load(url, resolve, undefined, reject);
9195
+ }).then((texture) => {
9196
+ texture.encoding = THREE__namespace.sRGBEncoding;
9197
+ return texture;
9265
9198
  });
9266
9199
  }
9267
9200
 
@@ -9688,19 +9621,17 @@ class PanoCompassController extends Controller$4 {
9688
9621
  this.init();
9689
9622
  }
9690
9623
  }
9691
- load(data, state, userAction = true) {
9692
- return __awaiter(this, void 0, void 0, function* () {
9693
- const nextData = yield this.formatData(data);
9694
- if (JSON.stringify(this.data) !== JSON.stringify(nextData)) {
9695
- this.hooks.emit('dataChange', nextData, this.data);
9696
- this.data = Object.assign({}, nextData);
9697
- this.init();
9698
- if (state) {
9699
- this.setState(state, { userAction });
9700
- }
9701
- this.hooks.emit('dataLoaded', this.data);
9624
+ async load(data, state, userAction = true) {
9625
+ const nextData = await this.formatData(data);
9626
+ if (JSON.stringify(this.data) !== JSON.stringify(nextData)) {
9627
+ this.hooks.emit('dataChange', nextData, this.data);
9628
+ this.data = Object.assign({}, nextData);
9629
+ this.init();
9630
+ if (state) {
9631
+ this.setState(state, { userAction });
9702
9632
  }
9703
- });
9633
+ this.hooks.emit('dataLoaded', this.data);
9634
+ }
9704
9635
  }
9705
9636
  formatData(serverData) {
9706
9637
  if (serverData.version && serverData.data) {
@@ -9714,64 +9645,58 @@ class PanoCompassController extends Controller$4 {
9714
9645
  * 初始化
9715
9646
  * @todo 逻辑需要细分
9716
9647
  */
9717
- init() {
9648
+ async init() {
9718
9649
  var _a, _b, _c, _d;
9719
- return __awaiter(this, void 0, void 0, function* () {
9720
- const northRad = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.north_rad) !== null && _b !== void 0 ? _b : null;
9721
- this._clearCompassIfNeed();
9722
- if (northRad !== null) {
9723
- this.compassMesh = yield this.loadCompassMesh();
9724
- this.compassMesh.rotateX(-Math.PI / 2);
9725
- this.compassMesh.rotateZ(northRad - Math.PI / 2);
9726
- this.group.add(this.compassMesh);
9727
- }
9728
- const entrance = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c.entrance) !== null && _d !== void 0 ? _d : null;
9729
- this._clearEntryDoorIfNeed();
9730
- if (entrance !== null) {
9731
- this.entryDoorMesh = yield this.loadEntryDoorMesh();
9732
- this.roomInfoWrapperInstance = this.loadRoomInfo();
9733
- this.roomInfoInstance = getRoomInfoInstance();
9734
- this.entryDoorMesh.rotateX(-Math.PI / 2);
9735
- if (this.roomInfoWrapperInstance) {
9736
- this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
9737
- }
9738
- this.group.add(this.entryDoorMesh);
9650
+ const northRad = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.north_rad) !== null && _b !== void 0 ? _b : null;
9651
+ this._clearCompassIfNeed();
9652
+ if (northRad !== null) {
9653
+ this.compassMesh = await this.loadCompassMesh();
9654
+ this.compassMesh.rotateX(-Math.PI / 2);
9655
+ this.compassMesh.rotateZ(northRad - Math.PI / 2);
9656
+ this.group.add(this.compassMesh);
9657
+ }
9658
+ const entrance = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c.entrance) !== null && _d !== void 0 ? _d : null;
9659
+ this._clearEntryDoorIfNeed();
9660
+ if (entrance !== null) {
9661
+ this.entryDoorMesh = await this.loadEntryDoorMesh();
9662
+ this.roomInfoWrapperInstance = this.loadRoomInfo();
9663
+ this.roomInfoInstance = getRoomInfoInstance();
9664
+ this.entryDoorMesh.rotateX(-Math.PI / 2);
9665
+ if (this.roomInfoWrapperInstance) {
9666
+ this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
9739
9667
  }
9740
- this.onFivePanoArrived(this.five.panoIndex || 0);
9741
- this.five.needsRender = true;
9742
- });
9668
+ this.group.add(this.entryDoorMesh);
9669
+ }
9670
+ this.onFivePanoArrived(this.five.panoIndex || 0);
9671
+ this.five.needsRender = true;
9743
9672
  }
9744
- loadCompassMesh() {
9745
- return __awaiter(this, void 0, void 0, function* () {
9746
- const compassImageUrl = this.state.config.compassImageUrl;
9747
- const compassTexture = yield loadTexture(compassImageUrl);
9748
- const compassGeometry = new THREE__namespace.CircleGeometry(0.7, 32);
9749
- const compassMaterial = new THREE__namespace.MeshBasicMaterial({
9750
- map: compassTexture,
9751
- transparent: true,
9752
- opacity: 0,
9753
- depthTest: false,
9754
- });
9755
- const compassMesh = new THREE__namespace.Mesh(compassGeometry, compassMaterial);
9756
- compassMesh.name = 'pano-compass-mesh';
9757
- return compassMesh;
9673
+ async loadCompassMesh() {
9674
+ const compassImageUrl = this.state.config.compassImageUrl;
9675
+ const compassTexture = await loadTexture(compassImageUrl);
9676
+ const compassGeometry = new THREE__namespace.CircleGeometry(0.7, 32);
9677
+ const compassMaterial = new THREE__namespace.MeshBasicMaterial({
9678
+ map: compassTexture,
9679
+ transparent: true,
9680
+ opacity: 0,
9681
+ depthTest: false,
9758
9682
  });
9683
+ const compassMesh = new THREE__namespace.Mesh(compassGeometry, compassMaterial);
9684
+ compassMesh.name = 'pano-compass-mesh';
9685
+ return compassMesh;
9759
9686
  }
9760
- loadEntryDoorMesh() {
9761
- return __awaiter(this, void 0, void 0, function* () {
9762
- const entryDoorImageUrl = this.state.config.entryDoorImageUrl;
9763
- const entryDoorTexture = yield loadTexture(entryDoorImageUrl);
9764
- const entryDoorGeometry = new THREE__namespace.PlaneGeometry(0.2, 0.16);
9765
- const entryDoorMaterial = new THREE__namespace.MeshBasicMaterial({
9766
- map: entryDoorTexture,
9767
- transparent: true,
9768
- opacity: 0.8,
9769
- depthTest: false,
9770
- });
9771
- const entryDoorMesh = new THREE__namespace.Mesh(entryDoorGeometry, entryDoorMaterial);
9772
- entryDoorMesh.name = 'pano-compass-entry-door';
9773
- return entryDoorMesh;
9687
+ async loadEntryDoorMesh() {
9688
+ const entryDoorImageUrl = this.state.config.entryDoorImageUrl;
9689
+ const entryDoorTexture = await loadTexture(entryDoorImageUrl);
9690
+ const entryDoorGeometry = new THREE__namespace.PlaneGeometry(0.2, 0.16);
9691
+ const entryDoorMaterial = new THREE__namespace.MeshBasicMaterial({
9692
+ map: entryDoorTexture,
9693
+ transparent: true,
9694
+ opacity: 0.8,
9695
+ depthTest: false,
9774
9696
  });
9697
+ const entryDoorMesh = new THREE__namespace.Mesh(entryDoorGeometry, entryDoorMaterial);
9698
+ entryDoorMesh.name = 'pano-compass-entry-door';
9699
+ return entryDoorMesh;
9775
9700
  }
9776
9701
  loadRoomInfo() {
9777
9702
  const points = [
@@ -15681,7 +15606,7 @@ const ModelTVVideoPlugin = (five, { videoElement }) => {
15681
15606
  xhr.send();
15682
15607
  });
15683
15608
  };
15684
- const load = (data, videoElement) => __awaiter(void 0, void 0, void 0, function* () {
15609
+ const load = async (data, videoElement) => {
15685
15610
  const { video_src, video_poster_src, points } = data;
15686
15611
  state.videoSource = video_src;
15687
15612
  // TODO 存疑,先处理多一次遍历 o(2n)
@@ -15691,11 +15616,11 @@ const ModelTVVideoPlugin = (five, { videoElement }) => {
15691
15616
  if (videoElement) {
15692
15617
  state.videoElement = videoElement;
15693
15618
  }
15694
- state.videoTexture = yield getVideoTexture(state.videoSource, state.videoElement);
15619
+ state.videoTexture = await getVideoTexture(state.videoSource, state.videoElement);
15695
15620
  state.enabled = !!data.enable;
15696
15621
  if (state.enabled)
15697
15622
  enable();
15698
- });
15623
+ };
15699
15624
  const dispose = () => {
15700
15625
  disable();
15701
15626
  state.videoTexture = undefined;