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

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 (122) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +78 -28
  3. package/dist/CSS3DRenderPlugin/index.js +17 -14
  4. package/dist/CameraMovementPlugin/index.js +40 -15
  5. package/dist/ModelChassisCompassPlugin/index.js +32 -6
  6. package/dist/ModelEntryDoorGuidePlugin/index.js +48 -18
  7. package/dist/ModelItemLabelPlugin/index.js +81 -95
  8. package/dist/ModelRoomLabelPlugin/index.js +67 -26
  9. package/dist/ModelTVVideoPlugin/index.d.ts +4 -0
  10. package/dist/ModelTVVideoPlugin/index.js +326 -0
  11. package/dist/ModelTVVideoPlugin/typings.d.ts +25 -0
  12. package/dist/ModelTVVideoPlugin/utils/parseData.d.ts +2 -0
  13. package/dist/PanoCompassPlugin/index.js +311 -164
  14. package/dist/PanoCursorRaycasterPlugin/index.js +5 -3
  15. package/dist/PanoMeasurePlugin/index.js +1335 -581
  16. package/dist/PanoRulerPlugin/index.js +32 -5
  17. package/dist/PanoSpatialTagPlugin/index.js +64 -29
  18. package/dist/floorplan/ModelFloorplanPlugin/index.js +586 -362
  19. package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +164 -72
  20. package/dist/floorplan/TopviewFloorplanPlugin/index.js +311 -153
  21. package/dist/index.d.ts +3 -0
  22. package/dist/index.es.js +2999 -1419
  23. package/dist/index.js +3003 -1422
  24. package/dist/index.umd.js +3003 -1422
  25. package/docs/assets/search.js +1 -1
  26. package/docs/classes/ModelRoomLabelController.html +6 -6
  27. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  28. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  29. package/docs/index.html +78 -33
  30. package/docs/interfaces/LineJson.html +1 -1
  31. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  32. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  33. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  34. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  35. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  36. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  37. package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
  38. package/docs/interfaces/ModelItemLabelPluginData.html +1 -0
  39. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -0
  40. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -0
  41. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  42. package/docs/interfaces/ModelTVVideoPluginData.html +1 -0
  43. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -0
  44. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -0
  45. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  46. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  47. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  48. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  49. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  50. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  51. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  52. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  53. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  54. package/docs/interfaces/PointJson.html +1 -1
  55. package/docs/interfaces/RoomLabel.html +7 -7
  56. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
  57. package/docs/modules.html +12 -12
  58. package/libs/CSS3DRenderPlugin/index.js +16 -13
  59. package/libs/CameraMovementPlugin/index.js +24 -15
  60. package/libs/ModelChassisCompassPlugin/index.js +14 -5
  61. package/libs/ModelEntryDoorGuidePlugin/index.js +24 -12
  62. package/libs/ModelItemLabelPlugin/ItemLabelComponent.js +54 -67
  63. package/libs/ModelItemLabelPlugin/index.js +8 -59
  64. package/libs/ModelItemLabelPlugin/utils/parseData.js +1 -4
  65. package/libs/ModelRoomLabelPlugin/Controller.js +64 -23
  66. package/libs/ModelRoomLabelPlugin/RoomLabelItems.js +3 -3
  67. package/libs/ModelTVVideoPlugin/index.d.ts +4 -0
  68. package/libs/ModelTVVideoPlugin/index.js +263 -0
  69. package/libs/ModelTVVideoPlugin/typings.d.ts +25 -0
  70. package/libs/ModelTVVideoPlugin/typings.js +7 -0
  71. package/libs/ModelTVVideoPlugin/utils/parseData.d.ts +2 -0
  72. package/libs/ModelTVVideoPlugin/utils/parseData.js +13 -0
  73. package/libs/PanoCompassPlugin/index.js +225 -128
  74. package/libs/PanoCursorRaycasterPlugin/index.js +5 -3
  75. package/libs/PanoMeasurePlugin/Controller/BaseController.js +68 -13
  76. package/libs/PanoMeasurePlugin/Controller/EditController.js +267 -154
  77. package/libs/PanoMeasurePlugin/Controller/ShortcutKeyController.js +40 -20
  78. package/libs/PanoMeasurePlugin/Controller/WatchController.js +234 -152
  79. package/libs/PanoMeasurePlugin/Controller/index.js +131 -47
  80. package/libs/PanoMeasurePlugin/Model/index.js +30 -5
  81. package/libs/PanoMeasurePlugin/Model/line.js +60 -10
  82. package/libs/PanoMeasurePlugin/Model/point.js +24 -4
  83. package/libs/PanoMeasurePlugin/Model/polyline.js +20 -3
  84. package/libs/PanoMeasurePlugin/Modules/DeleteDom/index.js +59 -14
  85. package/libs/PanoMeasurePlugin/Modules/FiveHelper.js +23 -8
  86. package/libs/PanoMeasurePlugin/Modules/GuideController.js +61 -26
  87. package/libs/PanoMeasurePlugin/Modules/Magnifier.js +60 -10
  88. package/libs/PanoMeasurePlugin/Modules/UIController/MainBtnController.js +83 -37
  89. package/libs/PanoMeasurePlugin/Modules/UIController/Revoke/index.js +52 -17
  90. package/libs/PanoMeasurePlugin/Modules/UIController/index.js +61 -30
  91. package/libs/PanoMeasurePlugin/utils/distanceDom.js +3 -2
  92. package/libs/PanoMeasurePlugin/utils/line.js +8 -7
  93. package/libs/PanoRulerPlugin/index.js +16 -5
  94. package/libs/PanoSpatialTagPlugin/index.js +11 -9
  95. package/libs/floorplan/Components/BaseImage.js +10 -5
  96. package/libs/floorplan/Components/RoomHighlight/RoomHighlight.js +3 -1
  97. package/libs/floorplan/Components/RoomMaterials/RoomMaterial.js +5 -6
  98. package/libs/floorplan/ModelFloorplanPlugin/Components/Compass.js +7 -2
  99. package/libs/floorplan/ModelFloorplanPlugin/Components/RoomLabels/RoomLabel.js +3 -1
  100. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +456 -273
  101. package/libs/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +33 -22
  102. package/libs/floorplan/PanoFloorplanRadarPlugin/Components/CurrentFloor/CurrentFloor.js +3 -1
  103. package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +97 -36
  104. package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +231 -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 +3 -0
  108. package/libs/index.js +1 -1
  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 -1
@@ -149,6 +149,21 @@ class ItemLabelItem extends internal.SvelteComponent {
149
149
  }
150
150
  }
151
151
 
152
+ /**
153
+ * 创建一个防抖动函数,该函数会在 wait 毫秒后调用 func 方法
154
+ * @param func - 要防抖动的函数
155
+ * @param [wait=0] - 需要延迟的毫秒数
156
+ */
157
+ function debounce(func, wait = 200) {
158
+ let last;
159
+ return function (...args) {
160
+ clearTimeout(last);
161
+ last = setTimeout(() => {
162
+ func(...args);
163
+ }, wait);
164
+ };
165
+ }
166
+
152
167
  /* src/ModelItemLabelPlugin/ItemLabelComponent.svelte generated by Svelte v3.47.0 */
153
168
 
154
169
  function add_css(target) {
@@ -157,11 +172,11 @@ function add_css(target) {
157
172
 
158
173
  function get_each_context(ctx, list, i) {
159
174
  const child_ctx = ctx.slice();
160
- child_ctx[26] = list[i];
175
+ child_ctx[27] = list[i];
161
176
  return child_ctx;
162
177
  }
163
178
 
164
- // (179:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
179
+ // (159:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
165
180
  function create_each_block(key_1, ctx) {
166
181
  let first;
167
182
  let itemlabelitem;
@@ -169,7 +184,7 @@ function create_each_block(key_1, ctx) {
169
184
 
170
185
  itemlabelitem = new ItemLabelItem({
171
186
  props: {
172
- itemLabel: /*itemLabelItem*/ ctx[26],
187
+ itemLabel: /*itemLabelItem*/ ctx[27],
173
188
  hooks: /*hooks*/ ctx[0]
174
189
  }
175
190
  });
@@ -190,7 +205,7 @@ function create_each_block(key_1, ctx) {
190
205
  p(new_ctx, dirty) {
191
206
  ctx = new_ctx;
192
207
  const itemlabelitem_changes = {};
193
- if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[26];
208
+ if (dirty & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[27];
194
209
  if (dirty & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
195
210
  itemlabelitem.$set(itemlabelitem_changes);
196
211
  },
@@ -217,7 +232,7 @@ function create_fragment(ctx) {
217
232
  let div_resize_listener;
218
233
  let current;
219
234
  let each_value = /*renderItemLabels*/ ctx[1];
220
- const get_key = ctx => /*itemLabelItem*/ ctx[26].id;
235
+ const get_key = ctx => /*itemLabelItem*/ ctx[27].id;
221
236
 
222
237
  for (let i = 0; i < each_value.length; i += 1) {
223
238
  let child_ctx = get_each_context(ctx, each_value, i);
@@ -234,7 +249,8 @@ function create_fragment(ctx) {
234
249
  }
235
250
 
236
251
  internal.attr(div, "class", "item-labels-container svelte-rmdeb");
237
- internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[9].call(div));
252
+ internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[10].call(div));
253
+ internal.set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
238
254
  },
239
255
  m(target, anchor) {
240
256
  internal.insert(target, div, anchor);
@@ -243,7 +259,7 @@ function create_fragment(ctx) {
243
259
  each_blocks[i].m(div, null);
244
260
  }
245
261
 
246
- div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[9].bind(div));
262
+ div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[10].bind(div));
247
263
  current = true;
248
264
  },
249
265
  p(ctx, [dirty]) {
@@ -253,6 +269,10 @@ function create_fragment(ctx) {
253
269
  each_blocks = internal.update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, internal.outro_and_destroy_block, create_each_block, null, get_each_context);
254
270
  internal.check_outros();
255
271
  }
272
+
273
+ if (dirty & /*itemsVisible*/ 16) {
274
+ internal.set_style(div, "opacity", /*itemsVisible*/ ctx[4] ? 1 : 0, false);
275
+ }
256
276
  },
257
277
  i(local) {
258
278
  if (current) return;
@@ -302,6 +322,14 @@ function instance($$self, $$props, $$invalidate) {
302
322
  // 计算重叠
303
323
  let cssOffsetLists = [];
304
324
 
325
+ // 动画过程中 itemsVisible 为 false
326
+ let itemsVisible = true;
327
+
328
+ /**
329
+ * 可见性策略:
330
+ * 1、当前楼层(假设先不考虑多楼层)
331
+ * 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
332
+ * */
305
333
  const getLabelVisible = (five, itemLabel) => {
306
334
  // 虚拟 VR 仅有一层,不考虑楼层信息
307
335
  const raycaster = new Raycaster();
@@ -321,8 +349,15 @@ function instance($$self, $$props, $$invalidate) {
321
349
  const getLabelCssOffset = (five, itemLabel) => {
322
350
  const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
323
351
  const cssPosition = five.project2d(modelPosition);
324
- const xOffset = cssPosition?.x;
325
- const yOffset = cssPosition?.y;
352
+
353
+ const xOffset = cssPosition === null || cssPosition === void 0
354
+ ? void 0
355
+ : cssPosition.x;
356
+
357
+ const yOffset = cssPosition === null || cssPosition === void 0
358
+ ? void 0
359
+ : cssPosition.y;
360
+
326
361
  return [xOffset, yOffset];
327
362
  };
328
363
 
@@ -364,18 +399,13 @@ function instance($$self, $$props, $$invalidate) {
364
399
  : true;
365
400
 
366
401
  const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth);
367
- if (!visible) return { ...label, visible };
402
+ if (!visible) return Object.assign(Object.assign({}, label), { visible });
368
403
  cssOffsetLists.push(cssOffset);
369
404
 
370
405
  // position
371
406
  const transform = getLabelTransform(cssOffset);
372
407
 
373
- return {
374
- ...label,
375
- visible,
376
- transform,
377
- strokeLength
378
- };
408
+ return Object.assign(Object.assign({}, label), { visible, transform, strokeLength });
379
409
  });
380
410
 
381
411
  const sortedItemLabelItems = newLabels.filter(({ visible }) => visible).map(label => ({
@@ -385,7 +415,7 @@ function instance($$self, $$props, $$invalidate) {
385
415
 
386
416
  return newLabels.map(label => {
387
417
  const sortIndex = sortedItemLabelItems.findIndex(item => item.itemLabelItem.id === label.id);
388
- if (sortIndex !== undefined) return { ...label, zIndex: sortIndex * 10 };
418
+ if (sortIndex !== undefined) return Object.assign(Object.assign({}, label), { zIndex: sortIndex * 10 });
389
419
  return label;
390
420
  });
391
421
  };
@@ -403,11 +433,22 @@ function instance($$self, $$props, $$invalidate) {
403
433
  $$invalidate(1, renderItemLabels = itemLabels);
404
434
  curItemLabels = itemLabels;
405
435
  onItemLabelUpdate();
406
-
407
- // five.on('cameraUpdate', onItemLabelUpdate)
408
436
  addResizeListener();
437
+
438
+ five.on('cameraUpdate', () => {
439
+ $$invalidate(4, itemsVisible = false);
440
+ handleCameraUpdate();
441
+ });
409
442
  });
410
443
 
444
+ const handleCameraUpdate = debounce(
445
+ () => {
446
+ $$invalidate(4, itemsVisible = true);
447
+ onItemLabelUpdate();
448
+ },
449
+ 300
450
+ );
451
+
411
452
  const addResizeListener = () => {
412
453
  wrapperSize = {
413
454
  width: wrapper.clientWidth,
@@ -421,7 +462,6 @@ function instance($$self, $$props, $$invalidate) {
421
462
  if (curItemLabels !== itemLabels) {
422
463
  $$invalidate(1, renderItemLabels = itemLabels);
423
464
  curItemLabels = itemLabels;
424
- console.log('--debug--update--');
425
465
  onItemLabelUpdate();
426
466
  }
427
467
  };
@@ -439,9 +479,8 @@ function instance($$self, $$props, $$invalidate) {
439
479
  });
440
480
 
441
481
  svelte.onDestroy(() => {
442
- // five.off('cameraUpdate', onItemLabelUpdate)
482
+ five.off('cameraUpdate');
443
483
  resizeObserver.unobserve(wrapper);
444
-
445
484
  curItemLabels = null;
446
485
  $$invalidate(1, renderItemLabels = null);
447
486
  wrapperSize = { width: 0, height: 0 };
@@ -455,12 +494,12 @@ function instance($$self, $$props, $$invalidate) {
455
494
  }
456
495
 
457
496
  $$self.$$set = $$props => {
458
- if ('five' in $$props) $$invalidate(4, five = $$props.five);
459
- if ('modelOcclusionEnable' in $$props) $$invalidate(5, modelOcclusionEnable = $$props.modelOcclusionEnable);
460
- if ('itemLabels' in $$props) $$invalidate(6, itemLabels = $$props.itemLabels);
461
- if ('wrapper' in $$props) $$invalidate(7, wrapper = $$props.wrapper);
497
+ if ('five' in $$props) $$invalidate(5, five = $$props.five);
498
+ if ('modelOcclusionEnable' in $$props) $$invalidate(6, modelOcclusionEnable = $$props.modelOcclusionEnable);
499
+ if ('itemLabels' in $$props) $$invalidate(7, itemLabels = $$props.itemLabels);
500
+ if ('wrapper' in $$props) $$invalidate(8, wrapper = $$props.wrapper);
462
501
  if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
463
- if ('displayStrategyType' in $$props) $$invalidate(8, displayStrategyType = $$props.displayStrategyType);
502
+ if ('displayStrategyType' in $$props) $$invalidate(9, displayStrategyType = $$props.displayStrategyType);
464
503
  };
465
504
 
466
505
  return [
@@ -468,6 +507,7 @@ function instance($$self, $$props, $$invalidate) {
468
507
  renderItemLabels,
469
508
  containerWidth,
470
509
  containerHeight,
510
+ itemsVisible,
471
511
  five,
472
512
  modelOcclusionEnable,
473
513
  itemLabels,
@@ -488,12 +528,12 @@ class ItemLabelComponent extends internal.SvelteComponent {
488
528
  create_fragment,
489
529
  internal.safe_not_equal,
490
530
  {
491
- five: 4,
492
- modelOcclusionEnable: 5,
493
- itemLabels: 6,
494
- wrapper: 7,
531
+ five: 5,
532
+ modelOcclusionEnable: 6,
533
+ itemLabels: 7,
534
+ wrapper: 8,
495
535
  hooks: 0,
496
- displayStrategyType: 8
536
+ displayStrategyType: 9
497
537
  },
498
538
  add_css
499
539
  );
@@ -502,13 +542,11 @@ class ItemLabelComponent extends internal.SvelteComponent {
502
542
 
503
543
  /** @description 转成内部所需数据 */
504
544
  function parseModelItemLabelPluginData(data) {
505
- return data.model_item_labels.map(label => ({
506
- modelPosition: [label.position[0], label.position[1] + label.size[1], label.position[2]],
507
- ...label
508
- }));
545
+ return data.model_item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1] + label.size[1], label.position[2]] }, label)));
509
546
  }
510
547
 
511
548
  const ModelItemLabelPlugin = (five$1, params) => {
549
+ var _a, _b;
512
550
  const pluginState = {
513
551
  container: document.createElement('div'),
514
552
  data: null,
@@ -518,8 +556,8 @@ const ModelItemLabelPlugin = (five$1, params) => {
518
556
  wrapper: null,
519
557
  app: undefined,
520
558
  hooks: new five.Subscribe(),
521
- modelOcclusionEnable: params?.modelOcclusionEnable ?? true,
522
- displayStrategyType: params?.displayStrategyType ?? DISPLAY_STRATEGY_TYPE.SMALL
559
+ modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
560
+ displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL,
523
561
  };
524
562
  pluginState.container.setAttribute('class', 'model-item-label-plugin-container');
525
563
  pluginState.container.style.cssText = `
@@ -528,8 +566,8 @@ const ModelItemLabelPlugin = (five$1, params) => {
528
566
  top: 0;
529
567
  width: 100%;
530
568
  height: 100%;
531
- pointerEvents: none;
532
569
  `;
570
+ pluginState.container.style.pointerEvents = 'none'; // 写到 cssText 里不生效
533
571
  const appendTo = (wrapper) => {
534
572
  pluginState.wrapper = wrapper;
535
573
  wrapper.appendChild(pluginState.container);
@@ -537,7 +575,6 @@ const ModelItemLabelPlugin = (five$1, params) => {
537
575
  return true;
538
576
  };
539
577
  const load = (data) => {
540
- console.log('🐶--当前标签总条数: ', data.model_item_labels.length);
541
578
  pluginState.itemLabels = parseModelItemLabelPluginData(data);
542
579
  render();
543
580
  };
@@ -559,46 +596,13 @@ const ModelItemLabelPlugin = (five$1, params) => {
559
596
  removeListener4Five();
560
597
  pluginState.container.remove();
561
598
  };
562
- const handleRerender = () => {
563
- if (!pluginState.enabled || !pluginState.fiveModeEnabled)
564
- return;
565
- disable();
566
- };
567
- const rerender = (a, b, c) => {
568
- if (!pluginState.fiveModeEnabled)
569
- return;
570
- if (!c)
571
- return;
572
- enable();
573
- render();
574
- };
575
- const handleInteriaPanRerender = (a, b) => {
576
- if (!pluginState.fiveModeEnabled)
577
- return;
578
- if (!b)
579
- return;
580
- enable();
581
- render();
582
- };
583
- const handleWantsPanGesture = (pose, final) => {
584
- if (pose) {
585
- handleRerender();
586
- }
587
- };
588
- const handlePanGesture = (pose, final) => {
589
- if (!pluginState.fiveModeEnabled)
590
- return;
591
- if (!final)
592
- return;
593
- enable();
594
- render();
595
- };
596
599
  const render = () => {
600
+ var _a;
597
601
  if (!pluginState.wrapper)
598
602
  return;
599
603
  // 只要不可展示,销毁容器
600
604
  if (!pluginState.enabled || !pluginState.fiveModeEnabled) {
601
- pluginState.app?.$destroy();
605
+ (_a = pluginState.app) === null || _a === void 0 ? void 0 : _a.$destroy();
602
606
  pluginState.app = undefined;
603
607
  return;
604
608
  }
@@ -627,32 +631,14 @@ const ModelItemLabelPlugin = (five$1, params) => {
627
631
  const addListener4Five = () => {
628
632
  five$1.on('modeChange', onFiveModeChange);
629
633
  five$1.once('dispose', dispose);
630
- // five.on('wantsGesture', handleRerender)
631
- // five.on('gesture', rerender)
632
- five$1.on('wantsMouseWheel', handleRerender);
633
- five$1.on('mouseWheel', rerender);
634
- five$1.on('wantsInteriaPan', handleRerender);
635
- five$1.on('interiaPan', handleInteriaPanRerender);
636
- five$1.on('wantsPanGesture', handleWantsPanGesture);
637
- five$1.on('panGesture', handlePanGesture);
638
- five$1.on('wantsPinchGesture', handleRerender);
639
- five$1.on('pinchGesture', rerender);
640
634
  };
641
635
  // 取消 five 监听
642
636
  const removeListener4Five = () => {
643
637
  five$1.off('modeChange', onFiveModeChange);
644
- // five.off('wantsGesture', handleRerender)
645
- // five.off('gesture', rerender)
646
- five$1.off('wantsMouseWheel', handleRerender);
647
- five$1.off('mouseWheel', rerender);
648
- five$1.off('wantsInteriaPan', handleRerender);
649
- five$1.off('interiaPan', handleInteriaPanRerender);
650
- five$1.off('wantsPanGesture', handleWantsPanGesture);
651
- five$1.off('panGesture', handlePanGesture);
652
- five$1.off('wantsPinchGesture', handleRerender);
653
- five$1.off('pinchGesture', rerender);
654
638
  };
655
639
  const onFiveModeChange = (mode) => {
640
+ if (!pluginState.enabled)
641
+ return;
656
642
  if (mode !== five.Five.Mode.Floorplan) {
657
643
  pluginState.fiveModeEnabled = false;
658
644
  render();
@@ -278,12 +278,12 @@ function instance($$self, $$props, $$invalidate) {
278
278
  // 计算是否可见,如果不可见,不会更新位置
279
279
  const visible = getLabelVisible(five, roomLabelItem);
280
280
 
281
- if (!visible) return { ...roomLabelItem, visible };
281
+ if (!visible) return Object.assign(Object.assign({}, roomLabelItem), { visible });
282
282
 
283
283
  // 更新位置
284
284
  const transform = getLabelTransform(five, roomLabelItem);
285
285
 
286
- return { ...roomLabelItem, visible, transform };
286
+ return Object.assign(Object.assign({}, roomLabelItem), { visible, transform });
287
287
  });
288
288
 
289
289
  const sortedRoomLabelItems = newLabels.filter(({ visible }) => visible).map(roomLabelItem => ({
@@ -293,7 +293,7 @@ function instance($$self, $$props, $$invalidate) {
293
293
 
294
294
  return newLabels.map(roomLabelItem => {
295
295
  const sortIndex = sortedRoomLabelItems.findIndex(item => item.roomLabelItem.id === roomLabelItem.id);
296
- if (sortIndex !== undefined) return { ...roomLabelItem, zIndex: sortIndex * 10 };
296
+ if (sortIndex !== undefined) return Object.assign(Object.assign({}, roomLabelItem), { zIndex: sortIndex * 10 });
297
297
  return roomLabelItem;
298
298
  });
299
299
  }
@@ -352,14 +352,69 @@ function parseModelRoomLabelPluginData(data) {
352
352
  }
353
353
 
354
354
  class ModelRoomLabelController {
355
- five;
356
- enabled = true;
357
- fiveModeEnabled;
358
- app = undefined;
359
- wrapper;
360
- roomLabels = [];
361
- container = document.createElement('div');
362
355
  constructor(five) {
356
+ Object.defineProperty(this, "five", {
357
+ enumerable: true,
358
+ configurable: true,
359
+ writable: true,
360
+ value: void 0
361
+ });
362
+ Object.defineProperty(this, "enabled", {
363
+ enumerable: true,
364
+ configurable: true,
365
+ writable: true,
366
+ value: true
367
+ });
368
+ Object.defineProperty(this, "fiveModeEnabled", {
369
+ enumerable: true,
370
+ configurable: true,
371
+ writable: true,
372
+ value: void 0
373
+ });
374
+ Object.defineProperty(this, "app", {
375
+ enumerable: true,
376
+ configurable: true,
377
+ writable: true,
378
+ value: undefined
379
+ });
380
+ Object.defineProperty(this, "wrapper", {
381
+ enumerable: true,
382
+ configurable: true,
383
+ writable: true,
384
+ value: void 0
385
+ });
386
+ Object.defineProperty(this, "roomLabels", {
387
+ enumerable: true,
388
+ configurable: true,
389
+ writable: true,
390
+ value: []
391
+ });
392
+ Object.defineProperty(this, "container", {
393
+ enumerable: true,
394
+ configurable: true,
395
+ writable: true,
396
+ value: document.createElement('div')
397
+ });
398
+ /** 监听 Five Mode 变化
399
+ * @description
400
+ * Mode 不符合要求时,立刻消失,满足要求时,需要等待动画结束再展示
401
+ */
402
+ Object.defineProperty(this, "onFiveModeChange", {
403
+ enumerable: true,
404
+ configurable: true,
405
+ writable: true,
406
+ value: (mode) => {
407
+ if (mode !== 'Floorplan') {
408
+ this.fiveModeEnabled = false;
409
+ this.render();
410
+ return;
411
+ }
412
+ this.five.once('initAnimationEnded', () => {
413
+ this.fiveModeEnabled = this.five.currentMode === 'Floorplan';
414
+ this.render();
415
+ });
416
+ }
417
+ });
363
418
  this.five = five;
364
419
  this.fiveModeEnabled = this.five.currentMode === 'Floorplan';
365
420
  // init container style
@@ -412,26 +467,12 @@ class ModelRoomLabelController {
412
467
  this.render();
413
468
  return this;
414
469
  }
415
- /** 监听 Five Mode 变化
416
- * @description
417
- * Mode 不符合要求时,立刻消失,满足要求时,需要等待动画结束再展示
418
- */
419
- onFiveModeChange = (mode) => {
420
- if (mode !== 'Floorplan') {
421
- this.fiveModeEnabled = false;
422
- this.render();
423
- return;
424
- }
425
- this.five.once('initAnimationEnded', () => {
426
- this.fiveModeEnabled = this.five.currentMode === 'Floorplan';
427
- this.render();
428
- });
429
- };
430
470
  render() {
471
+ var _a;
431
472
  if (!this.wrapper)
432
473
  return;
433
474
  if (!this.enabled || !this.fiveModeEnabled) {
434
- this.app?.$destroy();
475
+ (_a = this.app) === null || _a === void 0 ? void 0 : _a.$destroy();
435
476
  this.app = undefined;
436
477
  return;
437
478
  }
@@ -0,0 +1,4 @@
1
+ import type { FivePlugin } from '@realsee/five';
2
+ import { ModelTVVideoPluginExportType, ModelTVVideoPluginParameterType } from "./typings";
3
+ export declare const ModelTVVideoPlugin: FivePlugin<ModelTVVideoPluginParameterType, ModelTVVideoPluginExportType>;
4
+ export default ModelTVVideoPlugin;