@realsee/dnalogel 2.0.0-alpha.10 → 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 (123) 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/events.type.d.ts +9 -0
  6. package/dist/ModelItemLabelPlugin/index.d.ts +4 -0
  7. package/dist/ModelItemLabelPlugin/index.js +679 -0
  8. package/dist/ModelItemLabelPlugin/typings.d.ts +55 -0
  9. package/dist/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
  10. package/dist/ModelRoomLabelPlugin/index.js +71 -28
  11. package/dist/PanoCompassPlugin/index.js +311 -164
  12. package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
  13. package/dist/PanoMeasurePlugin/index.js +1337 -583
  14. package/dist/PanoRulerPlugin/index.js +32 -5
  15. package/dist/PanoSpatialTagPlugin/index.js +73 -38
  16. package/dist/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
  17. package/dist/floorplan/ModelFloorplanPlugin/index.js +678 -439
  18. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
  19. package/dist/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
  20. package/dist/floorplan/TopviewFloorplanPlugin/index.js +403 -230
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.es.js +3596 -1612
  23. package/dist/index.js +3602 -1616
  24. package/dist/index.umd.js +3605 -1620
  25. package/docs/assets/main.js +1 -1
  26. package/docs/assets/search.js +1 -1
  27. package/docs/classes/ModelRoomLabelController.html +6 -6
  28. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  29. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  30. package/docs/index.html +1 -1
  31. package/docs/interfaces/LineJson.html +1 -1
  32. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  33. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  34. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  35. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  36. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  37. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  38. package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
  39. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  40. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  41. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  42. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  43. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  44. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  45. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  46. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  47. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  48. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  49. package/docs/interfaces/PointJson.html +1 -1
  50. package/docs/interfaces/RoomLabel.html +7 -7
  51. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
  52. package/docs/modules.html +12 -12
  53. package/libs/CSS3DRenderPlugin/index.js +16 -13
  54. package/libs/CameraMovementPlugin/index.js +24 -15
  55. package/libs/ModelChassisCompassPlugin/index.js +14 -5
  56. package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
  57. package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +422 -0
  58. package/libs/ModelItemLabelPlugin/ItemLabelItem.js +133 -0
  59. package/libs/ModelItemLabelPlugin/events.type.d.ts +9 -0
  60. package/libs/ModelItemLabelPlugin/events.type.js +1 -0
  61. package/libs/ModelItemLabelPlugin/index.d.ts +4 -0
  62. package/libs/ModelItemLabelPlugin/index.js +172 -0
  63. package/libs/ModelItemLabelPlugin/typings.d.ts +55 -0
  64. package/libs/ModelItemLabelPlugin/typings.js +6 -0
  65. package/libs/ModelItemLabelPlugin/utils/parseData.d.ts +3 -0
  66. package/libs/ModelItemLabelPlugin/utils/parseData.js +4 -0
  67. package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
  68. package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +7 -5
  69. package/libs/PanoCompassPlugin/index.js +225 -128
  70. package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
  71. package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
  72. package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
  73. package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
  74. package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
  75. package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
  76. package/libs/PanoMeasurePlugin/Model/index.js +30 -5
  77. package/libs/PanoMeasurePlugin/Model/line.js +60 -10
  78. package/libs/PanoMeasurePlugin/Model/point.js +24 -4
  79. package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
  80. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
  81. package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
  82. package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
  83. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
  84. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
  85. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
  86. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
  87. package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
  88. package/libs/PanoMeasurePlugin/utils/line.js +8 -7
  89. package/libs/PanoRulerPlugin/index.js +16 -5
  90. package/libs/PanoSpatialTagPlugin/Components/tag.js +9 -9
  91. package/libs/PanoSpatialTagPlugin/index.js +11 -9
  92. package/libs/floorplan/Components/BaseImage.js +10 -5
  93. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
  94. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
  95. package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +24 -11
  96. package/libs/floorplan/ModelFloorplanPlugin/Components/Main.js +77 -69
  97. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
  98. package/libs/floorplan/ModelFloorplanPlugin/Controller.d.ts +1 -0
  99. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +457 -273
  100. package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
  101. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
  102. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
  103. package/libs/floorplan/TopviewFloorplanPlugin/Controller.d.ts +1 -0
  104. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +232 -108
  105. package/libs/floorplan/utils/formatData.js +43 -28
  106. package/libs/floorplan/utils/formatPosition.js +1 -1
  107. package/libs/index.d.ts +1 -0
  108. package/libs/index.js +2 -0
  109. package/libs/shared-utils/Subscribe.js +8 -1
  110. package/libs/shared-utils/animationFrame/BetterTween.js +47 -18
  111. package/libs/shared-utils/createCanvasTextTexture.js +6 -5
  112. package/libs/shared-utils/five/changeMode.js +23 -12
  113. package/libs/shared-utils/getPxmm.js +1 -1
  114. package/libs/shared-utils/math/evenNumber.js +1 -1
  115. package/libs/shared-utils/three/loadFbxObj.js +20 -9
  116. package/libs/shared-utils/three/loadTexture.js +17 -6
  117. package/libs/shared-utils/three/transfromToMeshBasicMaterial.js +2 -1
  118. package/libs/shared-utils/tinyEJSrender.js +36 -6
  119. package/libs/shared-utils/to.js +21 -10
  120. package/libs/shared-utils/useDebounce.js +1 -1
  121. package/libs/shared-utils/useThrottle.js +2 -1
  122. package/package.json +2 -2
  123. package/CHANGELOG.md +0 -34
@@ -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,12 +355,13 @@ 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
- // (11:0) {#if northRad}
358
+ // (13:0) {#if northRad}
328
359
  function create_if_block$6(ctx) {
329
360
  let div1;
330
361
  let div0;
331
362
  let t0;
332
363
  let span;
364
+ let t1;
333
365
 
334
366
  return {
335
367
  c() {
@@ -337,20 +369,23 @@ function create_if_block$6(ctx) {
337
369
  div0 = internal.element("div");
338
370
  t0 = internal.space();
339
371
  span = internal.element("span");
340
- span.textContent = "北";
372
+ t1 = internal.text(/*northDesc*/ ctx[0]);
341
373
  internal.attr(div0, "class", "floorplan-plugin__compass-image svelte-5l80pv");
342
374
  internal.set_style(div0, "background-image", `url(${COMPASS_IMAGE})`);
343
375
  internal.attr(span, "class", "floorplan-plugin__compass-text svelte-5l80pv");
344
376
  internal.attr(div1, "class", "floorplan-plugin__compass svelte-5l80pv");
345
- internal.set_style(div1, "transform", /*compassTransformStyle*/ ctx[1], false);
377
+ internal.set_style(div1, "transform", /*compassTransformStyle*/ ctx[2], false);
346
378
  },
347
379
  m(target, anchor) {
348
380
  internal.insert(target, div1, anchor);
349
381
  internal.append(div1, div0);
350
382
  internal.append(div1, t0);
351
383
  internal.append(div1, span);
384
+ internal.append(span, t1);
385
+ },
386
+ p(ctx, dirty) {
387
+ if (dirty & /*northDesc*/ 1) internal.set_data(t1, /*northDesc*/ ctx[0]);
352
388
  },
353
- p: internal.noop,
354
389
  d(detaching) {
355
390
  if (detaching) internal.detach(div1);
356
391
  }
@@ -359,7 +394,7 @@ function create_if_block$6(ctx) {
359
394
 
360
395
  function create_fragment$f(ctx) {
361
396
  let if_block_anchor;
362
- let if_block = /*northRad*/ ctx[0] && create_if_block$6(ctx);
397
+ let if_block = /*northRad*/ ctx[1] && create_if_block$6(ctx);
363
398
 
364
399
  return {
365
400
  c() {
@@ -371,7 +406,7 @@ function create_fragment$f(ctx) {
371
406
  internal.insert(target, if_block_anchor, anchor);
372
407
  },
373
408
  p(ctx, [dirty]) {
374
- if (/*northRad*/ ctx[0]) if_block.p(ctx, dirty);
409
+ if (/*northRad*/ ctx[1]) if_block.p(ctx, dirty);
375
410
  },
376
411
  i: internal.noop,
377
412
  o: internal.noop,
@@ -387,22 +422,29 @@ function rad2Deg(rad) {
387
422
  }
388
423
 
389
424
  function instance$f($$self, $$props, $$invalidate) {
425
+ var _a;
390
426
  let { floorplanData } = $$props;
391
- const northRad = floorplanData.entrance?.northRad;
427
+ let { northDesc } = $$props;
428
+
429
+ const northRad = (_a = floorplanData.entrance) === null || _a === void 0
430
+ ? void 0
431
+ : _a.northRad;
432
+
392
433
  const rotate = !northRad ? 0 : rad2Deg(northRad);
393
434
  const compassTransformStyle = `translateX(-50%) translateZ(10px) rotate(${-rotate + 90}deg)`;
394
435
 
395
436
  $$self.$$set = $$props => {
396
- if ('floorplanData' in $$props) $$invalidate(2, floorplanData = $$props.floorplanData);
437
+ if ('floorplanData' in $$props) $$invalidate(3, floorplanData = $$props.floorplanData);
438
+ if ('northDesc' in $$props) $$invalidate(0, northDesc = $$props.northDesc);
397
439
  };
398
440
 
399
- return [northRad, compassTransformStyle, floorplanData];
441
+ return [northDesc, northRad, compassTransformStyle, floorplanData];
400
442
  }
401
443
 
402
444
  class Compass extends internal.SvelteComponent {
403
445
  constructor(options) {
404
446
  super();
405
- internal.init(this, options, instance$f, create_fragment$f, internal.safe_not_equal, { floorplanData: 2 }, add_css$b);
447
+ internal.init(this, options, instance$f, create_fragment$f, internal.safe_not_equal, { floorplanData: 3, northDesc: 0 }, add_css$b);
406
448
  }
407
449
  }
408
450
 
@@ -544,7 +586,9 @@ function instance$e($$self, $$props, $$invalidate) {
544
586
 
545
587
  $$self.$$.update = () => {
546
588
  if ($$self.$$.dirty & /*getLabelElement, room*/ 3) {
547
- $$invalidate(2, userConfigElement = getLabelElement?.(room));
589
+ $$invalidate(2, userConfigElement = getLabelElement === null || getLabelElement === void 0
590
+ ? void 0
591
+ : getLabelElement(room));
548
592
  }
549
593
  };
550
594
 
@@ -1409,7 +1453,7 @@ function add_css$5(target) {
1409
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}");
1410
1454
  }
1411
1455
 
1412
- // (12:22)
1456
+ // (13:22)
1413
1457
  function create_if_block_1$3(ctx) {
1414
1458
  let normalimage;
1415
1459
  let current;
@@ -1443,7 +1487,7 @@ function create_if_block_1$3(ctx) {
1443
1487
  };
1444
1488
  }
1445
1489
 
1446
- // (10:2) {#if svgContent}
1490
+ // (11:2) {#if svgContent}
1447
1491
  function create_if_block$3(ctx) {
1448
1492
  let svgimage;
1449
1493
  let current;
@@ -1571,6 +1615,7 @@ function create_fragment$8(ctx) {
1571
1615
  function instance$8($$self, $$props, $$invalidate) {
1572
1616
  let imageData;
1573
1617
  let svgContent;
1618
+ var _a, _b;
1574
1619
  let { floorIndex } = $$props;
1575
1620
  let { floorplanData } = $$props;
1576
1621
 
@@ -1584,12 +1629,16 @@ function instance$8($$self, $$props, $$invalidate) {
1584
1629
  $$invalidate(1, imageData = floorplanData.outlines[floorIndex]);
1585
1630
  }
1586
1631
 
1587
- if ($$self.$$.dirty & /*floorplanData, floorIndex*/ 12) {
1588
- $$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);
1589
1638
  }
1590
1639
  };
1591
1640
 
1592
- return [svgContent, imageData, floorIndex, floorplanData];
1641
+ return [svgContent, imageData, floorIndex, floorplanData, _a, _b];
1593
1642
  }
1594
1643
 
1595
1644
  class BaseImage extends internal.SvelteComponent {
@@ -1875,7 +1924,7 @@ function get_each_context$1(ctx, list, i) {
1875
1924
  return child_ctx;
1876
1925
  }
1877
1926
 
1878
- // (21:6) {:else}
1927
+ // (18:6) {:else}
1879
1928
  function create_else_block(ctx) {
1880
1929
  let roommaterial_1;
1881
1930
  let current;
@@ -1909,7 +1958,7 @@ function create_else_block(ctx) {
1909
1958
  };
1910
1959
  }
1911
1960
 
1912
- // (19:37)
1961
+ // (16:37)
1913
1962
  function create_if_block_1$2(ctx) {
1914
1963
  let roommaterial_2;
1915
1964
  let current;
@@ -1943,7 +1992,7 @@ function create_if_block_1$2(ctx) {
1943
1992
  };
1944
1993
  }
1945
1994
 
1946
- // (17:6) {#if room.floorType === 1}
1995
+ // (14:6) {#if room.floorType === 1}
1947
1996
  function create_if_block$2(ctx) {
1948
1997
  let roommaterial_0;
1949
1998
  let current;
@@ -1977,7 +2026,7 @@ function create_if_block$2(ctx) {
1977
2026
  };
1978
2027
  }
1979
2028
 
1980
- // (15:2) {#each rooms as room}
2029
+ // (12:2) {#each rooms as room}
1981
2030
  function create_each_block$1(ctx) {
1982
2031
  let svg;
1983
2032
  let current_block_type_index;
@@ -2149,8 +2198,7 @@ function instance$4($$self, $$props, $$invalidate) {
2149
2198
 
2150
2199
  $$self.$$.update = () => {
2151
2200
  if ($$self.$$.dirty & /*floorplanData, floorIndex, pxmm*/ 14) {
2152
- $$invalidate(0, rooms = floorplanData.floorDatas[floorIndex].rooms.map(room => ({
2153
- ...room,
2201
+ $$invalidate(0, rooms = floorplanData.floorDatas[floorIndex].rooms.map(room => Object.assign(Object.assign({}, room), {
2154
2202
  path: room.path.map(p => formatFloorplanPoint(p, pxmm, floorplanData.bounding))
2155
2203
  })));
2156
2204
  }
@@ -2398,7 +2446,9 @@ function instance$2($$self, $$props, $$invalidate) {
2398
2446
  const { observers: floorplan_observers } = floorplanData;
2399
2447
 
2400
2448
  const handleClick = function (e) {
2401
- if (onRoomHeightClick?.(e) === false) return;
2449
+ if ((onRoomHeightClick === null || onRoomHeightClick === void 0
2450
+ ? void 0
2451
+ : onRoomHeightClick(e)) === false) return;
2402
2452
 
2403
2453
  // 因为 mouse.offsetX 的兼容性问题,手动计算 mouse offsetX offsetY
2404
2454
  const boundingClientRect = highlightContainerDom.getBoundingClientRect();
@@ -2919,7 +2969,7 @@ function add_css(target) {
2919
2969
  internal.append_styles(target, "svelte-177x2q7", ".floorplan-main.svelte-177x2q7{width:100%;height:100%}");
2920
2970
  }
2921
2971
 
2922
- // (23:0) {#if visible}
2972
+ // (24:0) {#if visible}
2923
2973
  function create_if_block(ctx) {
2924
2974
  let div;
2925
2975
  let currentfloor;
@@ -2931,15 +2981,15 @@ function create_if_block(ctx) {
2931
2981
 
2932
2982
  const currentfloor_spread_levels = [
2933
2983
  {
2934
- five: /*five*/ ctx[1],
2935
- pxmm: /*pxmm*/ ctx[0],
2936
- floorIndex: /*floorIndex*/ ctx[5],
2937
- hoverEnable: /*hoverEnable*/ ctx[6],
2938
- floorplanData: /*floorplanData*/ ctx[10],
2939
- getLabelElement: /*getLabelElement*/ ctx[14],
2940
- roomLabelsEnable: /*roomLabelsEnable*/ ctx[8],
2941
- ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[9],
2942
- onRoomHeightClick: /*onRoomHeightClick*/ ctx[13]
2984
+ five: /*five*/ ctx[2],
2985
+ pxmm: /*pxmm*/ ctx[1],
2986
+ floorIndex: /*floorIndex*/ ctx[6],
2987
+ hoverEnable: /*hoverEnable*/ ctx[7],
2988
+ floorplanData: /*floorplanData*/ ctx[11],
2989
+ getLabelElement: /*getLabelElement*/ ctx[15],
2990
+ roomLabelsEnable: /*roomLabelsEnable*/ ctx[9],
2991
+ ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[10],
2992
+ onRoomHeightClick: /*onRoomHeightClick*/ ctx[14]
2943
2993
  }
2944
2994
  ];
2945
2995
 
@@ -2953,10 +3003,10 @@ function create_if_block(ctx) {
2953
3003
 
2954
3004
  const camera_spread_levels = [
2955
3005
  {
2956
- panoIndex: /*panoIndex*/ ctx[4],
2957
- floorplanData: /*floorplanData*/ ctx[10],
2958
- lastPanoramaLongitude: /*lastPanoramaLongitude*/ ctx[11],
2959
- cameraImageUrl: /*cameraImageUrl*/ ctx[12]
3006
+ panoIndex: /*panoIndex*/ ctx[5],
3007
+ floorplanData: /*floorplanData*/ ctx[11],
3008
+ lastPanoramaLongitude: /*lastPanoramaLongitude*/ ctx[12],
3009
+ cameraImageUrl: /*cameraImageUrl*/ ctx[13]
2960
3010
  }
2961
3011
  ];
2962
3012
 
@@ -2967,7 +3017,7 @@ function create_if_block(ctx) {
2967
3017
  }
2968
3018
 
2969
3019
  camera = new Camera({ props: camera_props });
2970
- let if_block = /*compassEnable*/ ctx[7] && create_if_block_1(ctx);
3020
+ let if_block = /*compassEnable*/ ctx[8] && create_if_block_1(ctx);
2971
3021
 
2972
3022
  return {
2973
3023
  c() {
@@ -2991,42 +3041,42 @@ function create_if_block(ctx) {
2991
3041
  p(new_ctx, dirty) {
2992
3042
  ctx = new_ctx;
2993
3043
 
2994
- const currentfloor_changes = (dirty & /*five, pxmm, floorIndex, hoverEnable, floorplanData, getLabelElement, roomLabelsEnable, ruleLabelsEnable, onRoomHeightClick*/ 26467)
3044
+ const currentfloor_changes = (dirty & /*five, pxmm, floorIndex, hoverEnable, floorplanData, getLabelElement, roomLabelsEnable, ruleLabelsEnable, onRoomHeightClick*/ 52934)
2995
3045
  ? internal.get_spread_update(currentfloor_spread_levels, [
2996
3046
  {
2997
- five: /*five*/ ctx[1],
2998
- pxmm: /*pxmm*/ ctx[0],
2999
- floorIndex: /*floorIndex*/ ctx[5],
3000
- hoverEnable: /*hoverEnable*/ ctx[6],
3001
- floorplanData: /*floorplanData*/ ctx[10],
3002
- getLabelElement: /*getLabelElement*/ ctx[14],
3003
- roomLabelsEnable: /*roomLabelsEnable*/ ctx[8],
3004
- ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[9],
3005
- onRoomHeightClick: /*onRoomHeightClick*/ ctx[13]
3047
+ five: /*five*/ ctx[2],
3048
+ pxmm: /*pxmm*/ ctx[1],
3049
+ floorIndex: /*floorIndex*/ ctx[6],
3050
+ hoverEnable: /*hoverEnable*/ ctx[7],
3051
+ floorplanData: /*floorplanData*/ ctx[11],
3052
+ getLabelElement: /*getLabelElement*/ ctx[15],
3053
+ roomLabelsEnable: /*roomLabelsEnable*/ ctx[9],
3054
+ ruleLabelsEnable: /*ruleLabelsEnable*/ ctx[10],
3055
+ onRoomHeightClick: /*onRoomHeightClick*/ ctx[14]
3006
3056
  }
3007
3057
  ])
3008
3058
  : {};
3009
3059
 
3010
3060
  currentfloor.$set(currentfloor_changes);
3011
3061
 
3012
- const camera_changes = (dirty & /*panoIndex, floorplanData, lastPanoramaLongitude, cameraImageUrl*/ 7184)
3062
+ const camera_changes = (dirty & /*panoIndex, floorplanData, lastPanoramaLongitude, cameraImageUrl*/ 14368)
3013
3063
  ? internal.get_spread_update(camera_spread_levels, [
3014
3064
  {
3015
- panoIndex: /*panoIndex*/ ctx[4],
3016
- floorplanData: /*floorplanData*/ ctx[10],
3017
- lastPanoramaLongitude: /*lastPanoramaLongitude*/ ctx[11],
3018
- cameraImageUrl: /*cameraImageUrl*/ ctx[12]
3065
+ panoIndex: /*panoIndex*/ ctx[5],
3066
+ floorplanData: /*floorplanData*/ ctx[11],
3067
+ lastPanoramaLongitude: /*lastPanoramaLongitude*/ ctx[12],
3068
+ cameraImageUrl: /*cameraImageUrl*/ ctx[13]
3019
3069
  }
3020
3070
  ])
3021
3071
  : {};
3022
3072
 
3023
3073
  camera.$set(camera_changes);
3024
3074
 
3025
- if (/*compassEnable*/ ctx[7]) {
3075
+ if (/*compassEnable*/ ctx[8]) {
3026
3076
  if (if_block) {
3027
3077
  if_block.p(ctx, dirty);
3028
3078
 
3029
- if (dirty & /*compassEnable*/ 128) {
3079
+ if (dirty & /*compassEnable*/ 256) {
3030
3080
  internal.transition_in(if_block, 1);
3031
3081
  }
3032
3082
  } else {
@@ -3054,7 +3104,7 @@ function create_if_block(ctx) {
3054
3104
  if (!div_intro) {
3055
3105
  internal.add_render_callback(() => {
3056
3106
  div_intro = internal.create_in_transition(div, transition.fade, {
3057
- duration: /*duration*/ ctx[2],
3107
+ duration: /*duration*/ ctx[3],
3058
3108
  easing: easing.linear
3059
3109
  });
3060
3110
 
@@ -3079,13 +3129,16 @@ function create_if_block(ctx) {
3079
3129
  };
3080
3130
  }
3081
3131
 
3082
- // (39:4) {#if compassEnable}
3132
+ // (40:4) {#if compassEnable}
3083
3133
  function create_if_block_1(ctx) {
3084
3134
  let compass;
3085
3135
  let current;
3086
3136
 
3087
3137
  compass = new Compass({
3088
- props: { floorplanData: /*floorplanData*/ ctx[10] }
3138
+ props: {
3139
+ floorplanData: /*floorplanData*/ ctx[11],
3140
+ northDesc: /*northDesc*/ ctx[0]
3141
+ }
3089
3142
  });
3090
3143
 
3091
3144
  return {
@@ -3098,7 +3151,8 @@ function create_if_block_1(ctx) {
3098
3151
  },
3099
3152
  p(ctx, dirty) {
3100
3153
  const compass_changes = {};
3101
- if (dirty & /*floorplanData*/ 1024) compass_changes.floorplanData = /*floorplanData*/ ctx[10];
3154
+ if (dirty & /*floorplanData*/ 2048) compass_changes.floorplanData = /*floorplanData*/ ctx[11];
3155
+ if (dirty & /*northDesc*/ 1) compass_changes.northDesc = /*northDesc*/ ctx[0];
3102
3156
  compass.$set(compass_changes);
3103
3157
  },
3104
3158
  i(local) {
@@ -3119,7 +3173,7 @@ function create_if_block_1(ctx) {
3119
3173
  function create_fragment(ctx) {
3120
3174
  let if_block_anchor;
3121
3175
  let current;
3122
- let if_block = /*visible*/ ctx[3] && create_if_block(ctx);
3176
+ let if_block = /*visible*/ ctx[4] && create_if_block(ctx);
3123
3177
 
3124
3178
  return {
3125
3179
  c() {
@@ -3132,11 +3186,11 @@ function create_fragment(ctx) {
3132
3186
  current = true;
3133
3187
  },
3134
3188
  p(ctx, [dirty]) {
3135
- if (/*visible*/ ctx[3]) {
3189
+ if (/*visible*/ ctx[4]) {
3136
3190
  if (if_block) {
3137
3191
  if_block.p(ctx, dirty);
3138
3192
 
3139
- if (dirty & /*visible*/ 8) {
3193
+ if (dirty & /*visible*/ 16) {
3140
3194
  internal.transition_in(if_block, 1);
3141
3195
  }
3142
3196
  } else {
@@ -3172,6 +3226,7 @@ function create_fragment(ctx) {
3172
3226
  }
3173
3227
 
3174
3228
  function instance($$self, $$props, $$invalidate) {
3229
+ let { northDesc } = $$props;
3175
3230
  let { pxmm } = $$props;
3176
3231
  let { five } = $$props;
3177
3232
  let { duration = 0 } = $$props;
@@ -3189,24 +3244,26 @@ function instance($$self, $$props, $$invalidate) {
3189
3244
  let { getLabelElement } = $$props;
3190
3245
 
3191
3246
  $$self.$$set = $$props => {
3192
- if ('pxmm' in $$props) $$invalidate(0, pxmm = $$props.pxmm);
3193
- if ('five' in $$props) $$invalidate(1, five = $$props.five);
3194
- if ('duration' in $$props) $$invalidate(2, duration = $$props.duration);
3195
- if ('visible' in $$props) $$invalidate(3, visible = $$props.visible);
3196
- if ('panoIndex' in $$props) $$invalidate(4, panoIndex = $$props.panoIndex);
3197
- if ('floorIndex' in $$props) $$invalidate(5, floorIndex = $$props.floorIndex);
3198
- if ('hoverEnable' in $$props) $$invalidate(6, hoverEnable = $$props.hoverEnable);
3199
- if ('compassEnable' in $$props) $$invalidate(7, compassEnable = $$props.compassEnable);
3200
- if ('roomLabelsEnable' in $$props) $$invalidate(8, roomLabelsEnable = $$props.roomLabelsEnable);
3201
- if ('ruleLabelsEnable' in $$props) $$invalidate(9, ruleLabelsEnable = $$props.ruleLabelsEnable);
3202
- if ('floorplanData' in $$props) $$invalidate(10, floorplanData = $$props.floorplanData);
3203
- if ('lastPanoramaLongitude' in $$props) $$invalidate(11, lastPanoramaLongitude = $$props.lastPanoramaLongitude);
3204
- if ('cameraImageUrl' in $$props) $$invalidate(12, cameraImageUrl = $$props.cameraImageUrl);
3205
- if ('onRoomHeightClick' in $$props) $$invalidate(13, onRoomHeightClick = $$props.onRoomHeightClick);
3206
- if ('getLabelElement' in $$props) $$invalidate(14, getLabelElement = $$props.getLabelElement);
3247
+ if ('northDesc' in $$props) $$invalidate(0, northDesc = $$props.northDesc);
3248
+ if ('pxmm' in $$props) $$invalidate(1, pxmm = $$props.pxmm);
3249
+ if ('five' in $$props) $$invalidate(2, five = $$props.five);
3250
+ if ('duration' in $$props) $$invalidate(3, duration = $$props.duration);
3251
+ if ('visible' in $$props) $$invalidate(4, visible = $$props.visible);
3252
+ if ('panoIndex' in $$props) $$invalidate(5, panoIndex = $$props.panoIndex);
3253
+ if ('floorIndex' in $$props) $$invalidate(6, floorIndex = $$props.floorIndex);
3254
+ if ('hoverEnable' in $$props) $$invalidate(7, hoverEnable = $$props.hoverEnable);
3255
+ if ('compassEnable' in $$props) $$invalidate(8, compassEnable = $$props.compassEnable);
3256
+ if ('roomLabelsEnable' in $$props) $$invalidate(9, roomLabelsEnable = $$props.roomLabelsEnable);
3257
+ if ('ruleLabelsEnable' in $$props) $$invalidate(10, ruleLabelsEnable = $$props.ruleLabelsEnable);
3258
+ if ('floorplanData' in $$props) $$invalidate(11, floorplanData = $$props.floorplanData);
3259
+ if ('lastPanoramaLongitude' in $$props) $$invalidate(12, lastPanoramaLongitude = $$props.lastPanoramaLongitude);
3260
+ if ('cameraImageUrl' in $$props) $$invalidate(13, cameraImageUrl = $$props.cameraImageUrl);
3261
+ if ('onRoomHeightClick' in $$props) $$invalidate(14, onRoomHeightClick = $$props.onRoomHeightClick);
3262
+ if ('getLabelElement' in $$props) $$invalidate(15, getLabelElement = $$props.getLabelElement);
3207
3263
  };
3208
3264
 
3209
3265
  return [
3266
+ northDesc,
3210
3267
  pxmm,
3211
3268
  five,
3212
3269
  duration,
@@ -3236,21 +3293,22 @@ class Main extends internal.SvelteComponent {
3236
3293
  create_fragment,
3237
3294
  internal.safe_not_equal,
3238
3295
  {
3239
- pxmm: 0,
3240
- five: 1,
3241
- duration: 2,
3242
- visible: 3,
3243
- panoIndex: 4,
3244
- floorIndex: 5,
3245
- hoverEnable: 6,
3246
- compassEnable: 7,
3247
- roomLabelsEnable: 8,
3248
- ruleLabelsEnable: 9,
3249
- floorplanData: 10,
3250
- lastPanoramaLongitude: 11,
3251
- cameraImageUrl: 12,
3252
- onRoomHeightClick: 13,
3253
- getLabelElement: 14
3296
+ northDesc: 0,
3297
+ pxmm: 1,
3298
+ five: 2,
3299
+ duration: 3,
3300
+ visible: 4,
3301
+ panoIndex: 5,
3302
+ floorIndex: 6,
3303
+ hoverEnable: 7,
3304
+ compassEnable: 8,
3305
+ roomLabelsEnable: 9,
3306
+ ruleLabelsEnable: 10,
3307
+ floorplanData: 11,
3308
+ lastPanoramaLongitude: 12,
3309
+ cameraImageUrl: 13,
3310
+ onRoomHeightClick: 14,
3311
+ getLabelElement: 15
3254
3312
  },
3255
3313
  add_css
3256
3314
  );
@@ -3274,20 +3332,217 @@ function changeModelCanvasOpacity(five, opacity, duration = 300) {
3274
3332
  }
3275
3333
 
3276
3334
  class TopviewFloorplanPluginController {
3277
- size = { width: 0, height: 0 };
3278
- visible = false;
3279
- pxmm = 0;
3280
- app;
3281
- five;
3282
- panoIndex = 0;
3283
- floorIndex = 0;
3284
- configs = {};
3285
- lastPanoramaLongitude = 0;
3286
- selector;
3287
- floorplanData;
3288
- wrapper;
3289
- container = document.createElement('div');
3290
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
+ });
3291
3546
  this.five = five;
3292
3547
  this.selector = params.selector;
3293
3548
  this.configs = omit(params, ['selector']);
@@ -3303,10 +3558,12 @@ class TopviewFloorplanPluginController {
3303
3558
  this.five.on('modelShownFloorChange', this.onModelShownFloorChange);
3304
3559
  }
3305
3560
  /** 加载户型图数据 */
3306
- async load(data) {
3307
- const copyData = JSON.parse(JSON.stringify(data));
3308
- this.floorplanData = await formatData(copyData);
3309
- 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
+ });
3310
3567
  }
3311
3568
  /** 把插件的渲染DOM插入到对应的容器中去 */
3312
3569
  appendTo(wrapper) {
@@ -3314,69 +3571,6 @@ class TopviewFloorplanPluginController {
3314
3571
  wrapper.appendChild(this.container);
3315
3572
  return this;
3316
3573
  }
3317
- dispose = () => {
3318
- this.hide();
3319
- this.container?.remove();
3320
- this.app?.$destroy();
3321
- this.five.off('modeChange', this.handleModeChange);
3322
- this.five.off('panoArrived', this.handlePanoArrived);
3323
- this.five.off('modelLoaded', this.handleModelLoaded);
3324
- this.five.off('wantsMoveToPano', this.handleWantsMoveToPano);
3325
- this.five.off('wantsPanGesture', this.handleWantsPanGesture);
3326
- this.five.off('initAnimationEnded', this.handleInitAnimationEnded);
3327
- this.five.off('modelShownFloorChange', this.onModelShownFloorChange);
3328
- };
3329
- /** 模型楼层高亮改变时,自动进行楼层切换 */
3330
- onModelShownFloorChange = (shownFloor) => {
3331
- if (shownFloor === null)
3332
- return;
3333
- this.floorIndex = shownFloor;
3334
- this.updateSize();
3335
- this.render();
3336
- };
3337
- /** panoIndex 改变时,更新 floorIndex */
3338
- handlePanoArrived = (index) => {
3339
- if (!this.five?.work)
3340
- return;
3341
- this.panoIndex = index;
3342
- this.floorIndex = this.five.work.observers[index].floorIndex;
3343
- };
3344
- /** 配置了 preventRoomClick 后,在户型图展示时阻止 Five 走点 */
3345
- handleWantsMoveToPano = () => {
3346
- if (!this.visible)
3347
- return;
3348
- if (this.configs.preventRoomClick)
3349
- return false;
3350
- return;
3351
- };
3352
- /** 在户型图展示时阻止 Five 滑动行为 */
3353
- handleWantsPanGesture = () => {
3354
- if (!this.visible)
3355
- return;
3356
- return false;
3357
- };
3358
- handleModelLoaded = () => {
3359
- if (this.wrapper)
3360
- return;
3361
- if (!this.selector)
3362
- return;
3363
- const wrapper = this.selector instanceof Element ? this.selector : document.querySelector(this.selector);
3364
- if (!wrapper)
3365
- throw new Error('不正确的父容器选择器');
3366
- this.wrapper = wrapper;
3367
- wrapper.append(this.container);
3368
- };
3369
- /** 非 Topview 态隐藏户型图 */
3370
- handleModeChange = (mode) => {
3371
- if (mode !== 'Topview')
3372
- return this.hide();
3373
- };
3374
- /** 动画结束后是 Topview 态就展示户型图 */
3375
- handleInitAnimationEnded = () => {
3376
- const { mode } = this.five.getCurrentState();
3377
- if (mode === 'Topview')
3378
- this.show();
3379
- };
3380
3574
  show() {
3381
3575
  this.visible = true;
3382
3576
  this.five.model.show(this.floorIndex);
@@ -3399,48 +3593,27 @@ class TopviewFloorplanPluginController {
3399
3593
  this.five.on('wantsMoveToPano', this.handleWantsMoveToPano);
3400
3594
  this.five.on('wantsPanGesture', this.handleWantsPanGesture);
3401
3595
  }
3402
- /** 更新户型图大小 */
3403
- updateSize = () => {
3404
- if (!this.floorplanData)
3405
- return;
3406
- if (!this.container || !this.wrapper)
3407
- return;
3408
- if (this.five.getCurrentState().mode !== 'Topview')
3409
- return;
3410
- // 计算户型图展示大小
3411
- const { min, max } = this.floorplanData.bounding;
3412
- const width = max.x - min.x;
3413
- const height = max.y - min.y;
3414
- // 每毫米对应的 px 值
3415
- const options = this.configs.attachedTo ? { attachedTo: this.configs.attachedTo } : undefined;
3416
- const pxmm = getPxmm(this.five, this.wrapper, this.floorIndex, options);
3417
- const _width = Math.ceil(width * pxmm);
3418
- const _height = Math.ceil(height * pxmm);
3419
- this.pxmm = pxmm;
3420
- this.size = { width: _width, height: _height };
3421
- this.container.style.width = _width + 'px';
3422
- this.container.style.height = _height + 'px';
3423
- };
3424
3596
  render(duration) {
3425
3597
  if (!this.container || !this.floorplanData)
3426
3598
  return;
3427
3599
  if (this.size.width === 0)
3428
3600
  return;
3429
- const { getLabelElement, cameraImageUrl, preventRoomClick, hoverEnable, compassEnable, roomLabelsEnable, ruleLabelsEnable, } = this.configs;
3601
+ const { northDesc, getLabelElement, cameraImageUrl, preventRoomClick, hoverEnable, compassEnable, roomLabelsEnable, ruleLabelsEnable, } = this.configs;
3430
3602
  const handleClick = preventRoomClick ? () => false : undefined;
3431
3603
  const props = {
3604
+ northDesc: northDesc !== null && northDesc !== void 0 ? northDesc : '北',
3432
3605
  five: this.five,
3433
3606
  pxmm: this.pxmm,
3434
3607
  cameraImageUrl,
3435
3608
  visible: this.visible,
3436
- duration: duration ?? 0,
3609
+ duration: duration !== null && duration !== void 0 ? duration : 0,
3437
3610
  panoIndex: this.panoIndex,
3438
3611
  floorIndex: this.floorIndex,
3439
3612
  floorplanData: this.floorplanData,
3440
- hoverEnable: hoverEnable ?? false,
3441
- compassEnable: compassEnable ?? true,
3442
- ruleLabelsEnable: ruleLabelsEnable ?? true,
3443
- 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,
3444
3617
  lastPanoramaLongitude: this.lastPanoramaLongitude,
3445
3618
  getLabelElement,
3446
3619
  onRoomHeightClick: handleClick,