@realsee/dnalogel 2.0.0-alpha.12 → 2.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/CSS3DRenderPlugin/index.js +17 -14
  2. package/dist/CameraMovementPlugin/index.js +40 -15
  3. package/dist/ModelChassisCompassPlugin/index.js +32 -6
  4. package/dist/ModelEntryDoorGuidePlugin/index.js +48 -18
  5. package/dist/ModelItemLabelPlugin/index.js +18 -17
  6. package/dist/ModelRoomLabelPlugin/index.js +67 -26
  7. package/dist/PanoCompassPlugin/index.js +311 -164
  8. package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
  9. package/dist/PanoMeasurePlugin/index.js +1337 -583
  10. package/dist/PanoRulerPlugin/index.js +32 -5
  11. package/dist/PanoSpatialTagPlugin/index.js +64 -29
  12. package/dist/floorplan/ModelFloorplanPlugin/index.js +586 -362
  13. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
  14. package/dist/floorplan/TopviewFloorplanPlugin/index.js +311 -153
  15. package/dist/index.es.js +2663 -1341
  16. package/dist/index.js +2667 -1345
  17. package/dist/index.umd.js +2667 -1345
  18. package/docs/assets/main.js +1 -1
  19. package/docs/classes/ModelRoomLabelController.html +6 -6
  20. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  21. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  22. package/docs/interfaces/LineJson.html +1 -1
  23. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  24. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  25. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  26. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  27. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  28. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  29. package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
  30. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  31. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  32. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  33. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  34. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  35. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  36. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  37. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  38. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  39. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  40. package/docs/interfaces/PointJson.html +1 -1
  41. package/docs/interfaces/RoomLabel.html +7 -7
  42. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
  43. package/docs/modules.html +12 -12
  44. package/libs/CSS3DRenderPlugin/index.js +16 -13
  45. package/libs/CameraMovementPlugin/index.js +24 -15
  46. package/libs/ModelChassisCompassPlugin/index.js +14 -5
  47. package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
  48. package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +12 -10
  49. package/libs/ModelItemLabelPlugin/index.js +5 -3
  50. package/libs/ModelItemLabelPlugin/utils/parseData.js +1 -4
  51. package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
  52. package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +3 -3
  53. package/libs/PanoCompassPlugin/index.js +225 -128
  54. package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
  55. package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
  56. package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
  57. package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
  58. package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
  59. package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
  60. package/libs/PanoMeasurePlugin/Model/index.js +30 -5
  61. package/libs/PanoMeasurePlugin/Model/line.js +60 -10
  62. package/libs/PanoMeasurePlugin/Model/point.js +24 -4
  63. package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
  64. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
  65. package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
  66. package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
  67. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
  68. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
  69. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
  70. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
  71. package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
  72. package/libs/PanoMeasurePlugin/utils/line.js +8 -7
  73. package/libs/PanoRulerPlugin/index.js +16 -5
  74. package/libs/PanoSpatialTagPlugin/index.js +11 -9
  75. package/libs/floorplan/Components/BaseImage.js +10 -5
  76. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
  77. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
  78. package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +7 -2
  79. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
  80. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +456 -273
  81. package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
  82. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
  83. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
  84. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +231 -108
  85. package/libs/floorplan/utils/formatData.js +43 -28
  86. package/libs/floorplan/utils/formatPosition.js +1 -1
  87. package/libs/shared-utils/Subscribe.js +8 -1
  88. package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
  89. package/libs/shared-utils/createCanvasTextTexture.js +6 -5
  90. package/libs/shared-utils/five/changeMode.js +23 -12
  91. package/libs/shared-utils/getPxmm.js +1 -1
  92. package/libs/shared-utils/math/evenNumber.js +1 -1
  93. package/libs/shared-utils/three/loadFbxObj.js +20 -9
  94. package/libs/shared-utils/three/loadTexture.js +17 -6
  95. package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
  96. package/libs/shared-utils/tinyEJSrender.js +36 -6
  97. package/libs/shared-utils/to.js +21 -10
  98. package/libs/shared-utils/useDebounce.js +1 -1
  99. package/libs/shared-utils/useThrottle.js +2 -1
  100. package/package.json +1 -1
  101. package/CHANGELOG.md +0 -41
@@ -27,6 +27,31 @@ function _interopNamespace(e) {
27
27
 
28
28
  var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE);
29
29
 
30
+ /*! *****************************************************************************
31
+ Copyright (c) Microsoft Corporation.
32
+
33
+ Permission to use, copy, modify, and/or distribute this software for any
34
+ purpose with or without fee is hereby granted.
35
+
36
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
37
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
38
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
39
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
40
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
42
+ PERFORMANCE OF THIS SOFTWARE.
43
+ ***************************************************************************** */
44
+
45
+ function __awaiter(thisArg, _arguments, P, generator) {
46
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
47
+ return new (P || (P = Promise))(function (resolve, reject) {
48
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
49
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
50
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
51
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
52
+ });
53
+ }
54
+
30
55
  const pluginStyle = {
31
56
  position: 'absolute',
32
57
  left: '50%',
@@ -47,7 +72,7 @@ function pathD(points, options = {}) {
47
72
  d += 'M' + point;
48
73
  return d;
49
74
  }
50
- if (needA?.[index]) {
75
+ if (needA === null || needA === void 0 ? void 0 : needA[index]) {
51
76
  d += 'A' + needA[index] + ',' + point;
52
77
  return d;
53
78
  }
@@ -62,22 +87,26 @@ function formatFloorplanPoint({ x, y }, pxmm, bounding) {
62
87
  return { x: (x - min.x) * pxmm, y: (max.y - y) * pxmm };
63
88
  }
64
89
 
65
- async function formatOutlines(outlines) {
66
- const headers = new Headers({ 'Content-Type': 'text/plain' });
67
- const getOutlineItem = async function (item) {
68
- const outlineItem = {
69
- index: item.index,
70
- url: item.url,
71
- svgUrl: item.svg_url,
90
+ function formatOutlines(outlines) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ const headers = new Headers({ 'Content-Type': 'text/plain' });
93
+ const getOutlineItem = function (item) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ const outlineItem = {
96
+ index: item.index,
97
+ url: item.url,
98
+ svgUrl: item.svg_url,
99
+ };
100
+ if (item.svg_url) {
101
+ const svgContent = yield fetch(item.svg_url, { headers }).then((res) => res.text());
102
+ outlineItem.svgContent = svgContent;
103
+ }
104
+ return outlineItem;
105
+ });
72
106
  };
73
- if (item.svg_url) {
74
- const svgContent = await fetch(item.svg_url, { headers }).then((res) => res.text());
75
- outlineItem.svgContent = svgContent;
76
- }
77
- return outlineItem;
78
- };
79
- const svgOutlineItems = await Promise.all(outlines.map(getOutlineItem));
80
- return svgOutlineItems;
107
+ const svgOutlineItems = yield Promise.all(outlines.map(getOutlineItem));
108
+ return svgOutlineItems;
109
+ });
81
110
  }
82
111
  function formatRoom(data) {
83
112
  const floorplanRoomItem = {
@@ -123,19 +152,21 @@ function formatFloorplanEntrance(data) {
123
152
  };
124
153
  return floorplanEntrance;
125
154
  }
126
- async function formatData(data) {
127
- const outlines = await formatOutlines(data.outlines);
128
- const bounding = data.computed_data.bounding;
129
- const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
130
- const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
131
- const floorplanData = {
132
- outlines,
133
- entrance,
134
- bounding,
135
- floorDatas,
136
- observers: data.computed_data.observers.map(formateFloorplanObserver),
137
- };
138
- return floorplanData;
155
+ function formatData(data) {
156
+ return __awaiter(this, void 0, void 0, function* () {
157
+ const outlines = yield formatOutlines(data.outlines);
158
+ const bounding = data.computed_data.bounding;
159
+ const floorDatas = data.computed_data.floor_datas.map(formatFloorData);
160
+ const entrance = data.computed_data.entrance ? formatFloorplanEntrance(data.computed_data.entrance) : null;
161
+ const floorplanData = {
162
+ outlines,
163
+ entrance,
164
+ bounding,
165
+ floorDatas,
166
+ observers: data.computed_data.observers.map(formateFloorplanObserver),
167
+ };
168
+ return floorplanData;
169
+ });
139
170
  }
140
171
 
141
172
  /**
@@ -190,7 +221,7 @@ function getPxmm(five, container, floorIndex, options) {
190
221
  function getY() {
191
222
  const currentFloorY = getFloorY(floorIndex);
192
223
  const nextFloorY = getFloorY(floorIndex + 1);
193
- const attachedTo = options?.attachedTo || FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER;
224
+ const attachedTo = (options === null || options === void 0 ? void 0 : options.attachedTo) || FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER;
194
225
  if (attachedTo === FLOOR_PLAN_ATTACHED_TO.BOUNDING_CENTER)
195
226
  return (five.model.bounding.max.y + five.model.bounding.min.y) / 2;
196
227
  else if (attachedTo === FLOOR_PLAN_ATTACHED_TO.CEILING)
@@ -324,7 +355,7 @@ function add_css$b(target) {
324
355
  internal.append_styles(target, "svelte-5l80pv", ".floorplan-plugin__compass.svelte-5l80pv{position:absolute;left:50%;top:-46px;width:231px;height:41px;will-change:opacity;transform-origin:center 184px}.floorplan-plugin__compass-image.svelte-5l80pv{width:100%;height:100%;position:absolute;left:0;top:0;opacity:0.1;background-repeat:no-repeat;background-size:100% 100%}.floorplan-plugin__compass-text.svelte-5l80pv{position:absolute;left:50%;top:15px;transform:translateX(-50%);opacity:0.2;font-weight:bold;font-size:10px;color:#fff}");
325
356
  }
326
357
 
327
- // (12:0) {#if northRad}
358
+ // (13:0) {#if northRad}
328
359
  function create_if_block$6(ctx) {
329
360
  let div1;
330
361
  let div0;
@@ -391,9 +422,14 @@ function rad2Deg(rad) {
391
422
  }
392
423
 
393
424
  function instance$f($$self, $$props, $$invalidate) {
425
+ var _a;
394
426
  let { floorplanData } = $$props;
395
427
  let { northDesc } = $$props;
396
- const northRad = floorplanData.entrance?.northRad;
428
+
429
+ const northRad = (_a = floorplanData.entrance) === null || _a === void 0
430
+ ? void 0
431
+ : _a.northRad;
432
+
397
433
  const rotate = !northRad ? 0 : rad2Deg(northRad);
398
434
  const compassTransformStyle = `translateX(-50%) translateZ(10px) rotate(${-rotate + 90}deg)`;
399
435
 
@@ -550,7 +586,9 @@ function instance$e($$self, $$props, $$invalidate) {
550
586
 
551
587
  $$self.$$.update = () => {
552
588
  if ($$self.$$.dirty & /*getLabelElement, room*/ 3) {
553
- $$invalidate(2, userConfigElement = getLabelElement?.(room));
589
+ $$invalidate(2, userConfigElement = getLabelElement === null || getLabelElement === void 0
590
+ ? void 0
591
+ : getLabelElement(room));
554
592
  }
555
593
  };
556
594
 
@@ -1415,7 +1453,7 @@ function add_css$5(target) {
1415
1453
  internal.append_styles(target, "svelte-126ja8e", ".floorplan-plugin__base-image.svelte-126ja8e{position:absolute;z-index:10;width:100%;height:100%;pointer-events:none}");
1416
1454
  }
1417
1455
 
1418
- // (12:22)
1456
+ // (13:22)
1419
1457
  function create_if_block_1$3(ctx) {
1420
1458
  let normalimage;
1421
1459
  let current;
@@ -1449,7 +1487,7 @@ function create_if_block_1$3(ctx) {
1449
1487
  };
1450
1488
  }
1451
1489
 
1452
- // (10:2) {#if svgContent}
1490
+ // (11:2) {#if svgContent}
1453
1491
  function create_if_block$3(ctx) {
1454
1492
  let svgimage;
1455
1493
  let current;
@@ -1577,6 +1615,7 @@ function create_fragment$8(ctx) {
1577
1615
  function instance$8($$self, $$props, $$invalidate) {
1578
1616
  let imageData;
1579
1617
  let svgContent;
1618
+ var _a, _b;
1580
1619
  let { floorIndex } = $$props;
1581
1620
  let { floorplanData } = $$props;
1582
1621
 
@@ -1590,12 +1629,16 @@ function instance$8($$self, $$props, $$invalidate) {
1590
1629
  $$invalidate(1, imageData = floorplanData.outlines[floorIndex]);
1591
1630
  }
1592
1631
 
1593
- if ($$self.$$.dirty & /*floorplanData, floorIndex*/ 12) {
1594
- $$invalidate(0, svgContent = floorplanData.outlines?.[floorIndex]?.svgContent);
1632
+ if ($$self.$$.dirty & /*floorplanData, _a, floorIndex, _b*/ 60) {
1633
+ $$invalidate(0, svgContent = $$invalidate(5, _b = $$invalidate(4, _a = floorplanData.outlines) === null || _a === void 0
1634
+ ? void 0
1635
+ : _a[floorIndex]) === null || _b === void 0
1636
+ ? void 0
1637
+ : _b.svgContent);
1595
1638
  }
1596
1639
  };
1597
1640
 
1598
- return [svgContent, imageData, floorIndex, floorplanData];
1641
+ return [svgContent, imageData, floorIndex, floorplanData, _a, _b];
1599
1642
  }
1600
1643
 
1601
1644
  class BaseImage extends internal.SvelteComponent {
@@ -1881,7 +1924,7 @@ function get_each_context$1(ctx, list, i) {
1881
1924
  return child_ctx;
1882
1925
  }
1883
1926
 
1884
- // (21:6) {:else}
1927
+ // (18:6) {:else}
1885
1928
  function create_else_block(ctx) {
1886
1929
  let roommaterial_1;
1887
1930
  let current;
@@ -1915,7 +1958,7 @@ function create_else_block(ctx) {
1915
1958
  };
1916
1959
  }
1917
1960
 
1918
- // (19:37)
1961
+ // (16:37)
1919
1962
  function create_if_block_1$2(ctx) {
1920
1963
  let roommaterial_2;
1921
1964
  let current;
@@ -1949,7 +1992,7 @@ function create_if_block_1$2(ctx) {
1949
1992
  };
1950
1993
  }
1951
1994
 
1952
- // (17:6) {#if room.floorType === 1}
1995
+ // (14:6) {#if room.floorType === 1}
1953
1996
  function create_if_block$2(ctx) {
1954
1997
  let roommaterial_0;
1955
1998
  let current;
@@ -1983,7 +2026,7 @@ function create_if_block$2(ctx) {
1983
2026
  };
1984
2027
  }
1985
2028
 
1986
- // (15:2) {#each rooms as room}
2029
+ // (12:2) {#each rooms as room}
1987
2030
  function create_each_block$1(ctx) {
1988
2031
  let svg;
1989
2032
  let current_block_type_index;
@@ -2155,8 +2198,7 @@ function instance$4($$self, $$props, $$invalidate) {
2155
2198
 
2156
2199
  $$self.$$.update = () => {
2157
2200
  if ($$self.$$.dirty & /*floorplanData, floorIndex, pxmm*/ 14) {
2158
- $$invalidate(0, rooms = floorplanData.floorDatas[floorIndex].rooms.map(room => ({
2159
- ...room,
2201
+ $$invalidate(0, rooms = floorplanData.floorDatas[floorIndex].rooms.map(room => Object.assign(Object.assign({}, room), {
2160
2202
  path: room.path.map(p => formatFloorplanPoint(p, pxmm, floorplanData.bounding))
2161
2203
  })));
2162
2204
  }
@@ -2404,7 +2446,9 @@ function instance$2($$self, $$props, $$invalidate) {
2404
2446
  const { observers: floorplan_observers } = floorplanData;
2405
2447
 
2406
2448
  const handleClick = function (e) {
2407
- if (onRoomHeightClick?.(e) === false) return;
2449
+ if ((onRoomHeightClick === null || onRoomHeightClick === void 0
2450
+ ? void 0
2451
+ : onRoomHeightClick(e)) === false) return;
2408
2452
 
2409
2453
  // 因为 mouse.offsetX 的兼容性问题,手动计算 mouse offsetX offsetY
2410
2454
  const boundingClientRect = highlightContainerDom.getBoundingClientRect();
@@ -3288,20 +3332,217 @@ function changeModelCanvasOpacity(five, opacity, duration = 300) {
3288
3332
  }
3289
3333
 
3290
3334
  class TopviewFloorplanPluginController {
3291
- size = { width: 0, height: 0 };
3292
- visible = false;
3293
- pxmm = 0;
3294
- app;
3295
- five;
3296
- panoIndex = 0;
3297
- floorIndex = 0;
3298
- configs = {};
3299
- lastPanoramaLongitude = 0;
3300
- selector;
3301
- floorplanData;
3302
- wrapper;
3303
- container = document.createElement('div');
3304
3335
  constructor(five, params) {
3336
+ Object.defineProperty(this, "size", {
3337
+ enumerable: true,
3338
+ configurable: true,
3339
+ writable: true,
3340
+ value: { width: 0, height: 0 }
3341
+ });
3342
+ Object.defineProperty(this, "visible", {
3343
+ enumerable: true,
3344
+ configurable: true,
3345
+ writable: true,
3346
+ value: false
3347
+ });
3348
+ Object.defineProperty(this, "pxmm", {
3349
+ enumerable: true,
3350
+ configurable: true,
3351
+ writable: true,
3352
+ value: 0
3353
+ });
3354
+ Object.defineProperty(this, "app", {
3355
+ enumerable: true,
3356
+ configurable: true,
3357
+ writable: true,
3358
+ value: void 0
3359
+ });
3360
+ Object.defineProperty(this, "five", {
3361
+ enumerable: true,
3362
+ configurable: true,
3363
+ writable: true,
3364
+ value: void 0
3365
+ });
3366
+ Object.defineProperty(this, "panoIndex", {
3367
+ enumerable: true,
3368
+ configurable: true,
3369
+ writable: true,
3370
+ value: 0
3371
+ });
3372
+ Object.defineProperty(this, "floorIndex", {
3373
+ enumerable: true,
3374
+ configurable: true,
3375
+ writable: true,
3376
+ value: 0
3377
+ });
3378
+ Object.defineProperty(this, "configs", {
3379
+ enumerable: true,
3380
+ configurable: true,
3381
+ writable: true,
3382
+ value: {}
3383
+ });
3384
+ Object.defineProperty(this, "lastPanoramaLongitude", {
3385
+ enumerable: true,
3386
+ configurable: true,
3387
+ writable: true,
3388
+ value: 0
3389
+ });
3390
+ Object.defineProperty(this, "selector", {
3391
+ enumerable: true,
3392
+ configurable: true,
3393
+ writable: true,
3394
+ value: void 0
3395
+ });
3396
+ Object.defineProperty(this, "floorplanData", {
3397
+ enumerable: true,
3398
+ configurable: true,
3399
+ writable: true,
3400
+ value: void 0
3401
+ });
3402
+ Object.defineProperty(this, "wrapper", {
3403
+ enumerable: true,
3404
+ configurable: true,
3405
+ writable: true,
3406
+ value: void 0
3407
+ });
3408
+ Object.defineProperty(this, "container", {
3409
+ enumerable: true,
3410
+ configurable: true,
3411
+ writable: true,
3412
+ value: document.createElement('div')
3413
+ });
3414
+ Object.defineProperty(this, "dispose", {
3415
+ enumerable: true,
3416
+ configurable: true,
3417
+ writable: true,
3418
+ value: () => {
3419
+ var _a, _b;
3420
+ this.hide();
3421
+ (_a = this.container) === null || _a === void 0 ? void 0 : _a.remove();
3422
+ (_b = this.app) === null || _b === void 0 ? void 0 : _b.$destroy();
3423
+ this.five.off('modeChange', this.handleModeChange);
3424
+ this.five.off('panoArrived', this.handlePanoArrived);
3425
+ this.five.off('modelLoaded', this.handleModelLoaded);
3426
+ this.five.off('wantsMoveToPano', this.handleWantsMoveToPano);
3427
+ this.five.off('wantsPanGesture', this.handleWantsPanGesture);
3428
+ this.five.off('initAnimationEnded', this.handleInitAnimationEnded);
3429
+ this.five.off('modelShownFloorChange', this.onModelShownFloorChange);
3430
+ }
3431
+ });
3432
+ /** 模型楼层高亮改变时,自动进行楼层切换 */
3433
+ Object.defineProperty(this, "onModelShownFloorChange", {
3434
+ enumerable: true,
3435
+ configurable: true,
3436
+ writable: true,
3437
+ value: (shownFloor) => {
3438
+ if (shownFloor === null)
3439
+ return;
3440
+ this.floorIndex = shownFloor;
3441
+ this.updateSize();
3442
+ this.render();
3443
+ }
3444
+ });
3445
+ /** panoIndex 改变时,更新 floorIndex */
3446
+ Object.defineProperty(this, "handlePanoArrived", {
3447
+ enumerable: true,
3448
+ configurable: true,
3449
+ writable: true,
3450
+ value: (index) => {
3451
+ var _a;
3452
+ if (!((_a = this.five) === null || _a === void 0 ? void 0 : _a.work))
3453
+ return;
3454
+ this.panoIndex = index;
3455
+ this.floorIndex = this.five.work.observers[index].floorIndex;
3456
+ }
3457
+ });
3458
+ /** 配置了 preventRoomClick 后,在户型图展示时阻止 Five 走点 */
3459
+ Object.defineProperty(this, "handleWantsMoveToPano", {
3460
+ enumerable: true,
3461
+ configurable: true,
3462
+ writable: true,
3463
+ value: () => {
3464
+ if (!this.visible)
3465
+ return;
3466
+ if (this.configs.preventRoomClick)
3467
+ return false;
3468
+ return;
3469
+ }
3470
+ });
3471
+ /** 在户型图展示时阻止 Five 滑动行为 */
3472
+ Object.defineProperty(this, "handleWantsPanGesture", {
3473
+ enumerable: true,
3474
+ configurable: true,
3475
+ writable: true,
3476
+ value: () => {
3477
+ if (!this.visible)
3478
+ return;
3479
+ return false;
3480
+ }
3481
+ });
3482
+ Object.defineProperty(this, "handleModelLoaded", {
3483
+ enumerable: true,
3484
+ configurable: true,
3485
+ writable: true,
3486
+ value: () => {
3487
+ if (this.wrapper)
3488
+ return;
3489
+ if (!this.selector)
3490
+ return;
3491
+ const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
3492
+ if (!wrapper)
3493
+ throw new Error('不正确的父容器选择器');
3494
+ this.wrapper = wrapper;
3495
+ wrapper.append(this.container);
3496
+ }
3497
+ });
3498
+ /** 非 Topview 态隐藏户型图 */
3499
+ Object.defineProperty(this, "handleModeChange", {
3500
+ enumerable: true,
3501
+ configurable: true,
3502
+ writable: true,
3503
+ value: (mode) => {
3504
+ if (mode !== 'Topview')
3505
+ return this.hide();
3506
+ }
3507
+ });
3508
+ /** 动画结束后是 Topview 态就展示户型图 */
3509
+ Object.defineProperty(this, "handleInitAnimationEnded", {
3510
+ enumerable: true,
3511
+ configurable: true,
3512
+ writable: true,
3513
+ value: () => {
3514
+ const { mode } = this.five.getCurrentState();
3515
+ if (mode === 'Topview')
3516
+ this.show();
3517
+ }
3518
+ });
3519
+ /** 更新户型图大小 */
3520
+ Object.defineProperty(this, "updateSize", {
3521
+ enumerable: true,
3522
+ configurable: true,
3523
+ writable: true,
3524
+ value: () => {
3525
+ if (!this.floorplanData)
3526
+ return;
3527
+ if (!this.container || !this.wrapper)
3528
+ return;
3529
+ if (this.five.getCurrentState().mode !== 'Topview')
3530
+ return;
3531
+ // 计算户型图展示大小
3532
+ const { min, max } = this.floorplanData.bounding;
3533
+ const width = max.x - min.x;
3534
+ const height = max.y - min.y;
3535
+ // 每毫米对应的 px 值
3536
+ const options = this.configs.attachedTo ? { attachedTo: this.configs.attachedTo } : undefined;
3537
+ const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
3538
+ const _width = Math.ceil(width * pxmm);
3539
+ const _height = Math.ceil(height * pxmm);
3540
+ this.pxmm = pxmm;
3541
+ this.size = { width: _width, height: _height };
3542
+ this.container.style.width = _width + 'px';
3543
+ this.container.style.height = _height + 'px';
3544
+ }
3545
+ });
3305
3546
  this.five = five;
3306
3547
  this.selector = params.selector;
3307
3548
  this.configs = omit(params, ['selector']);
@@ -3317,10 +3558,12 @@ class TopviewFloorplanPluginController {
3317
3558
  this.five.on('modelShownFloorChange', this.onModelShownFloorChange);
3318
3559
  }
3319
3560
  /** 加载户型图数据 */
3320
- async load(data) {
3321
- const copyData = JSON.parse(JSON.stringify(data));
3322
- this.floorplanData = await formatData(copyData);
3323
- this.render();
3561
+ load(data) {
3562
+ return __awaiter(this, void 0, void 0, function* () {
3563
+ const copyData = JSON.parse(JSON.stringify(data));
3564
+ this.floorplanData = yield formatData(copyData);
3565
+ this.render();
3566
+ });
3324
3567
  }
3325
3568
  /** 把插件的渲染DOM插入到对应的容器中去 */
3326
3569
  appendTo(wrapper) {
@@ -3328,69 +3571,6 @@ class TopviewFloorplanPluginController {
3328
3571
  wrapper.appendChild(this.container);
3329
3572
  return this;
3330
3573
  }
3331
- dispose = () => {
3332
- this.hide();
3333
- this.container?.remove();
3334
- this.app?.$destroy();
3335
- this.five.off('modeChange', this.handleModeChange);
3336
- this.five.off('panoArrived', this.handlePanoArrived);
3337
- this.five.off('modelLoaded', this.handleModelLoaded);
3338
- this.five.off('wantsMoveToPano', this.handleWantsMoveToPano);
3339
- this.five.off('wantsPanGesture', this.handleWantsPanGesture);
3340
- this.five.off('initAnimationEnded', this.handleInitAnimationEnded);
3341
- this.five.off('modelShownFloorChange', this.onModelShownFloorChange);
3342
- };
3343
- /** 模型楼层高亮改变时,自动进行楼层切换 */
3344
- onModelShownFloorChange = (shownFloor) => {
3345
- if (shownFloor === null)
3346
- return;
3347
- this.floorIndex = shownFloor;
3348
- this.updateSize();
3349
- this.render();
3350
- };
3351
- /** panoIndex 改变时,更新 floorIndex */
3352
- handlePanoArrived = (index) => {
3353
- if (!this.five?.work)
3354
- return;
3355
- this.panoIndex = index;
3356
- this.floorIndex = this.five.work.observers[index].floorIndex;
3357
- };
3358
- /** 配置了 preventRoomClick 后,在户型图展示时阻止 Five 走点 */
3359
- handleWantsMoveToPano = () => {
3360
- if (!this.visible)
3361
- return;
3362
- if (this.configs.preventRoomClick)
3363
- return false;
3364
- return;
3365
- };
3366
- /** 在户型图展示时阻止 Five 滑动行为 */
3367
- handleWantsPanGesture = () => {
3368
- if (!this.visible)
3369
- return;
3370
- return false;
3371
- };
3372
- handleModelLoaded = () => {
3373
- if (this.wrapper)
3374
- return;
3375
- if (!this.selector)
3376
- return;
3377
- const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
3378
- if (!wrapper)
3379
- throw new Error('不正确的父容器选择器');
3380
- this.wrapper = wrapper;
3381
- wrapper.append(this.container);
3382
- };
3383
- /** 非 Topview 态隐藏户型图 */
3384
- handleModeChange = (mode) => {
3385
- if (mode !== 'Topview')
3386
- return this.hide();
3387
- };
3388
- /** 动画结束后是 Topview 态就展示户型图 */
3389
- handleInitAnimationEnded = () => {
3390
- const { mode } = this.five.getCurrentState();
3391
- if (mode === 'Topview')
3392
- this.show();
3393
- };
3394
3574
  show() {
3395
3575
  this.visible = true;
3396
3576
  this.five.model.show(this.floorIndex);
@@ -3413,28 +3593,6 @@ class TopviewFloorplanPluginController {
3413
3593
  this.five.on('wantsMoveToPano', this.handleWantsMoveToPano);
3414
3594
  this.five.on('wantsPanGesture', this.handleWantsPanGesture);
3415
3595
  }
3416
- /** 更新户型图大小 */
3417
- updateSize = () => {
3418
- if (!this.floorplanData)
3419
- return;
3420
- if (!this.container || !this.wrapper)
3421
- return;
3422
- if (this.five.getCurrentState().mode !== 'Topview')
3423
- return;
3424
- // 计算户型图展示大小
3425
- const { min, max } = this.floorplanData.bounding;
3426
- const width = max.x - min.x;
3427
- const height = max.y - min.y;
3428
- // 每毫米对应的 px 值
3429
- const options = this.configs.attachedTo ? { attachedTo: this.configs.attachedTo } : undefined;
3430
- const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
3431
- const _width = Math.ceil(width * pxmm);
3432
- const _height = Math.ceil(height * pxmm);
3433
- this.pxmm = pxmm;
3434
- this.size = { width: _width, height: _height };
3435
- this.container.style.width = _width + 'px';
3436
- this.container.style.height = _height + 'px';
3437
- };
3438
3596
  render(duration) {
3439
3597
  if (!this.container || !this.floorplanData)
3440
3598
  return;
@@ -3443,19 +3601,19 @@ class TopviewFloorplanPluginController {
3443
3601
  const { northDesc, getLabelElement, cameraImageUrl, preventRoomClick, hoverEnable, compassEnable, roomLabelsEnable, ruleLabelsEnable, } = this.configs;
3444
3602
  const handleClick = preventRoomClick ? () => false : undefined;
3445
3603
  const props = {
3446
- northDesc: northDesc ?? '北',
3604
+ northDesc: northDesc !== null && northDesc !== void 0 ? northDesc : '北',
3447
3605
  five: this.five,
3448
3606
  pxmm: this.pxmm,
3449
3607
  cameraImageUrl,
3450
3608
  visible: this.visible,
3451
- duration: duration ?? 0,
3609
+ duration: duration !== null && duration !== void 0 ? duration : 0,
3452
3610
  panoIndex: this.panoIndex,
3453
3611
  floorIndex: this.floorIndex,
3454
3612
  floorplanData: this.floorplanData,
3455
- hoverEnable: hoverEnable ?? false,
3456
- compassEnable: compassEnable ?? true,
3457
- ruleLabelsEnable: ruleLabelsEnable ?? true,
3458
- roomLabelsEnable: roomLabelsEnable ?? true,
3613
+ hoverEnable: hoverEnable !== null && hoverEnable !== void 0 ? hoverEnable : false,
3614
+ compassEnable: compassEnable !== null && compassEnable !== void 0 ? compassEnable : true,
3615
+ ruleLabelsEnable: ruleLabelsEnable !== null && ruleLabelsEnable !== void 0 ? ruleLabelsEnable : true,
3616
+ roomLabelsEnable: roomLabelsEnable !== null && roomLabelsEnable !== void 0 ? roomLabelsEnable : true,
3459
3617
  lastPanoramaLongitude: this.lastPanoramaLongitude,
3460
3618
  getLabelElement,
3461
3619
  onRoomHeightClick: handleClick,