@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.es.js CHANGED
@@ -995,31 +995,6 @@ var FLOOR_PLAN_ATTACHED_TO;
995
995
  FLOOR_PLAN_ATTACHED_TO[FLOOR_PLAN_ATTACHED_TO["BOUNDING_CENTER"] = 3] = "BOUNDING_CENTER";
996
996
  })(FLOOR_PLAN_ATTACHED_TO || (FLOOR_PLAN_ATTACHED_TO = {}));
997
997
 
998
- /******************************************************************************
999
- Copyright (c) Microsoft Corporation.
1000
-
1001
- Permission to use, copy, modify, and/or distribute this software for any
1002
- purpose with or without fee is hereby granted.
1003
-
1004
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1005
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1006
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1007
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1008
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1009
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1010
- PERFORMANCE OF THIS SOFTWARE.
1011
- ***************************************************************************** */
1012
-
1013
- function __awaiter(thisArg, _arguments, P, generator) {
1014
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1015
- return new (P || (P = Promise))(function (resolve, reject) {
1016
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1017
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1018
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1019
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1020
- });
1021
- }
1022
-
1023
998
  /**
1024
999
  * 检查一个值是否是狭义上的对象
1025
1000
  * @param {any} value 要检查的值
@@ -4523,26 +4498,22 @@ class Main$1 extends SvelteComponent {
4523
4498
 
4524
4499
  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';
4525
4500
 
4526
- function formatOutlines(outlines) {
4527
- return __awaiter(this, void 0, void 0, function* () {
4528
- const headers = new Headers({ 'Content-Type': 'text/plain' });
4529
- const getOutlineItem = function (item) {
4530
- return __awaiter(this, void 0, void 0, function* () {
4531
- const outlineItem = {
4532
- index: item.index,
4533
- url: item.url,
4534
- svgUrl: item.svg_url,
4535
- };
4536
- if (item.svg_url) {
4537
- const svgContent = yield fetch(item.svg_url, { headers }).then((res) => res.text());
4538
- outlineItem.svgContent = svgContent;
4539
- }
4540
- return outlineItem;
4541
- });
4501
+ async function formatOutlines(outlines) {
4502
+ const headers = new Headers({ 'Content-Type': 'text/plain' });
4503
+ const getOutlineItem = async function (item) {
4504
+ const outlineItem = {
4505
+ index: item.index,
4506
+ url: item.url,
4507
+ svgUrl: item.svg_url,
4542
4508
  };
4543
- const svgOutlineItems = yield Promise.all(outlines.map(getOutlineItem));
4544
- return svgOutlineItems;
4545
- });
4509
+ if (item.svg_url) {
4510
+ const svgContent = await fetch(item.svg_url, { headers }).then((res) => res.text());
4511
+ outlineItem.svgContent = svgContent;
4512
+ }
4513
+ return outlineItem;
4514
+ };
4515
+ const svgOutlineItems = await Promise.all(outlines.map(getOutlineItem));
4516
+ return svgOutlineItems;
4546
4517
  }
4547
4518
  function formatRoom(data) {
4548
4519
  const floorplanRoomItem = {
@@ -4588,21 +4559,19 @@ function formatFloorplanEntrance(data) {
4588
4559
  };
4589
4560
  return floorplanEntrance;
4590
4561
  }
4591
- function formatData(data) {
4592
- return __awaiter(this, void 0, void 0, function* () {
4593
- const outlines = yield formatOutlines(data.outlines);
4594
- const bounding = data.computed_data.bounding;
4595
- const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
4596
- const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
4597
- const floorplanData = {
4598
- outlines,
4599
- entrance,
4600
- bounding,
4601
- floorDatas,
4602
- observers: data.computed_data.observers.map(formateFloorplanObserver),
4603
- };
4604
- return floorplanData;
4605
- });
4562
+ async function formatData(data) {
4563
+ const outlines = await formatOutlines(data.outlines);
4564
+ const bounding = data.computed_data.bounding;
4565
+ const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
4566
+ const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
4567
+ const floorplanData = {
4568
+ outlines,
4569
+ entrance,
4570
+ bounding,
4571
+ floorDatas,
4572
+ observers: data.computed_data.observers.map(formateFloorplanObserver),
4573
+ };
4574
+ return floorplanData;
4606
4575
  }
4607
4576
  function formatExtraObjects(data, five, floorplanData) {
4608
4577
  const extraObjects = data.map((object) => {
@@ -4697,37 +4666,35 @@ function nearlyEqual(num1, num2, accuracy = 4) {
4697
4666
  /** 等待 five changeMode 结束
4698
4667
  * @description Promise 的状态只代表 mode 与预期是否一致,不保证参数的一致性
4699
4668
  */
4700
- function changeMode(five, changeModeParams) {
4701
- return __awaiter(this, void 0, void 0, function* () {
4702
- yield new Promise((resolve, reject) => {
4703
- // 虽然 changeMode 是异步函数,但不代表异步流程结束代表切换 Mode 动画结束
4704
- five.changeMode(...changeModeParams).catch((error) => reject(error));
4705
- five.once('initAnimationEnded', () => {
4706
- const fiveCurrentState = five.getCurrentState();
4707
- const correctMode = changeModeParams[0];
4708
- if (fiveCurrentState.mode !== correctMode)
4709
- reject(new Error('mode 与预期不符'));
4710
- /** 检测当前的 current pose 和传入的 pose 是否一致 */
4711
- const checkPose = () => {
4712
- const correctPose = changeModeParams[1];
4713
- if (!correctPose)
4669
+ async function changeMode(five, changeModeParams) {
4670
+ await new Promise((resolve, reject) => {
4671
+ // 虽然 changeMode 是异步函数,但不代表异步流程结束代表切换 Mode 动画结束
4672
+ five.changeMode(...changeModeParams).catch((error) => reject(error));
4673
+ five.once('initAnimationEnded', () => {
4674
+ const fiveCurrentState = five.getCurrentState();
4675
+ const correctMode = changeModeParams[0];
4676
+ if (fiveCurrentState.mode !== correctMode)
4677
+ reject(new Error('mode 与预期不符'));
4678
+ /** 检测当前的 current pose 和传入的 pose 是否一致 */
4679
+ const checkPose = () => {
4680
+ const correctPose = changeModeParams[1];
4681
+ if (!correctPose)
4682
+ return true;
4683
+ return Object.keys(correctPose).every((key) => {
4684
+ const fivePoseItem = fiveCurrentState[key];
4685
+ if (fivePoseItem === undefined)
4714
4686
  return true;
4715
- return Object.keys(correctPose).every((key) => {
4716
- const fivePoseItem = fiveCurrentState[key];
4717
- if (fivePoseItem === undefined)
4718
- return true;
4719
- const correctPoseItem = correctPose[key];
4720
- if (typeof fivePoseItem === 'number' && typeof correctPoseItem === 'number') {
4721
- return nearlyEqual(fivePoseItem, correctPoseItem, 2);
4722
- }
4723
- return fivePoseItem === correctPoseItem;
4724
- });
4725
- };
4726
- const checkPoseResult = checkPose();
4727
- if (!checkPoseResult)
4728
- reject(new Error('five pose 与预期不符'));
4729
- resolve();
4730
- });
4687
+ const correctPoseItem = correctPose[key];
4688
+ if (typeof fivePoseItem === 'number' && typeof correctPoseItem === 'number') {
4689
+ return nearlyEqual(fivePoseItem, correctPoseItem, 2);
4690
+ }
4691
+ return fivePoseItem === correctPoseItem;
4692
+ });
4693
+ };
4694
+ const checkPoseResult = checkPose();
4695
+ if (!checkPoseResult)
4696
+ reject(new Error('five pose 与预期不符'));
4697
+ resolve();
4731
4698
  });
4732
4699
  });
4733
4700
  }
@@ -5074,24 +5041,22 @@ class Controller$3 extends Controller$4 {
5074
5041
  five.once('dispose', this.dispose);
5075
5042
  this.addEventListener();
5076
5043
  }
5077
- load(serverData, state, userAction = true) {
5078
- return __awaiter(this, void 0, void 0, function* () {
5079
- function isPluginServerData(serverData) {
5080
- return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
5081
- }
5082
- const _data = serverData;
5083
- if (_data && !_data.version)
5084
- console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
5085
- const copyData = JSON.parse(JSON.stringify(serverData));
5086
- const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
5087
- const prevData = this.data;
5088
- this.data = yield formatData(_serverData);
5089
- this.hooks.emit('dataLoaded', this.data);
5090
- this.hooks.emit('dataChange', this.data, prevData);
5091
- if (state)
5092
- this.updateState(state, userAction);
5093
- this.render();
5094
- });
5044
+ async load(serverData, state, userAction = true) {
5045
+ function isPluginServerData(serverData) {
5046
+ return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
5047
+ }
5048
+ const _data = serverData;
5049
+ if (_data && !_data.version)
5050
+ console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
5051
+ const copyData = JSON.parse(JSON.stringify(serverData));
5052
+ const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
5053
+ const prevData = this.data;
5054
+ this.data = await formatData(_serverData);
5055
+ this.hooks.emit('dataLoaded', this.data);
5056
+ this.hooks.emit('dataChange', this.data, prevData);
5057
+ if (state)
5058
+ this.updateState(state, userAction);
5059
+ this.render();
5095
5060
  }
5096
5061
  /** 更新户型图位置 */
5097
5062
  updatePosition() {
@@ -5116,25 +5081,21 @@ class Controller$3 extends Controller$4 {
5116
5081
  this.render();
5117
5082
  return this;
5118
5083
  }
5119
- show(options = {}) {
5120
- return __awaiter(this, void 0, void 0, function* () {
5121
- // 已经展示完成了,不做任何操作
5122
- if (this.state.visible)
5123
- return;
5124
- const userAction = options.userAction !== undefined ? options.userAction : true;
5125
- this.updateState({ visible: true }, userAction);
5126
- this._show({ userAction });
5127
- });
5084
+ async show(options = {}) {
5085
+ // 已经展示完成了,不做任何操作
5086
+ if (this.state.visible)
5087
+ return;
5088
+ const userAction = options.userAction !== undefined ? options.userAction : true;
5089
+ this.updateState({ visible: true }, userAction);
5090
+ this._show({ userAction });
5128
5091
  }
5129
- hide(options = {}) {
5130
- return __awaiter(this, void 0, void 0, function* () {
5131
- this.isHiddenByHideFunc = true;
5132
- if (!this.state.visible)
5133
- return;
5134
- const userAction = options.userAction !== undefined ? options.userAction : true;
5135
- this.updateState({ visible: false }, userAction);
5136
- this._hide({ userAction });
5137
- });
5092
+ async hide(options = {}) {
5093
+ this.isHiddenByHideFunc = true;
5094
+ if (!this.state.visible)
5095
+ return;
5096
+ const userAction = options.userAction !== undefined ? options.userAction : true;
5097
+ this.updateState({ visible: false }, userAction);
5098
+ this._hide({ userAction });
5138
5099
  }
5139
5100
  enable(options = {}) {
5140
5101
  if (this.state.enabled)
@@ -5164,42 +5125,36 @@ class Controller$3 extends Controller$4 {
5164
5125
  state.visible ? this._show(options) : this._hide(options);
5165
5126
  }
5166
5127
  }
5167
- formatData(serverData) {
5168
- return __awaiter(this, void 0, void 0, function* () {
5169
- return yield formatData(serverData.data);
5170
- });
5128
+ async formatData(serverData) {
5129
+ return await formatData(serverData.data);
5171
5130
  }
5172
- _show(options) {
5173
- return __awaiter(this, void 0, void 0, function* () {
5174
- if (!this.state.enabled)
5175
- return;
5176
- this.isHiddenByHideFunc = false;
5177
- const { userAction } = options;
5178
- this.hooks.emit('show', { userAction });
5179
- if (this.five.getCurrentState().mode !== 'Topview') {
5180
- yield changeMode(this.five, ['Topview', undefined, undefined, userAction]);
5181
- }
5182
- this.five.model.show(this.floorIndex);
5183
- this.updatePosition();
5184
- this.updateSize();
5185
- const renderDuration = 500;
5186
- const modelOpacity = this.state.config.modelOpacity;
5187
- changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5188
- this.hooks.emit('showAnimationEnded', { userAction });
5189
- this.render();
5190
- });
5131
+ async _show(options) {
5132
+ if (!this.state.enabled)
5133
+ return;
5134
+ this.isHiddenByHideFunc = false;
5135
+ const { userAction } = options;
5136
+ this.hooks.emit('show', { userAction });
5137
+ if (this.five.getCurrentState().mode !== 'Topview') {
5138
+ await changeMode(this.five, ['Topview', undefined, undefined, userAction]);
5139
+ }
5140
+ this.five.model.show(this.floorIndex);
5141
+ this.updatePosition();
5142
+ this.updateSize();
5143
+ const renderDuration = 500;
5144
+ const modelOpacity = this.state.config.modelOpacity;
5145
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5146
+ this.hooks.emit('showAnimationEnded', { userAction });
5147
+ this.render();
5191
5148
  }
5192
- _hide(options) {
5193
- return __awaiter(this, void 0, void 0, function* () {
5194
- if (!this.state.enabled)
5195
- return;
5196
- const { userAction } = options;
5197
- this.hooks.emit('hide', { userAction });
5198
- const modelOpacity = 1;
5199
- const renderDuration = 0;
5200
- changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5201
- this.render();
5202
- });
5149
+ async _hide(options) {
5150
+ if (!this.state.enabled)
5151
+ return;
5152
+ const { userAction } = options;
5153
+ this.hooks.emit('hide', { userAction });
5154
+ const modelOpacity = 1;
5155
+ const renderDuration = 0;
5156
+ changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
5157
+ this.render();
5203
5158
  }
5204
5159
  _enable(options) {
5205
5160
  const { userAction } = options;
@@ -6252,55 +6207,49 @@ class Controller$2 extends Controller$4 {
6252
6207
  // =============== init Listener ===============
6253
6208
  five.once('dispose', this.dispose);
6254
6209
  }
6255
- load(serverData, state, userAction = true) {
6256
- return __awaiter(this, void 0, void 0, function* () {
6257
- // const loadImage = async () => {
6258
- // const floorIndex = this.five.work.observers[this.five.getCurrentState().panoIndex].floorIndex
6259
- // // 当有 svgString 时,没有加载过程
6260
- // if (floorplanData.outlines[floorIndex]?.svgContent) return
6261
- // // 如果当前楼层图片不存在,不存在加载过程
6262
- // const nowFloorImageSrc = floorplanData.outlines[floorIndex]?.url
6263
- // if (!nowFloorImageSrc) return
6264
- // // 图片加载完成时再 render
6265
- // await new Promise<void>((resolve) => {
6266
- // const nowFloorImage = new Image()
6267
- // nowFloorImage.src = nowFloorImageSrc
6268
- // nowFloorImage.onload = () => resolve()
6269
- // })
6270
- // }
6271
- // await loadImage()
6272
- function isPluginServerData(serverData) {
6273
- return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
6274
- }
6275
- const copyData = JSON.parse(JSON.stringify(serverData));
6276
- const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
6277
- const prevData = this.data;
6278
- this.data = yield formatData(_serverData);
6279
- this.hooks.emit('dataLoaded', this.data);
6280
- this.hooks.emit('dataChange', this.data, prevData);
6281
- if (state)
6282
- this.updateState(state, userAction);
6283
- this.render();
6284
- });
6210
+ async load(serverData, state, userAction = true) {
6211
+ // const loadImage = async () => {
6212
+ // const floorIndex = this.five.work.observers[this.five.getCurrentState().panoIndex].floorIndex
6213
+ // // 当有 svgString 时,没有加载过程
6214
+ // if (floorplanData.outlines[floorIndex]?.svgContent) return
6215
+ // // 如果当前楼层图片不存在,不存在加载过程
6216
+ // const nowFloorImageSrc = floorplanData.outlines[floorIndex]?.url
6217
+ // if (!nowFloorImageSrc) return
6218
+ // // 图片加载完成时再 render
6219
+ // await new Promise<void>((resolve) => {
6220
+ // const nowFloorImage = new Image()
6221
+ // nowFloorImage.src = nowFloorImageSrc
6222
+ // nowFloorImage.onload = () => resolve()
6223
+ // })
6224
+ // }
6225
+ // await loadImage()
6226
+ function isPluginServerData(serverData) {
6227
+ return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
6228
+ }
6229
+ const copyData = JSON.parse(JSON.stringify(serverData));
6230
+ const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
6231
+ const prevData = this.data;
6232
+ this.data = await formatData(_serverData);
6233
+ this.hooks.emit('dataLoaded', this.data);
6234
+ this.hooks.emit('dataChange', this.data, prevData);
6235
+ if (state)
6236
+ this.updateState(state, userAction);
6237
+ this.render();
6285
6238
  }
6286
- show(options = {}) {
6287
- return __awaiter(this, void 0, void 0, function* () {
6288
- // 已经展示完成了,不做任何操作
6289
- if (this.state.visible)
6290
- return;
6291
- const userAction = options.userAction !== undefined ? options.userAction : true;
6292
- this.updateState({ visible: true }, userAction);
6293
- this._show({ userAction });
6294
- });
6239
+ async show(options = {}) {
6240
+ // 已经展示完成了,不做任何操作
6241
+ if (this.state.visible)
6242
+ return;
6243
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6244
+ this.updateState({ visible: true }, userAction);
6245
+ this._show({ userAction });
6295
6246
  }
6296
- hide(options = {}) {
6297
- return __awaiter(this, void 0, void 0, function* () {
6298
- if (!this.state.visible)
6299
- return;
6300
- const userAction = options.userAction !== undefined ? options.userAction : true;
6301
- this.updateState({ visible: false }, userAction);
6302
- this._hide({ userAction });
6303
- });
6247
+ async hide(options = {}) {
6248
+ if (!this.state.visible)
6249
+ return;
6250
+ const userAction = options.userAction !== undefined ? options.userAction : true;
6251
+ this.updateState({ visible: false }, userAction);
6252
+ this._hide({ userAction });
6304
6253
  }
6305
6254
  enable(options = {}) {
6306
6255
  if (this.state.enabled)
@@ -6345,10 +6294,8 @@ class Controller$2 extends Controller$4 {
6345
6294
  this.extraObjects = formatExtraObjects(data, this.five, this.data);
6346
6295
  this.render();
6347
6296
  }
6348
- formatData(serverData) {
6349
- return __awaiter(this, void 0, void 0, function* () {
6350
- return yield formatData(serverData.data);
6351
- });
6297
+ async formatData(serverData) {
6298
+ return await formatData(serverData.data);
6352
6299
  }
6353
6300
  _enable(options) {
6354
6301
  const { userAction } = options;
@@ -6408,18 +6355,16 @@ const PanoFloorplanRadarPlugin = (five, params) => {
6408
6355
  * 有异常,则返回 [Error, undefined]
6409
6356
  * 用于替代 try&catch 处理 await 异常的方案
6410
6357
  */
6411
- function to(promise) {
6412
- return __awaiter(this, void 0, void 0, function* () {
6413
- try {
6414
- const data = yield promise;
6415
- return [null, data];
6416
- }
6417
- catch (error) {
6418
- if (error instanceof Error)
6419
- return [error, null];
6420
- return [new Error(''), null];
6421
- }
6422
- });
6358
+ async function to(promise) {
6359
+ try {
6360
+ const data = await promise;
6361
+ return [null, data];
6362
+ }
6363
+ catch (error) {
6364
+ if (error instanceof Error)
6365
+ return [error, null];
6366
+ return [new Error(''), null];
6367
+ }
6423
6368
  }
6424
6369
 
6425
6370
  var FloorplanErrorType;
@@ -6464,29 +6409,27 @@ function checkShowState(five, showState) {
6464
6409
  * 2. 内置了相应的动画时间计算
6465
6410
  * 3. 纠正成功会返回 true,失败「可能会被用户行为中断」会返回 false
6466
6411
  */
6467
- function correctFiveState(five, showState, userAction = true) {
6468
- return __awaiter(this, void 0, void 0, function* () {
6469
- // 当前已满足状态,不需要变更
6470
- const result = checkShowState(five, showState);
6471
- if (result === true)
6472
- return;
6473
- const currentFiveState = five.getCurrentState();
6474
- // 纠正 mode
6475
- if (currentFiveState.mode !== showState.mode) {
6476
- const [changeModeError] = yield to(changeMode(five, [showState.mode, showState, undefined, userAction]));
6477
- if (changeModeError)
6478
- throw new Error(FloorplanErrorType.ChangeModeError);
6479
- return;
6480
- }
6481
- // 纠正相机状态
6482
- // 根据 latitude、longitude、fov 计算动画时间,最多 1s
6483
- const { latitude, longitude, fov } = currentFiveState;
6484
- 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));
6485
- const [updateCameraError] = yield to(five.updateCamera(showState, time, userAction));
6486
- if (updateCameraError)
6487
- throw new Error(FloorplanErrorType.UpdateCameraError);
6412
+ async function correctFiveState(five, showState, userAction = true) {
6413
+ // 当前已满足状态,不需要变更
6414
+ const result = checkShowState(five, showState);
6415
+ if (result === true)
6488
6416
  return;
6489
- });
6417
+ const currentFiveState = five.getCurrentState();
6418
+ // 纠正 mode
6419
+ if (currentFiveState.mode !== showState.mode) {
6420
+ const [changeModeError] = await to(changeMode(five, [showState.mode, showState, undefined, userAction]));
6421
+ if (changeModeError)
6422
+ throw new Error(FloorplanErrorType.ChangeModeError);
6423
+ return;
6424
+ }
6425
+ // 纠正相机状态
6426
+ // 根据 latitude、longitude、fov 计算动画时间,最多 1s
6427
+ const { latitude, longitude, fov } = currentFiveState;
6428
+ 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));
6429
+ const [updateCameraError] = await to(five.updateCamera(showState, time, userAction));
6430
+ if (updateCameraError)
6431
+ throw new Error(FloorplanErrorType.UpdateCameraError);
6432
+ return;
6490
6433
  }
6491
6434
 
6492
6435
  /** 当前 five 的相机视角是否满足户型图自动隐藏条件
@@ -6655,7 +6598,7 @@ class Controller$1 extends Controller$4 {
6655
6598
  enumerable: true,
6656
6599
  configurable: true,
6657
6600
  writable: true,
6658
- value: (options = {}) => __awaiter(this, void 0, void 0, function* () {
6601
+ value: async (options = {}) => {
6659
6602
  if (!this.state.enabled)
6660
6603
  return;
6661
6604
  // 已经展示完成了,不做任何操作
@@ -6664,14 +6607,14 @@ class Controller$1 extends Controller$4 {
6664
6607
  const userAction = options.userAction !== undefined ? options.userAction : true;
6665
6608
  this.updateState({ visible: true }, userAction);
6666
6609
  this._show(options);
6667
- })
6610
+ }
6668
6611
  });
6669
6612
  /** 隐藏户型图 */
6670
6613
  Object.defineProperty(this, "hide", {
6671
6614
  enumerable: true,
6672
6615
  configurable: true,
6673
6616
  writable: true,
6674
- value: (options = {}) => __awaiter(this, void 0, void 0, function* () {
6617
+ value: async (options = {}) => {
6675
6618
  if (!this.state.enabled)
6676
6619
  return;
6677
6620
  this.isHiddenByHideFunc = true;
@@ -6679,7 +6622,7 @@ class Controller$1 extends Controller$4 {
6679
6622
  return;
6680
6623
  this.updateState({ visible: false }, options.userAction || true);
6681
6624
  this._hide(options);
6682
- })
6625
+ }
6683
6626
  });
6684
6627
  /** 更新户型图大小 */
6685
6628
  Object.defineProperty(this, "updateSize", {
@@ -6745,11 +6688,11 @@ class Controller$1 extends Controller$4 {
6745
6688
  enumerable: true,
6746
6689
  configurable: true,
6747
6690
  writable: true,
6748
- value: (options) => __awaiter(this, void 0, void 0, function* () {
6749
- var _b;
6691
+ value: async (options) => {
6692
+ var _a;
6750
6693
  if (!this.state.enabled)
6751
6694
  return;
6752
- if (!((_b = this.five.model) === null || _b === void 0 ? void 0 : _b.loaded))
6695
+ if (!((_a = this.five.model) === null || _a === void 0 ? void 0 : _a.loaded))
6753
6696
  throw new Error(FloorplanErrorType.ModelNotLoaded);
6754
6697
  if (!this.data)
6755
6698
  throw new Error(FloorplanErrorType.DataNotLoaded);
@@ -6763,7 +6706,7 @@ class Controller$1 extends Controller$4 {
6763
6706
  userAction: true,
6764
6707
  };
6765
6708
  const mergedOptions = Object.assign(Object.assign({}, baseShowOpts), options);
6766
- const getShowPromise = () => __awaiter(this, void 0, void 0, function* () {
6709
+ const getShowPromise = async () => {
6767
6710
  this.hooks.emit('show', { userAction: mergedOptions.userAction, auto: mergedOptions.isAutoShow });
6768
6711
  let hasRejected = false;
6769
6712
  let externalErrorMsg;
@@ -6771,7 +6714,7 @@ class Controller$1 extends Controller$4 {
6771
6714
  hasRejected = true;
6772
6715
  externalErrorMsg = errorMsg;
6773
6716
  };
6774
- const [correctError] = yield to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
6717
+ const [correctError] = await to(correctFiveState(this.five, this.showState, mergedOptions.userAction));
6775
6718
  if (correctError)
6776
6719
  throw correctError;
6777
6720
  // 异步结束要判断当前是不是被中断了
@@ -6789,7 +6732,7 @@ class Controller$1 extends Controller$4 {
6789
6732
  const renderDuration = mergedOptions.immediately ? 0 : SHOW_ANIME_DURATION;
6790
6733
  changeModelCanvasOpacity(this.five, modelOpacity, renderDuration);
6791
6734
  this.render(renderDuration);
6792
- });
6735
+ };
6793
6736
  this.showPromise = getShowPromise()
6794
6737
  .then(() => {
6795
6738
  this.hooks.emit('showAnimationEnded', {
@@ -6811,7 +6754,7 @@ class Controller$1 extends Controller$4 {
6811
6754
  this.showRejection = undefined;
6812
6755
  });
6813
6756
  return this.showPromise;
6814
- })
6757
+ }
6815
6758
  });
6816
6759
  Object.defineProperty(this, "_hide", {
6817
6760
  enumerable: true,
@@ -7045,24 +6988,22 @@ class Controller$1 extends Controller$4 {
7045
6988
  five.once('dispose', this.dispose);
7046
6989
  this.addEventListener();
7047
6990
  }
7048
- load(serverData, state, userAction = true) {
7049
- return __awaiter(this, void 0, void 0, function* () {
7050
- function isPluginServerData(serverData) {
7051
- return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
7052
- }
7053
- const _data = serverData;
7054
- if (_data && !_data.version)
7055
- console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
7056
- const copyData = JSON.parse(JSON.stringify(serverData));
7057
- const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
7058
- const prevData = this.data;
7059
- this.data = yield formatData(_serverData);
7060
- this.hooks.emit('dataLoaded', this.data);
7061
- this.hooks.emit('dataChange', this.data, prevData);
7062
- if (state)
7063
- this.updateState(state, userAction);
7064
- this.render();
7065
- });
6991
+ async load(serverData, state, userAction = true) {
6992
+ function isPluginServerData(serverData) {
6993
+ return Object.prototype.hasOwnProperty.apply(serverData, ['version']);
6994
+ }
6995
+ const _data = serverData;
6996
+ if (_data && !_data.version)
6997
+ console.warn('传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数');
6998
+ const copyData = JSON.parse(JSON.stringify(serverData));
6999
+ const _serverData = isPluginServerData(copyData) ? copyData.data : copyData;
7000
+ const prevData = this.data;
7001
+ this.data = await formatData(_serverData);
7002
+ this.hooks.emit('dataLoaded', this.data);
7003
+ this.hooks.emit('dataChange', this.data, prevData);
7004
+ if (state)
7005
+ this.updateState(state, userAction);
7006
+ this.render();
7066
7007
  }
7067
7008
  /** 把插件的渲染DOM插入到对应的容器中去 */
7068
7009
  appendTo(wrapper) {
@@ -7110,10 +7051,8 @@ class Controller$1 extends Controller$4 {
7110
7051
  return;
7111
7052
  this.render();
7112
7053
  }
7113
- formatData(serverData) {
7114
- return __awaiter(this, void 0, void 0, function* () {
7115
- return yield formatData(serverData.data);
7116
- });
7054
+ async formatData(serverData) {
7055
+ return await formatData(serverData.data);
7117
7056
  }
7118
7057
  updateState(state, userAction) {
7119
7058
  const prevState = this.state;
@@ -7341,10 +7280,10 @@ const ModelChassisCompassPlugin = (five, params) => {
7341
7280
  const defaultNorthRad = (_a = params.north_rad) !== null && _a !== void 0 ? _a : undefined;
7342
7281
  // 局部状态
7343
7282
  const state = {};
7344
- const load = (data) => __awaiter(void 0, void 0, void 0, function* () {
7345
- var _b;
7283
+ const load = async (data) => {
7284
+ var _a;
7346
7285
  const fbxUrl = (data === null || data === void 0 ? void 0 : data.fbx_url) || defaultFbxUrl;
7347
- const northRad = (_b = data === null || data === void 0 ? void 0 : data.north_rad) !== null && _b !== void 0 ? _b : defaultNorthRad;
7286
+ const northRad = (_a = data === null || data === void 0 ? void 0 : data.north_rad) !== null && _a !== void 0 ? _a : defaultNorthRad;
7348
7287
  if (typeof northRad !== 'number') {
7349
7288
  throw new Error('"northRad"配置参数缺失:未配置指南针指向!');
7350
7289
  }
@@ -7353,7 +7292,7 @@ const ModelChassisCompassPlugin = (five, params) => {
7353
7292
  const zOffset = bounding.max.z - bounding.min.z;
7354
7293
  const maxOffset = Math.max(xOffset, zOffset);
7355
7294
  const fbxLoader = new FBXLoader();
7356
- const object = yield fbxLoader.loadAsync(fbxUrl);
7295
+ const object = await fbxLoader.loadAsync(fbxUrl);
7357
7296
  transfromToMeshBasicMaterial(object, {
7358
7297
  transparent: true,
7359
7298
  side: THREE.DoubleSide,
@@ -7367,7 +7306,7 @@ const ModelChassisCompassPlugin = (five, params) => {
7367
7306
  bject3d2LocalMatrix(object, { position, rotation, scale });
7368
7307
  state.object = object;
7369
7308
  return true;
7370
- });
7309
+ };
7371
7310
  const onCameraUpdate = ({ latitude }) => {
7372
7311
  if (!state.object)
7373
7312
  return;
@@ -7437,25 +7376,25 @@ const ModelEntryDoorGuidePlugin = (five, params) => {
7437
7376
  const defaultRad = (_c = params.rad) !== null && _c !== void 0 ? _c : undefined;
7438
7377
  const defaultFbxUrl = params.fbx_url || '//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx';
7439
7378
  const mixers = [];
7440
- const load = (data) => __awaiter(void 0, void 0, void 0, function* () {
7441
- var _d, _e, _f, _g, _h, _j, _k;
7442
- const position = (_d = data === null || data === void 0 ? void 0 : data.position) !== null && _d !== void 0 ? _d : defaultModelPosition;
7379
+ const load = async (data) => {
7380
+ var _a, _b, _c, _d, _e, _f, _g;
7381
+ const position = (_a = data === null || data === void 0 ? void 0 : data.position) !== null && _a !== void 0 ? _a : defaultModelPosition;
7443
7382
  if (!position)
7444
7383
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): position is undefined`);
7445
7384
  const modelPosition = transformPositionToVector3(position);
7446
- const rad = (_e = data === null || data === void 0 ? void 0 : data.rad) !== null && _e !== void 0 ? _e : defaultRad;
7447
- const fbxUrl = (_f = data === null || data === void 0 ? void 0 : data.fbx_url) !== null && _f !== void 0 ? _f : defaultFbxUrl;
7385
+ const rad = (_b = data === null || data === void 0 ? void 0 : data.rad) !== null && _b !== void 0 ? _b : defaultRad;
7386
+ const fbxUrl = (_c = data === null || data === void 0 ? void 0 : data.fbx_url) !== null && _c !== void 0 ? _c : defaultFbxUrl;
7448
7387
  state.rad = rad;
7449
7388
  if (rad === undefined)
7450
7389
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): rad is ${rad}`);
7451
7390
  // 加载模型
7452
- const object = yield new FBXLoader().loadAsync(fbxUrl);
7391
+ const object = await new FBXLoader().loadAsync(fbxUrl);
7453
7392
  // 设置位置
7454
7393
  object.position.copy(modelPosition);
7455
7394
  object.rotation.z = rad;
7456
7395
  object.scale.set(0.8, 0.8, 0.8);
7457
7396
  transfromToMeshBasicMaterial(object, { transparent: true, side: THREE.DoubleSide });
7458
- 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();
7397
+ 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();
7459
7398
  if (!textMesh)
7460
7399
  return Promise.reject(`ModelEntryDoorGuidePlugin.load(): textMesh is ${textMesh}`);
7461
7400
  textMesh.material = new MeshBasicMaterial({ transparent: true, map: createCanvasTextTexture('入户门') });
@@ -7463,7 +7402,7 @@ const ModelEntryDoorGuidePlugin = (five, params) => {
7463
7402
  object.children[0].add(textMesh);
7464
7403
  state.object = object;
7465
7404
  return true;
7466
- });
7405
+ };
7467
7406
  const initAnimation = () => {
7468
7407
  if (state.animation)
7469
7408
  return;
@@ -7700,21 +7639,21 @@ const getLongitudeParams = (from, to, rotation) => {
7700
7639
  */
7701
7640
  const CameraMovementPlugin = (five) => {
7702
7641
  const state = {};
7703
- const move = (args, duration, opts = { preload: true }) => __awaiter(void 0, void 0, void 0, function* () {
7642
+ const move = async (args, duration, opts = { preload: true }) => {
7704
7643
  if (state.interruptCallback) {
7705
7644
  state.interruptCallback(false);
7706
7645
  }
7707
7646
  if (opts.asyncStartCallback) {
7708
- yield opts.asyncStartCallback();
7647
+ await opts.asyncStartCallback();
7709
7648
  }
7710
7649
  if (args.mode && args.mode !== five.currentMode) {
7711
- yield five.changeMode(args.mode);
7650
+ await five.changeMode(args.mode);
7712
7651
  }
7713
7652
  if (opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex) {
7714
- yield five.preloadPano(args.panoIndex);
7653
+ await five.preloadPano(args.panoIndex);
7715
7654
  }
7716
7655
  if (opts.asyncEndCallback) {
7717
- yield opts.asyncEndCallback();
7656
+ await opts.asyncEndCallback();
7718
7657
  }
7719
7658
  if (args.panoIndex === undefined &&
7720
7659
  args.fov === undefined &&
@@ -7722,7 +7661,7 @@ const CameraMovementPlugin = (five) => {
7722
7661
  args.longitude === undefined) {
7723
7662
  return true;
7724
7663
  }
7725
- return yield new Promise((resolve, reject) => {
7664
+ return await new Promise((resolve, reject) => {
7726
7665
  const panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
7727
7666
  if (panoIndex !== undefined) {
7728
7667
  five.moveToPano(panoIndex, Object.assign({
@@ -7735,7 +7674,7 @@ const CameraMovementPlugin = (five) => {
7735
7674
  reject(false);
7736
7675
  }
7737
7676
  });
7738
- });
7677
+ };
7739
7678
  const getAnimeParams = (args) => {
7740
7679
  const currentFiveState = five.state;
7741
7680
  // latitude
@@ -7751,20 +7690,20 @@ const CameraMovementPlugin = (five) => {
7751
7690
  to: { latitude: toLatitude, longitude: toLongitude, fov: toFov },
7752
7691
  };
7753
7692
  };
7754
- const rotate = (args, duration, opts = {}) => __awaiter(void 0, void 0, void 0, function* () {
7693
+ const rotate = async (args, duration, opts = {}) => {
7755
7694
  if (state.interruptCallback) {
7756
7695
  state.interruptCallback(false);
7757
7696
  }
7758
7697
  if (opts.asyncStartCallback) {
7759
- yield opts.asyncStartCallback();
7698
+ await opts.asyncStartCallback();
7760
7699
  }
7761
7700
  if (five.currentMode !== Five.Mode.Panorama) {
7762
- yield five.changeMode(Five.Mode.Panorama);
7701
+ await five.changeMode(Five.Mode.Panorama);
7763
7702
  }
7764
7703
  if (args.panoIndex !== undefined && args.panoIndex !== five.panoIndex) {
7765
7704
  if (opts.preload)
7766
- yield five.preloadPano(args.panoIndex);
7767
- yield new Promise((resolve, reject) => {
7705
+ await five.preloadPano(args.panoIndex);
7706
+ await new Promise((resolve, reject) => {
7768
7707
  if (!args.panoIndex) {
7769
7708
  resolve(true);
7770
7709
  return;
@@ -7776,10 +7715,10 @@ const CameraMovementPlugin = (five) => {
7776
7715
  });
7777
7716
  }
7778
7717
  if (opts.asyncEndCallback) {
7779
- yield opts.asyncEndCallback();
7718
+ await opts.asyncEndCallback();
7780
7719
  }
7781
7720
  const { from, to } = getAnimeParams(args);
7782
- return yield new Promise((resolve) => {
7721
+ return await new Promise((resolve) => {
7783
7722
  const onUpdate = ({ progress }) => {
7784
7723
  const state = {};
7785
7724
  state.longitude = progressNumber(from.longitude, to.longitude, progress);
@@ -7821,7 +7760,7 @@ const CameraMovementPlugin = (five) => {
7821
7760
  state.interruptCallback(true);
7822
7761
  }, duration);
7823
7762
  });
7824
- });
7763
+ };
7825
7764
  return {
7826
7765
  move,
7827
7766
  rotate,
@@ -8181,7 +8120,7 @@ const PanoRulerPlugin = (five, params) => {
8181
8120
  freshRule();
8182
8121
  return true;
8183
8122
  };
8184
- const load = (_roomInfo, _roomRules, options) => __awaiter(void 0, void 0, void 0, function* () {
8123
+ const load = async (_roomInfo, _roomRules, options) => {
8185
8124
  const roomInfo = _roomInfo || params.roomInfo;
8186
8125
  const roomRules = _roomRules || params.roomRules;
8187
8126
  if (!roomInfo || !roomRules) {
@@ -8193,9 +8132,9 @@ const PanoRulerPlugin = (five, params) => {
8193
8132
  return _load(roomInfo, roomRules);
8194
8133
  }
8195
8134
  else {
8196
- return yield new Promise((resolve) => five.once('modelLoaded', () => resolve(_load(roomInfo, roomRules))));
8135
+ return await new Promise((resolve) => five.once('modelLoaded', () => resolve(_load(roomInfo, roomRules))));
8197
8136
  }
8198
- });
8137
+ };
8199
8138
  if (params.roomInfo && params.roomRules) {
8200
8139
  load(params.roomInfo, params.roomRules);
8201
8140
  }
@@ -9105,22 +9044,20 @@ class Controller {
9105
9044
  if ((_a = params.options) === null || _a === void 0 ? void 0 : _a.className)
9106
9045
  this.container.classList.add((_b = params.options) === null || _b === void 0 ? void 0 : _b.className);
9107
9046
  }
9108
- this.five.once('modelLoaded', () => __awaiter(this, void 0, void 0, function* () {
9109
- var _c, _d;
9110
- (_d = (_c = this.five.getElement()) === null || _c === void 0 ? void 0 : _c.parentNode) === null || _d === void 0 ? void 0 : _d.append(this.container);
9111
- }));
9047
+ this.five.once('modelLoaded', async () => {
9048
+ var _a, _b;
9049
+ (_b = (_a = this.five.getElement()) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.append(this.container);
9050
+ });
9112
9051
  this.five.once('dispose', () => this.dispose());
9113
9052
  }
9114
- load(serverData) {
9115
- return __awaiter(this, void 0, void 0, function* () {
9116
- if (!this.five.work)
9117
- return;
9118
- const data = serverData.data;
9119
- if (!data)
9120
- throw new Error('标尺数据依赖不齐全!');
9121
- this.panoRulerProData = data;
9122
- this.state.loaded = true;
9123
- });
9053
+ async load(serverData) {
9054
+ if (!this.five.work)
9055
+ return;
9056
+ const data = serverData.data;
9057
+ if (!data)
9058
+ throw new Error('标尺数据依赖不齐全!');
9059
+ this.panoRulerProData = data;
9060
+ this.state.loaded = true;
9124
9061
  }
9125
9062
  enable() {
9126
9063
  if (!this.state.loaded)
@@ -9138,26 +9075,24 @@ class Controller {
9138
9075
  this.render();
9139
9076
  return true;
9140
9077
  }
9141
- render() {
9078
+ async render() {
9142
9079
  var _a;
9143
- return __awaiter(this, void 0, void 0, function* () {
9144
- if (this.state.enabled) {
9145
- if (!this.panoRulerProData || !this.container)
9146
- return;
9147
- this.rulerItems = new RulerItems({
9148
- target: this.container,
9149
- props: {
9150
- five: this.five,
9151
- rulerDatas: this.panoRulerProData,
9152
- options: this.state.options,
9153
- },
9154
- });
9155
- }
9156
- else {
9157
- (_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
9158
- this.rulerItems = undefined;
9159
- }
9160
- });
9080
+ if (this.state.enabled) {
9081
+ if (!this.panoRulerProData || !this.container)
9082
+ return;
9083
+ this.rulerItems = new RulerItems({
9084
+ target: this.container,
9085
+ props: {
9086
+ five: this.five,
9087
+ rulerDatas: this.panoRulerProData,
9088
+ options: this.state.options,
9089
+ },
9090
+ });
9091
+ }
9092
+ else {
9093
+ (_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
9094
+ this.rulerItems = undefined;
9095
+ }
9161
9096
  }
9162
9097
  dispose() {
9163
9098
  if (this.container) {
@@ -9226,14 +9161,12 @@ function getRoomInfoInstance() {
9226
9161
  }
9227
9162
 
9228
9163
  const textureLoader = new THREE.TextureLoader();
9229
- function loadTexture(url) {
9230
- return __awaiter(this, void 0, void 0, function* () {
9231
- return new Promise((resolve, reject) => {
9232
- textureLoader.load(url, resolve, undefined, reject);
9233
- }).then((texture) => {
9234
- texture.encoding = THREE.sRGBEncoding;
9235
- return texture;
9236
- });
9164
+ async function loadTexture(url) {
9165
+ return new Promise((resolve, reject) => {
9166
+ textureLoader.load(url, resolve, undefined, reject);
9167
+ }).then((texture) => {
9168
+ texture.encoding = THREE.sRGBEncoding;
9169
+ return texture;
9237
9170
  });
9238
9171
  }
9239
9172
 
@@ -9660,19 +9593,17 @@ class PanoCompassController extends Controller$4 {
9660
9593
  this.init();
9661
9594
  }
9662
9595
  }
9663
- load(data, state, userAction = true) {
9664
- return __awaiter(this, void 0, void 0, function* () {
9665
- const nextData = yield this.formatData(data);
9666
- if (JSON.stringify(this.data) !== JSON.stringify(nextData)) {
9667
- this.hooks.emit('dataChange', nextData, this.data);
9668
- this.data = Object.assign({}, nextData);
9669
- this.init();
9670
- if (state) {
9671
- this.setState(state, { userAction });
9672
- }
9673
- this.hooks.emit('dataLoaded', this.data);
9596
+ async load(data, state, userAction = true) {
9597
+ const nextData = await this.formatData(data);
9598
+ if (JSON.stringify(this.data) !== JSON.stringify(nextData)) {
9599
+ this.hooks.emit('dataChange', nextData, this.data);
9600
+ this.data = Object.assign({}, nextData);
9601
+ this.init();
9602
+ if (state) {
9603
+ this.setState(state, { userAction });
9674
9604
  }
9675
- });
9605
+ this.hooks.emit('dataLoaded', this.data);
9606
+ }
9676
9607
  }
9677
9608
  formatData(serverData) {
9678
9609
  if (serverData.version && serverData.data) {
@@ -9686,64 +9617,58 @@ class PanoCompassController extends Controller$4 {
9686
9617
  * 初始化
9687
9618
  * @todo 逻辑需要细分
9688
9619
  */
9689
- init() {
9620
+ async init() {
9690
9621
  var _a, _b, _c, _d;
9691
- return __awaiter(this, void 0, void 0, function* () {
9692
- const northRad = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.north_rad) !== null && _b !== void 0 ? _b : null;
9693
- this._clearCompassIfNeed();
9694
- if (northRad !== null) {
9695
- this.compassMesh = yield this.loadCompassMesh();
9696
- this.compassMesh.rotateX(-Math.PI / 2);
9697
- this.compassMesh.rotateZ(northRad - Math.PI / 2);
9698
- this.group.add(this.compassMesh);
9699
- }
9700
- const entrance = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c.entrance) !== null && _d !== void 0 ? _d : null;
9701
- this._clearEntryDoorIfNeed();
9702
- if (entrance !== null) {
9703
- this.entryDoorMesh = yield this.loadEntryDoorMesh();
9704
- this.roomInfoWrapperInstance = this.loadRoomInfo();
9705
- this.roomInfoInstance = getRoomInfoInstance();
9706
- this.entryDoorMesh.rotateX(-Math.PI / 2);
9707
- if (this.roomInfoWrapperInstance) {
9708
- this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
9709
- }
9710
- this.group.add(this.entryDoorMesh);
9622
+ const northRad = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.north_rad) !== null && _b !== void 0 ? _b : null;
9623
+ this._clearCompassIfNeed();
9624
+ if (northRad !== null) {
9625
+ this.compassMesh = await this.loadCompassMesh();
9626
+ this.compassMesh.rotateX(-Math.PI / 2);
9627
+ this.compassMesh.rotateZ(northRad - Math.PI / 2);
9628
+ this.group.add(this.compassMesh);
9629
+ }
9630
+ const entrance = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c.entrance) !== null && _d !== void 0 ? _d : null;
9631
+ this._clearEntryDoorIfNeed();
9632
+ if (entrance !== null) {
9633
+ this.entryDoorMesh = await this.loadEntryDoorMesh();
9634
+ this.roomInfoWrapperInstance = this.loadRoomInfo();
9635
+ this.roomInfoInstance = getRoomInfoInstance();
9636
+ this.entryDoorMesh.rotateX(-Math.PI / 2);
9637
+ if (this.roomInfoWrapperInstance) {
9638
+ this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
9711
9639
  }
9712
- this.onFivePanoArrived(this.five.panoIndex || 0);
9713
- this.five.needsRender = true;
9714
- });
9640
+ this.group.add(this.entryDoorMesh);
9641
+ }
9642
+ this.onFivePanoArrived(this.five.panoIndex || 0);
9643
+ this.five.needsRender = true;
9715
9644
  }
9716
- loadCompassMesh() {
9717
- return __awaiter(this, void 0, void 0, function* () {
9718
- const compassImageUrl = this.state.config.compassImageUrl;
9719
- const compassTexture = yield loadTexture(compassImageUrl);
9720
- const compassGeometry = new THREE.CircleGeometry(0.7, 32);
9721
- const compassMaterial = new THREE.MeshBasicMaterial({
9722
- map: compassTexture,
9723
- transparent: true,
9724
- opacity: 0,
9725
- depthTest: false,
9726
- });
9727
- const compassMesh = new THREE.Mesh(compassGeometry, compassMaterial);
9728
- compassMesh.name = 'pano-compass-mesh';
9729
- return compassMesh;
9645
+ async loadCompassMesh() {
9646
+ const compassImageUrl = this.state.config.compassImageUrl;
9647
+ const compassTexture = await loadTexture(compassImageUrl);
9648
+ const compassGeometry = new THREE.CircleGeometry(0.7, 32);
9649
+ const compassMaterial = new THREE.MeshBasicMaterial({
9650
+ map: compassTexture,
9651
+ transparent: true,
9652
+ opacity: 0,
9653
+ depthTest: false,
9730
9654
  });
9655
+ const compassMesh = new THREE.Mesh(compassGeometry, compassMaterial);
9656
+ compassMesh.name = 'pano-compass-mesh';
9657
+ return compassMesh;
9731
9658
  }
9732
- loadEntryDoorMesh() {
9733
- return __awaiter(this, void 0, void 0, function* () {
9734
- const entryDoorImageUrl = this.state.config.entryDoorImageUrl;
9735
- const entryDoorTexture = yield loadTexture(entryDoorImageUrl);
9736
- const entryDoorGeometry = new THREE.PlaneGeometry(0.2, 0.16);
9737
- const entryDoorMaterial = new THREE.MeshBasicMaterial({
9738
- map: entryDoorTexture,
9739
- transparent: true,
9740
- opacity: 0.8,
9741
- depthTest: false,
9742
- });
9743
- const entryDoorMesh = new THREE.Mesh(entryDoorGeometry, entryDoorMaterial);
9744
- entryDoorMesh.name = 'pano-compass-entry-door';
9745
- return entryDoorMesh;
9659
+ async loadEntryDoorMesh() {
9660
+ const entryDoorImageUrl = this.state.config.entryDoorImageUrl;
9661
+ const entryDoorTexture = await loadTexture(entryDoorImageUrl);
9662
+ const entryDoorGeometry = new THREE.PlaneGeometry(0.2, 0.16);
9663
+ const entryDoorMaterial = new THREE.MeshBasicMaterial({
9664
+ map: entryDoorTexture,
9665
+ transparent: true,
9666
+ opacity: 0.8,
9667
+ depthTest: false,
9746
9668
  });
9669
+ const entryDoorMesh = new THREE.Mesh(entryDoorGeometry, entryDoorMaterial);
9670
+ entryDoorMesh.name = 'pano-compass-entry-door';
9671
+ return entryDoorMesh;
9747
9672
  }
9748
9673
  loadRoomInfo() {
9749
9674
  const points = [
@@ -15653,7 +15578,7 @@ const ModelTVVideoPlugin = (five, { videoElement }) => {
15653
15578
  xhr.send();
15654
15579
  });
15655
15580
  };
15656
- const load = (data, videoElement) => __awaiter(void 0, void 0, void 0, function* () {
15581
+ const load = async (data, videoElement) => {
15657
15582
  const { video_src, video_poster_src, points } = data;
15658
15583
  state.videoSource = video_src;
15659
15584
  // TODO 存疑,先处理多一次遍历 o(2n)
@@ -15663,11 +15588,11 @@ const ModelTVVideoPlugin = (five, { videoElement }) => {
15663
15588
  if (videoElement) {
15664
15589
  state.videoElement = videoElement;
15665
15590
  }
15666
- state.videoTexture = yield getVideoTexture(state.videoSource, state.videoElement);
15591
+ state.videoTexture = await getVideoTexture(state.videoSource, state.videoElement);
15667
15592
  state.enabled = !!data.enable;
15668
15593
  if (state.enabled)
15669
15594
  enable();
15670
- });
15595
+ };
15671
15596
  const dispose = () => {
15672
15597
  disable();
15673
15598
  state.videoTexture = undefined;