@realsee/dnalogel 2.0.0-alpha.30 → 2.0.0-alpha.32

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 (99) hide show
  1. package/dist/ItemLabelPlugin/index.js +61 -42
  2. package/dist/PanoRulerPlugin/index.js +3 -2
  3. package/dist/floorplan/ModelFloorplanPlugin/index.js +3 -2
  4. package/dist/floorplan/TopviewFloorplanPlugin/index.js +3 -2
  5. package/dist/index.es.js +65 -43
  6. package/dist/index.js +68 -46
  7. package/dist/index.umd.js +68 -46
  8. package/docs/classes/Magnifier.html +4 -4
  9. package/docs/classes/ModelRoomLabelController.html +4 -4
  10. package/docs/classes/PanoFloorplanRadarPluginController.html +2 -2
  11. package/docs/enums/CameraMovementEffect.html +2 -2
  12. package/docs/enums/DIRECTION.html +1 -1
  13. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  14. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  15. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  16. package/docs/enums/ModelFloorplanErrorType.html +1 -1
  17. package/docs/enums/Rotation.html +2 -2
  18. package/docs/index.html +1 -1
  19. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  20. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  21. package/docs/interfaces/FloorplanBounding.html +4 -4
  22. package/docs/interfaces/FloorplanData.html +2 -2
  23. package/docs/interfaces/FloorplanEntrance.html +7 -7
  24. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  25. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  26. package/docs/interfaces/FloorplanFloorData.html +2 -2
  27. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  28. package/docs/interfaces/FloorplanObserver.html +2 -2
  29. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  30. package/docs/interfaces/FloorplanPosition.html +2 -2
  31. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  32. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  33. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  34. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  35. package/docs/interfaces/FloorplanServerData.html +2 -2
  36. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  37. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  38. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  39. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  40. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  41. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  42. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  43. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  44. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  45. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  46. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  47. package/docs/interfaces/LineJson.html +1 -1
  48. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  49. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  50. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  51. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  52. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  53. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  54. package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
  55. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  56. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  57. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  58. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  59. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  60. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  61. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  62. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  63. package/docs/interfaces/OpenParameter.html +2 -2
  64. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  65. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  66. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  67. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  68. package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +1 -1
  69. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  70. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  71. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  72. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  73. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  74. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  75. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  76. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  77. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  78. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  79. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  80. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  81. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  82. package/docs/interfaces/Point.html +1 -1
  83. package/docs/interfaces/PointJson.html +1 -1
  84. package/docs/interfaces/Room.html +1 -1
  85. package/docs/interfaces/RoomInfo.html +1 -1
  86. package/docs/interfaces/RoomLabel.html +7 -7
  87. package/docs/interfaces/RoomRules.html +1 -1
  88. package/docs/interfaces/Rooms.html +1 -1
  89. package/docs/interfaces/TopviewFloorplanPluginParameterType.html +9 -9
  90. package/docs/modules.html +20 -20
  91. package/libs/ItemLabelPlugin/ItemLabelComponent.js +51 -32
  92. package/libs/ItemLabelPlugin/ItemLabelItem.js +5 -6
  93. package/libs/ItemLabelPlugin/utils/isImpacted.js +2 -1
  94. package/libs/PanoRulerPlugin/Plugin.js +3 -2
  95. package/libs/floorplan/Components/Main.js +2 -2
  96. package/libs/floorplan/ModelFloorplanPlugin/Controller.js +1 -0
  97. package/libs/floorplan/TopviewFloorplanPlugin/style.js +1 -0
  98. package/package.json +2 -2
  99. package/CHANGELOG.md +0 -108
@@ -58,7 +58,7 @@ function create_if_block$1(ctx) {
58
58
  div1 = internal.element("div");
59
59
  div0 = internal.element("div");
60
60
  internal.attr(div0, "class", "icon svelte-4rvov0");
61
- internal.attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon ?? defaultIcon})`);
61
+ internal.attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`);
62
62
  internal.attr(div1, "class", "icon-wrap svelte-4rvov0");
63
63
  },
64
64
  m(target, anchor) {
@@ -71,7 +71,7 @@ function create_if_block$1(ctx) {
71
71
  }
72
72
  },
73
73
  p(ctx, dirty) {
74
- if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon ?? defaultIcon})`)) {
74
+ if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`)) {
75
75
  internal.attr(div0, "style", div0_style_value);
76
76
  }
77
77
  },
@@ -89,7 +89,7 @@ function create_fragment$1(ctx) {
89
89
  let t0;
90
90
  let div0;
91
91
  let span0;
92
- let t1_value = (/*itemLabel*/ ctx[0].code ?? /*itemLabel*/ ctx[0].id) + "";
92
+ let t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "";
93
93
  let t1;
94
94
  let t2;
95
95
  let span1;
@@ -161,7 +161,7 @@ function create_fragment$1(ctx) {
161
161
  if_block = null;
162
162
  }
163
163
 
164
- if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code ?? /*itemLabel*/ ctx[0].id) + "")) internal.set_data(t1, t1_value);
164
+ if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "")) internal.set_data(t1, t1_value);
165
165
  if (dirty & /*itemLabel*/ 1 && t3_value !== (t3_value = /*itemLabel*/ ctx[0].name + "")) internal.set_data(t3, t3_value);
166
166
 
167
167
  if (dirty & /*itemLabel*/ 1) {
@@ -199,14 +199,13 @@ function create_fragment$1(ctx) {
199
199
  };
200
200
  }
201
201
 
202
- const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n';
203
-
204
202
  function instance$1($$self, $$props, $$invalidate) {
205
203
  let { itemLabel } = $$props;
206
204
  let { hooks } = $$props;
207
205
  let { anchorEnabled } = $$props;
208
206
  let { onIconClick } = $$props;
209
207
 
208
+ // const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n'
210
209
  function onClick() {
211
210
  hooks.emit('onLabelClick', itemLabel);
212
211
  }
@@ -268,7 +267,8 @@ const isImpacted = (five, sourceVector, targetVector, distance) => {
268
267
  const raycaster = new Raycaster();
269
268
  raycaster.set(targetVector, direction);
270
269
  const [intersection] = five.model.intersectRaycaster(raycaster);
271
- return intersection && distance <= intersection.distance + 0.1;
270
+ return intersection && intersection.distance + 0.01 < distance;
271
+ // return intersection && distance <= intersection.distance + 0.1
272
272
  };
273
273
 
274
274
  /**
@@ -304,18 +304,18 @@ function add_css(target) {
304
304
 
305
305
  function get_each_context(ctx, list, i) {
306
306
  const child_ctx = ctx.slice();
307
- child_ctx[31] = list[i];
307
+ child_ctx[32] = list[i];
308
308
  return child_ctx;
309
309
  }
310
310
 
311
- // (229:2) {#if itemLabelItem.visible}
311
+ // (248:2) {#if itemLabelItem.visible}
312
312
  function create_if_block(ctx) {
313
313
  let itemlabelitem;
314
314
  let current;
315
315
 
316
316
  itemlabelitem = new ItemLabelItem({
317
317
  props: {
318
- itemLabel: /*itemLabelItem*/ ctx[31],
318
+ itemLabel: /*itemLabelItem*/ ctx[32],
319
319
  hooks: /*hooks*/ ctx[0],
320
320
  anchorEnabled: /*anchorEnabled*/ ctx[2],
321
321
  onIconClick: /*onIconClick*/ ctx[6]
@@ -332,7 +332,7 @@ function create_if_block(ctx) {
332
332
  },
333
333
  p(ctx, dirty) {
334
334
  const itemlabelitem_changes = {};
335
- if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[31];
335
+ if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[32];
336
336
  if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
337
337
  if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
338
338
  itemlabelitem.$set(itemlabelitem_changes);
@@ -352,12 +352,12 @@ function create_if_block(ctx) {
352
352
  };
353
353
  }
354
354
 
355
- // (228:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
355
+ // (247:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
356
356
  function create_each_block(key_1, ctx) {
357
357
  let first;
358
358
  let if_block_anchor;
359
359
  let current;
360
- let if_block = /*itemLabelItem*/ ctx[31].visible && create_if_block(ctx);
360
+ let if_block = /*itemLabelItem*/ ctx[32].visible && create_if_block(ctx);
361
361
 
362
362
  return {
363
363
  key: key_1,
@@ -377,7 +377,7 @@ function create_each_block(key_1, ctx) {
377
377
  p(new_ctx, dirty) {
378
378
  ctx = new_ctx;
379
379
 
380
- if (/*itemLabelItem*/ ctx[31].visible) {
380
+ if (/*itemLabelItem*/ ctx[32].visible) {
381
381
  if (if_block) {
382
382
  if_block.p(ctx, dirty);
383
383
 
@@ -424,7 +424,7 @@ function create_fragment(ctx) {
424
424
  let div_resize_listener;
425
425
  let current;
426
426
  let each_value = /*renderItemLabels*/ ctx[1];
427
- const get_key = ctx => /*itemLabelItem*/ ctx[31].id;
427
+ const get_key = ctx => /*itemLabelItem*/ ctx[32].id;
428
428
 
429
429
  for (let i = 0; i < each_value.length; i += 1) {
430
430
  let child_ctx = get_each_context(ctx, each_value, i);
@@ -526,7 +526,7 @@ function instance($$self, $$props, $$invalidate) {
526
526
  * 1、当前楼层(假设先不考虑多楼层)
527
527
  * 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
528
528
  * */
529
- const getLabelVisible = (five$1, itemLabel) => {
529
+ const judgeImpacted = (five$1, itemLabel) => {
530
530
  // 虚拟 VR 仅有一层,不考虑楼层信息
531
531
  const cameraPosition = five$1.camera.position.clone();
532
532
 
@@ -547,6 +547,17 @@ function instance($$self, $$props, $$invalidate) {
547
547
  // const [intersection] = five.model.intersectRaycaster(raycaster)
548
548
  // return !(intersection && intersection.distance + 1 < vectorDistance);
549
549
 
550
+ const judgeInViewport = modelPoint => {
551
+ const { camera, model } = five$1;
552
+ const { x: offsetXFromCenter, y: offsetYFromCenter, z: offsetZFromCenter } = modelPoint.clone().project(camera);
553
+ const ratioFromLeft = (offsetXFromCenter + 1) / 2;
554
+ const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
555
+ const isFront = Math.abs(offsetZFromCenter) < 1;
556
+ const cssOffset = [ratioFromLeft, ratioFromTop];
557
+ const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
558
+ return Boolean(isInViewport);
559
+ };
560
+
550
561
  // cssOffset 获取
551
562
  const getLabelCssOffset = (five, itemLabel) => {
552
563
  const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
@@ -563,19 +574,26 @@ function instance($$self, $$props, $$invalidate) {
563
574
  return [xOffset, yOffset];
564
575
  };
565
576
 
566
- const getFormatedItemLabels = (five, labels) => {
577
+ const getFormatedItemLabels = (five$1, labels) => {
567
578
  // 计算位置 & 可见性
568
579
  const newLabels = labels.map(label => {
569
- const cssOffset = getLabelCssOffset(five, label);
580
+ const cssOffset = getLabelCssOffset(five$1, label);
570
581
  label.name.length * basicWidth;
571
582
  const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
572
583
 
573
584
  // 是否加入碰撞检测
574
- const naturalVisible = modelOcclusionEnable
575
- ? getLabelVisible(five, label)
576
- : label.visible;
585
+ // 配置加入碰撞检测,则判断碰撞检测
586
+ // 在可见范围内, 仅在 Panorama 模态计算
587
+ const isInViewport = five$1.currentMode === five.Five.Mode.Panorama
588
+ ? judgeInViewport(new Vector3(label.position[0], label.position[1], label.position[2]))
589
+ : true;
577
590
 
578
- const visible = naturalVisible;
591
+ // 碰撞
592
+ const isBlocked = modelOcclusionEnable
593
+ ? judgeImpacted(five$1, label)
594
+ : false;
595
+
596
+ const visible = isInViewport && !isBlocked;
579
597
 
580
598
  // 关掉重叠计算
581
599
  // const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth)
@@ -591,7 +609,7 @@ function instance($$self, $$props, $$invalidate) {
591
609
 
592
610
  const sortedItemLabelItems = newLabels.filter(({ visible }) => visible).map(label => ({
593
611
  itemLabelItem: label,
594
- distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five.camera.position)
612
+ distance: new Vector3(label.modelPosition[0], label.modelPosition[1], label.modelPosition[2]).clone().distanceTo(five$1.camera.position)
595
613
  })).sort((a, b) => a.distance - b.distance);
596
614
 
597
615
  return newLabels.map(label => {
@@ -606,24 +624,11 @@ function instance($$self, $$props, $$invalidate) {
606
624
  $$invalidate(1, renderItemLabels = getFormatedItemLabels(five$1, renderItemLabels));
607
625
  };
608
626
 
609
- svelte.beforeUpdate(() => {
610
- addDataUpdateListener();
611
- });
612
-
613
627
  const handleCameraUpdateCallback = () => {
614
628
  $$invalidate(5, itemsVisible = false);
615
629
  handleCameraUpdate();
616
630
  };
617
631
 
618
- svelte.onMount(() => {
619
- $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
620
- curItemLabels = itemLabels;
621
- onItemLabelUpdate();
622
- addResizeListener();
623
- five$1.on('cameraUpdate', handleCameraUpdateCallback);
624
- five$1.on('modeChange', onFiveModeChange);
625
- });
626
-
627
632
  const onFiveModeChange = mode => {
628
633
  $$invalidate(5, itemsVisible = false);
629
634
 
@@ -671,12 +676,6 @@ function instance($$self, $$props, $$invalidate) {
671
676
  }
672
677
  });
673
678
 
674
- svelte.onDestroy(() => {
675
- five$1.off('cameraUpdate', handleCameraUpdateCallback);
676
- five$1.off('modeChange', onFiveModeChange);
677
- resizeObserver.unobserve(wrapper);
678
- });
679
-
680
679
  const getNearObserverPano = (fromPositionVector, observers) => {
681
680
  let candidates = [];
682
681
 
@@ -714,6 +713,7 @@ function instance($$self, $$props, $$invalidate) {
714
713
  const observer = getNearObserverPano(fromPositionVector, observers);
715
714
 
716
715
  if (observer) {
716
+ console.log('--has observer--');
717
717
  itemLabel.observerIndex = observer.panoIndex;
718
718
  }
719
719
 
@@ -746,6 +746,25 @@ function instance($$self, $$props, $$invalidate) {
746
746
  }
747
747
  };
748
748
 
749
+ svelte.beforeUpdate(() => {
750
+ addDataUpdateListener();
751
+ });
752
+
753
+ svelte.onMount(() => {
754
+ $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
755
+ curItemLabels = itemLabels;
756
+ onItemLabelUpdate();
757
+ addResizeListener();
758
+ five$1.on('cameraUpdate', handleCameraUpdateCallback);
759
+ five$1.on('modeChange', onFiveModeChange);
760
+ });
761
+
762
+ svelte.onDestroy(() => {
763
+ five$1.off('cameraUpdate', handleCameraUpdateCallback);
764
+ five$1.off('modeChange', onFiveModeChange);
765
+ resizeObserver.unobserve(wrapper);
766
+ });
767
+
749
768
  function div_elementresize_handler() {
750
769
  containerWidth = this.clientWidth;
751
770
  containerHeight = this.clientHeight;
@@ -384,7 +384,7 @@ const PanoRulerPlugin = (five$1, params) => {
384
384
  throw new Error('标尺数据依赖不齐全!');
385
385
  }
386
386
  state.loaded = false;
387
- state.options = Object.assign({}, state.options, options || {});
387
+ state.options = Object.assign(Object.assign({}, state.options), options || {});
388
388
  if (five$1.model.loaded) {
389
389
  return _load(roomInfo, roomRules);
390
390
  }
@@ -486,7 +486,8 @@ const PanoRulerPlugin = (five$1, params) => {
486
486
  $element.style.display = 'none';
487
487
  continue;
488
488
  }
489
- if (start.distanceTo(end) < 0.5) {
489
+ // 线小于0.3m隐藏
490
+ if (start.distanceTo(end) < 0.3) {
490
491
  $element.style.display = 'none';
491
492
  continue;
492
493
  }
@@ -2769,7 +2769,7 @@ class CurrentFloor extends internal.SvelteComponent {
2769
2769
  /* src/floorplan/Components/Main.svelte generated by Svelte v3.47.0 */
2770
2770
 
2771
2771
  function add_css(target) {
2772
- internal.append_styles(target, "svelte-q5wdnn", ".floorplan-main.svelte-q5wdnn{width:100%;height:100%}");
2772
+ internal.append_styles(target, "svelte-86bqav", ".floorplan-main.svelte-86bqav{width:100%;height:100%;pointer-events:none}");
2773
2773
  }
2774
2774
 
2775
2775
  function get_each_context(ctx, list, i) {
@@ -2827,7 +2827,7 @@ function create_if_block(ctx) {
2827
2827
  internal.create_component(camera.$$.fragment);
2828
2828
  t1 = internal.space();
2829
2829
  if (if_block) if_block.c();
2830
- internal.attr(div, "class", "floorplan-main svelte-q5wdnn");
2830
+ internal.attr(div, "class", "floorplan-main svelte-86bqav");
2831
2831
  },
2832
2832
  m(target, anchor) {
2833
2833
  internal.insert(target, div, anchor);
@@ -3959,6 +3959,7 @@ class ModelFloorplanPluginController {
3959
3959
  top: '50%',
3960
3960
  transform: 'translate(-50%, -50%)',
3961
3961
  zIndex: 10,
3962
+ pointerEvents: 'none'
3962
3963
  });
3963
3964
  this.five.addExtraElement(this.container);
3964
3965
  // 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
@@ -33,6 +33,7 @@ const pluginStyle = {
33
33
  top: '50%',
34
34
  transform: 'translate(-50%, -50%)',
35
35
  zIndex: '10',
36
+ pointerEvents: 'none'
36
37
  };
37
38
 
38
39
  function pathD(points, options = {}) {
@@ -2859,7 +2860,7 @@ class CurrentFloor extends internal.SvelteComponent {
2859
2860
  /* src/floorplan/Components/Main.svelte generated by Svelte v3.47.0 */
2860
2861
 
2861
2862
  function add_css(target) {
2862
- internal.append_styles(target, "svelte-q5wdnn", ".floorplan-main.svelte-q5wdnn{width:100%;height:100%}");
2863
+ internal.append_styles(target, "svelte-86bqav", ".floorplan-main.svelte-86bqav{width:100%;height:100%;pointer-events:none}");
2863
2864
  }
2864
2865
 
2865
2866
  function get_each_context(ctx, list, i) {
@@ -2917,7 +2918,7 @@ function create_if_block(ctx) {
2917
2918
  internal.create_component(camera.$$.fragment);
2918
2919
  t1 = internal.space();
2919
2920
  if (if_block) if_block.c();
2920
- internal.attr(div, "class", "floorplan-main svelte-q5wdnn");
2921
+ internal.attr(div, "class", "floorplan-main svelte-86bqav");
2921
2922
  },
2922
2923
  m(target, anchor) {
2923
2924
  internal.insert(target, div, anchor);
package/dist/index.es.js CHANGED
@@ -1002,6 +1002,7 @@ const pluginStyle$1 = {
1002
1002
  top: '50%',
1003
1003
  transform: 'translate(-50%, -50%)',
1004
1004
  zIndex: '10',
1005
+ pointerEvents: 'none'
1005
1006
  };
1006
1007
 
1007
1008
  const FLOORPLAN_EXTRA_OBJECT_IMAGE = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALaADAAQAAAABAAAAMAAAAADe2FZjAAAEF0lEQVRoBe2WzWskRRiHf13V092TxI2oEzYeVDwITtyDuCiihwiCePGgxIM3vYgHL4J4UIhBRA8i/gPqyUvWg7AiIuIeloDiYUHJLOK6BPwIk9nNODM9Xf1RVe1b3elJRjCZmQ6euqGmuqer33rq4e23GqiOykBloDJQGagMVAYqA5WBykBlYFYD1qwP/tdzaZqOx9zYOLxeX0+L5yzLGp0X/03a25MOnGRcBtx+6Rlo9SL08G4EooFnxa8Yiivox5/h5Ys/4cl7NVorNDRnngX+0MIkVMeMSf23zyKML8J7/Dy8hwF2Buh9CnS+AEQIdLspBuGb+M7/qLW4qJrNpsLapjYhpwVnx3BMfCtNNx3Etc9xywvnMf80wG8HmQainw0RxSGrnmeBp+8k5/j9S0HbvXb5io0Lz880/0wPHV1NlhLd316He+4xOCv5ragF7L9PrH1qBJyB0626x/lC+qrSvH5r/W+n1WpxUM5nMY4GPeH8lHJaPgfeAFQHCL+ntkXT+vnUc3W6pvTIwC0wy3rA4dwLmK2avZ7Eo9uKBuYJfgJscbs8dLCxDMt+EOEPBEZNEWyBYHqTz6bPXrzUnNrSShxHIsYiOL69zrCGLLcLqJP68tB+9w5wj+YhWDafQ2s61wNqxjZhmrQ2pvMFCEvXuCUZ7wqH794ZWs28LJqlTXSUyuksF2M/yOwqgkx2c1ADa4wLAQRk2sAGQQakhN6yFC2hltfz5kSY44NKQeeh+vtI/SSzWhg2CzCgmWISmKUGmaYFBDfCSymnfxJ6/+ospVcWOLLp5DGP/y0P/Rp66O99DQNq7Po3Ds0a0wY+My2QSv2N2mO/OyxR2o6UQk+Lv7yJ06JYSnnolZVU9cUn2O9SmaMWGFBqYXRwbqAJWIi94TX5biotpcGl1DXZ6LnqIbNDTnmUgi52Mv5l5ysMxIcZcGjy2DTK4ZHlcBC14zeSge4qphICjj3bS0A7o9nSp2TOkm7aZ8bGZy/jxhO87V91G0+dfY/Z7BWIIK9KYUi5qy/Hf8YfBG3sqJTHiQWhmTVkbip+wX3x6volVSx+LPAxF+VLXhZ8VQ+iP2Rta/iWe5v42Fngj0BbdnRTXh12ZIcKhTaGbcYjybRwXBU1lu9KlndXp04NM52poKWO0RZsviNaP9a6grkO972+st05pXhE5c1hTEluJy7XUejGUQNLMbAmTdWY1rKBLW3aTJqBZ7nZkb36DhYCreeYHbMUXHvaYi5XDK70EcgulmRjm77wNtenzuXCbmnTRaAx493rbGf3Jr/njMzj920CnKdUaFCjlDioy7NYNvOdGrQJNgI32/L2tkXfFPlxgToqjWVhD6KdLnQRdARf/HHQz2r2X2Gqy8pAZaAyUBmoDFQGKgP/q4F/AJYg9/s0ZoABAAAAAElFTkSuQmCC';
@@ -3865,7 +3866,7 @@ class CurrentFloor$1 extends SvelteComponent {
3865
3866
  /* src/floorplan/Components/Main.svelte generated by Svelte v3.47.0 */
3866
3867
 
3867
3868
  function add_css$9(target) {
3868
- append_styles(target, "svelte-q5wdnn", ".floorplan-main.svelte-q5wdnn{width:100%;height:100%}");
3869
+ append_styles(target, "svelte-86bqav", ".floorplan-main.svelte-86bqav{width:100%;height:100%;pointer-events:none}");
3869
3870
  }
3870
3871
 
3871
3872
  function get_each_context$4(ctx, list, i) {
@@ -3923,7 +3924,7 @@ function create_if_block$4(ctx) {
3923
3924
  create_component(camera.$$.fragment);
3924
3925
  t1 = space();
3925
3926
  if (if_block) if_block.c();
3926
- attr(div, "class", "floorplan-main svelte-q5wdnn");
3927
+ attr(div, "class", "floorplan-main svelte-86bqav");
3927
3928
  },
3928
3929
  m(target, anchor) {
3929
3930
  insert(target, div, anchor);
@@ -6259,6 +6260,7 @@ class ModelFloorplanPluginController {
6259
6260
  top: '50%',
6260
6261
  transform: 'translate(-50%, -50%)',
6261
6262
  zIndex: 10,
6263
+ pointerEvents: 'none'
6262
6264
  });
6263
6265
  this.five.addExtraElement(this.container);
6264
6266
  // 如果初始化的时候模型已经加载完毕了,就不用再等 modelLoaded
@@ -7329,7 +7331,7 @@ const PanoRulerPlugin = (five, params) => {
7329
7331
  throw new Error('标尺数据依赖不齐全!');
7330
7332
  }
7331
7333
  state.loaded = false;
7332
- state.options = Object.assign({}, state.options, options || {});
7334
+ state.options = Object.assign(Object.assign({}, state.options), options || {});
7333
7335
  if (five.model.loaded) {
7334
7336
  return _load(roomInfo, roomRules);
7335
7337
  }
@@ -7431,7 +7433,8 @@ const PanoRulerPlugin = (five, params) => {
7431
7433
  $element.style.display = 'none';
7432
7434
  continue;
7433
7435
  }
7434
- if (start.distanceTo(end) < 0.5) {
7436
+ // 线小于0.3m隐藏
7437
+ if (start.distanceTo(end) < 0.3) {
7435
7438
  $element.style.display = 'none';
7436
7439
  continue;
7437
7440
  }
@@ -13765,7 +13768,7 @@ function create_if_block$1(ctx) {
13765
13768
  div1 = element("div");
13766
13769
  div0 = element("div");
13767
13770
  attr(div0, "class", "icon svelte-4rvov0");
13768
- attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon ?? defaultIcon})`);
13771
+ attr(div0, "style", div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`);
13769
13772
  attr(div1, "class", "icon-wrap svelte-4rvov0");
13770
13773
  },
13771
13774
  m(target, anchor) {
@@ -13778,7 +13781,7 @@ function create_if_block$1(ctx) {
13778
13781
  }
13779
13782
  },
13780
13783
  p(ctx, dirty) {
13781
- if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon ?? defaultIcon})`)) {
13784
+ if (dirty & /*itemLabel*/ 1 && div0_style_value !== (div0_style_value = `background-image: url(${/*itemLabel*/ ctx[0].icon})`)) {
13782
13785
  attr(div0, "style", div0_style_value);
13783
13786
  }
13784
13787
  },
@@ -13796,7 +13799,7 @@ function create_fragment$1(ctx) {
13796
13799
  let t0;
13797
13800
  let div0;
13798
13801
  let span0;
13799
- let t1_value = (/*itemLabel*/ ctx[0].code ?? /*itemLabel*/ ctx[0].id) + "";
13802
+ let t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "";
13800
13803
  let t1;
13801
13804
  let t2;
13802
13805
  let span1;
@@ -13868,7 +13871,7 @@ function create_fragment$1(ctx) {
13868
13871
  if_block = null;
13869
13872
  }
13870
13873
 
13871
- if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code ?? /*itemLabel*/ ctx[0].id) + "")) set_data(t1, t1_value);
13874
+ if (dirty & /*itemLabel*/ 1 && t1_value !== (t1_value = (/*itemLabel*/ ctx[0].code || /*itemLabel*/ ctx[0].id) + "")) set_data(t1, t1_value);
13872
13875
  if (dirty & /*itemLabel*/ 1 && t3_value !== (t3_value = /*itemLabel*/ ctx[0].name + "")) set_data(t3, t3_value);
13873
13876
 
13874
13877
  if (dirty & /*itemLabel*/ 1) {
@@ -13906,14 +13909,13 @@ function create_fragment$1(ctx) {
13906
13909
  };
13907
13910
  }
13908
13911
 
13909
- const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n';
13910
-
13911
13912
  function instance$1($$self, $$props, $$invalidate) {
13912
13913
  let { itemLabel } = $$props;
13913
13914
  let { hooks } = $$props;
13914
13915
  let { anchorEnabled } = $$props;
13915
13916
  let { onIconClick } = $$props;
13916
13917
 
13918
+ // const defaultIcon = '//vrlab-public.ljcdn.com/common/file/web/c8591aaa-e62b-4e31-8fed-671483ace37f.svg\n'
13917
13919
  function onClick() {
13918
13920
  hooks.emit('onLabelClick', itemLabel);
13919
13921
  }
@@ -13960,7 +13962,8 @@ const isImpacted = (five, sourceVector, targetVector, distance) => {
13960
13962
  const raycaster = new Raycaster();
13961
13963
  raycaster.set(targetVector, direction);
13962
13964
  const [intersection] = five.model.intersectRaycaster(raycaster);
13963
- return intersection && distance <= intersection.distance + 0.1;
13965
+ return intersection && intersection.distance + 0.01 < distance;
13966
+ // return intersection && distance <= intersection.distance + 0.1
13964
13967
  };
13965
13968
 
13966
13969
  /**
@@ -13996,18 +13999,18 @@ function add_css(target) {
13996
13999
 
13997
14000
  function get_each_context(ctx, list, i) {
13998
14001
  const child_ctx = ctx.slice();
13999
- child_ctx[31] = list[i];
14002
+ child_ctx[32] = list[i];
14000
14003
  return child_ctx;
14001
14004
  }
14002
14005
 
14003
- // (229:2) {#if itemLabelItem.visible}
14006
+ // (248:2) {#if itemLabelItem.visible}
14004
14007
  function create_if_block(ctx) {
14005
14008
  let itemlabelitem;
14006
14009
  let current;
14007
14010
 
14008
14011
  itemlabelitem = new ItemLabelItem({
14009
14012
  props: {
14010
- itemLabel: /*itemLabelItem*/ ctx[31],
14013
+ itemLabel: /*itemLabelItem*/ ctx[32],
14011
14014
  hooks: /*hooks*/ ctx[0],
14012
14015
  anchorEnabled: /*anchorEnabled*/ ctx[2],
14013
14016
  onIconClick: /*onIconClick*/ ctx[6]
@@ -14024,7 +14027,7 @@ function create_if_block(ctx) {
14024
14027
  },
14025
14028
  p(ctx, dirty) {
14026
14029
  const itemlabelitem_changes = {};
14027
- if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[31];
14030
+ if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[32];
14028
14031
  if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
14029
14032
  if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
14030
14033
  itemlabelitem.$set(itemlabelitem_changes);
@@ -14044,12 +14047,12 @@ function create_if_block(ctx) {
14044
14047
  };
14045
14048
  }
14046
14049
 
14047
- // (228:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
14050
+ // (247:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
14048
14051
  function create_each_block(key_1, ctx) {
14049
14052
  let first;
14050
14053
  let if_block_anchor;
14051
14054
  let current;
14052
- let if_block = /*itemLabelItem*/ ctx[31].visible && create_if_block(ctx);
14055
+ let if_block = /*itemLabelItem*/ ctx[32].visible && create_if_block(ctx);
14053
14056
 
14054
14057
  return {
14055
14058
  key: key_1,
@@ -14069,7 +14072,7 @@ function create_each_block(key_1, ctx) {
14069
14072
  p(new_ctx, dirty) {
14070
14073
  ctx = new_ctx;
14071
14074
 
14072
- if (/*itemLabelItem*/ ctx[31].visible) {
14075
+ if (/*itemLabelItem*/ ctx[32].visible) {
14073
14076
  if (if_block) {
14074
14077
  if_block.p(ctx, dirty);
14075
14078
 
@@ -14116,7 +14119,7 @@ function create_fragment(ctx) {
14116
14119
  let div_resize_listener;
14117
14120
  let current;
14118
14121
  let each_value = /*renderItemLabels*/ ctx[1];
14119
- const get_key = ctx => /*itemLabelItem*/ ctx[31].id;
14122
+ const get_key = ctx => /*itemLabelItem*/ ctx[32].id;
14120
14123
 
14121
14124
  for (let i = 0; i < each_value.length; i += 1) {
14122
14125
  let child_ctx = get_each_context(ctx, each_value, i);
@@ -14218,7 +14221,7 @@ function instance($$self, $$props, $$invalidate) {
14218
14221
  * 1、当前楼层(假设先不考虑多楼层)
14219
14222
  * 2、模型未被遮挡(一个 box 有没有被遮挡的计算? TODO)
14220
14223
  * */
14221
- const getLabelVisible = (five, itemLabel) => {
14224
+ const judgeImpacted = (five, itemLabel) => {
14222
14225
  // 虚拟 VR 仅有一层,不考虑楼层信息
14223
14226
  const cameraPosition = five.camera.position.clone();
14224
14227
 
@@ -14239,6 +14242,17 @@ function instance($$self, $$props, $$invalidate) {
14239
14242
  // const [intersection] = five.model.intersectRaycaster(raycaster)
14240
14243
  // return !(intersection && intersection.distance + 1 < vectorDistance);
14241
14244
 
14245
+ const judgeInViewport = modelPoint => {
14246
+ const { camera, model } = five;
14247
+ const { x: offsetXFromCenter, y: offsetYFromCenter, z: offsetZFromCenter } = modelPoint.clone().project(camera);
14248
+ const ratioFromLeft = (offsetXFromCenter + 1) / 2;
14249
+ const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
14250
+ const isFront = Math.abs(offsetZFromCenter) < 1;
14251
+ const cssOffset = [ratioFromLeft, ratioFromTop];
14252
+ const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
14253
+ return Boolean(isInViewport);
14254
+ };
14255
+
14242
14256
  // cssOffset 获取
14243
14257
  const getLabelCssOffset = (five, itemLabel) => {
14244
14258
  const modelPosition = new Vector3(itemLabel.modelPosition[0], itemLabel.modelPosition[1], itemLabel.modelPosition[2]);
@@ -14263,11 +14277,18 @@ function instance($$self, $$props, $$invalidate) {
14263
14277
  const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
14264
14278
 
14265
14279
  // 是否加入碰撞检测
14266
- const naturalVisible = modelOcclusionEnable
14267
- ? getLabelVisible(five, label)
14268
- : label.visible;
14280
+ // 配置加入碰撞检测,则判断碰撞检测
14281
+ // 在可见范围内, 仅在 Panorama 模态计算
14282
+ const isInViewport = five.currentMode === Five.Mode.Panorama
14283
+ ? judgeInViewport(new Vector3(label.position[0], label.position[1], label.position[2]))
14284
+ : true;
14285
+
14286
+ // 碰撞
14287
+ const isBlocked = modelOcclusionEnable
14288
+ ? judgeImpacted(five, label)
14289
+ : false;
14269
14290
 
14270
- const visible = naturalVisible;
14291
+ const visible = isInViewport && !isBlocked;
14271
14292
 
14272
14293
  // 关掉重叠计算
14273
14294
  // const visible = naturalVisible && !isOverlap([cssOffset[0], cssOffset[1] + strokeLength], curLabelWidth)
@@ -14298,24 +14319,11 @@ function instance($$self, $$props, $$invalidate) {
14298
14319
  $$invalidate(1, renderItemLabels = getFormatedItemLabels(five, renderItemLabels));
14299
14320
  };
14300
14321
 
14301
- beforeUpdate(() => {
14302
- addDataUpdateListener();
14303
- });
14304
-
14305
14322
  const handleCameraUpdateCallback = () => {
14306
14323
  $$invalidate(5, itemsVisible = false);
14307
14324
  handleCameraUpdate();
14308
14325
  };
14309
14326
 
14310
- onMount(() => {
14311
- $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
14312
- curItemLabels = itemLabels;
14313
- onItemLabelUpdate();
14314
- addResizeListener();
14315
- five.on('cameraUpdate', handleCameraUpdateCallback);
14316
- five.on('modeChange', onFiveModeChange);
14317
- });
14318
-
14319
14327
  const onFiveModeChange = mode => {
14320
14328
  $$invalidate(5, itemsVisible = false);
14321
14329
 
@@ -14363,12 +14371,6 @@ function instance($$self, $$props, $$invalidate) {
14363
14371
  }
14364
14372
  });
14365
14373
 
14366
- onDestroy(() => {
14367
- five.off('cameraUpdate', handleCameraUpdateCallback);
14368
- five.off('modeChange', onFiveModeChange);
14369
- resizeObserver.unobserve(wrapper);
14370
- });
14371
-
14372
14374
  const getNearObserverPano = (fromPositionVector, observers) => {
14373
14375
  let candidates = [];
14374
14376
 
@@ -14406,6 +14408,7 @@ function instance($$self, $$props, $$invalidate) {
14406
14408
  const observer = getNearObserverPano(fromPositionVector, observers);
14407
14409
 
14408
14410
  if (observer) {
14411
+ console.log('--has observer--');
14409
14412
  itemLabel.observerIndex = observer.panoIndex;
14410
14413
  }
14411
14414
 
@@ -14438,6 +14441,25 @@ function instance($$self, $$props, $$invalidate) {
14438
14441
  }
14439
14442
  };
14440
14443
 
14444
+ beforeUpdate(() => {
14445
+ addDataUpdateListener();
14446
+ });
14447
+
14448
+ onMount(() => {
14449
+ $$invalidate(1, renderItemLabels = transform2RenderData(itemLabels));
14450
+ curItemLabels = itemLabels;
14451
+ onItemLabelUpdate();
14452
+ addResizeListener();
14453
+ five.on('cameraUpdate', handleCameraUpdateCallback);
14454
+ five.on('modeChange', onFiveModeChange);
14455
+ });
14456
+
14457
+ onDestroy(() => {
14458
+ five.off('cameraUpdate', handleCameraUpdateCallback);
14459
+ five.off('modeChange', onFiveModeChange);
14460
+ resizeObserver.unobserve(wrapper);
14461
+ });
14462
+
14441
14463
  function div_elementresize_handler() {
14442
14464
  containerWidth = this.clientWidth;
14443
14465
  containerHeight = this.clientHeight;