@realsee/dnalogel 2.0.0-alpha.38 → 2.0.0-alpha.40

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 (95) hide show
  1. package/dist/ItemLabelPlugin/index.js +58 -36
  2. package/dist/ItemLabelPlugin/typings.d.ts +4 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.es.js +61 -37
  5. package/dist/index.js +61 -36
  6. package/dist/index.umd.js +61 -36
  7. package/docs/assets/search.js +1 -1
  8. package/docs/classes/Magnifier.html +4 -4
  9. package/docs/classes/ModelRoomLabelController.html +4 -4
  10. package/docs/enums/CameraMovementEffect.html +2 -2
  11. package/docs/enums/DIRECTION.html +1 -1
  12. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  13. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  14. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  15. package/docs/enums/Rotation.html +2 -2
  16. package/docs/index.html +2 -2
  17. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  18. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  19. package/docs/interfaces/FloorplanBounding.html +4 -4
  20. package/docs/interfaces/FloorplanData.html +2 -2
  21. package/docs/interfaces/FloorplanEntrance.html +7 -7
  22. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  23. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  24. package/docs/interfaces/FloorplanFloorData.html +2 -2
  25. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  26. package/docs/interfaces/FloorplanObserver.html +2 -2
  27. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  28. package/docs/interfaces/FloorplanPosition.html +2 -2
  29. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  30. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  31. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  32. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  33. package/docs/interfaces/FloorplanServerData.html +2 -2
  34. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  35. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  36. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  37. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  38. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  39. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  40. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  41. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  42. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  43. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  44. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  45. package/docs/interfaces/LineJson.html +1 -1
  46. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  47. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  48. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  49. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  50. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  51. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  52. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  53. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  54. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  55. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  56. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  57. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  58. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  59. package/docs/interfaces/OpenParameter.html +2 -2
  60. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  61. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  62. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  63. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  64. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  65. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  66. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  67. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  68. package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
  69. package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
  70. package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
  71. package/docs/interfaces/PanoRulerProPluginState.html +1 -1
  72. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  73. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  74. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  75. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  76. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  77. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  78. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  79. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  80. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  81. package/docs/interfaces/Point.html +1 -1
  82. package/docs/interfaces/PointJson.html +1 -1
  83. package/docs/interfaces/Room.html +1 -1
  84. package/docs/interfaces/RoomInfo.html +1 -1
  85. package/docs/interfaces/RoomLabel.html +7 -7
  86. package/docs/interfaces/RoomRules.html +1 -1
  87. package/docs/interfaces/Rooms.html +1 -1
  88. package/docs/modules.html +18 -18
  89. package/libs/ItemLabelPlugin/ItemLabelComponent.js +32 -21
  90. package/libs/ItemLabelPlugin/Plugin.js +16 -10
  91. package/libs/ItemLabelPlugin/typings.d.ts +4 -0
  92. package/libs/ItemLabelPlugin/utils/parseData.js +1 -1
  93. package/libs/index.d.ts +1 -0
  94. package/libs/index.js +1 -0
  95. package/package.json +2 -2
@@ -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[30] = list[i];
307
+ child_ctx[31] = list[i];
308
308
  return child_ctx;
309
309
  }
310
310
 
311
- // (229:2) {#if itemLabelItem.visible}
311
+ // (234: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[30],
318
+ itemLabel: /*itemLabelItem*/ ctx[31],
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[30];
335
+ if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[31];
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
+ // (233: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[30].visible && create_if_block(ctx);
360
+ let if_block = /*itemLabelItem*/ ctx[31].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[30].visible) {
380
+ if (/*itemLabelItem*/ ctx[31].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[30].id;
427
+ const get_key = ctx => /*itemLabelItem*/ ctx[31].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);
@@ -441,7 +441,7 @@ function create_fragment(ctx) {
441
441
  }
442
442
 
443
443
  internal.attr(div, "class", "item-labels-container svelte-gk8s47");
444
- internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[12].call(div));
444
+ internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
445
445
  internal.set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
446
446
  },
447
447
  m(target, anchor) {
@@ -451,7 +451,7 @@ function create_fragment(ctx) {
451
451
  each_blocks[i].m(div, null);
452
452
  }
453
453
 
454
- div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[12].bind(div));
454
+ div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
455
455
  current = true;
456
456
  },
457
457
  p(ctx, dirty) {
@@ -499,6 +499,7 @@ function instance($$self, $$props, $$invalidate) {
499
499
  const { Raycaster, Vector3 } = THREE__namespace;
500
500
  let { five: five$1 } = $$props;
501
501
  let { modelOcclusionEnable } = $$props;
502
+ let { onlyVisibleInPanorama } = $$props;
502
503
  let { itemLabels } = $$props;
503
504
  let { hooks } = $$props;
504
505
  let { displayStrategyType } = $$props;
@@ -550,7 +551,10 @@ function instance($$self, $$props, $$invalidate) {
550
551
  const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
551
552
  const isFront = Math.abs(offsetZFromCenter) < 1;
552
553
  const cssOffset = [ratioFromLeft, ratioFromTop];
554
+
555
+ // 只计算在前面就行
553
556
  const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
557
+
554
558
  return Boolean(isInViewport);
555
559
  };
556
560
 
@@ -573,6 +577,11 @@ function instance($$self, $$props, $$invalidate) {
573
577
  const getFormatedItemLabels = (five$1, labels) => {
574
578
  // 计算位置 & 可见性
575
579
  const newLabels = labels.map(label => {
580
+ // 不在绑定点位则直接不可见
581
+ if (five$1.state.panoIndex !== label.panoIndex) {
582
+ return Object.assign(Object.assign({}, label), { visible: false });
583
+ }
584
+
576
585
  const cssOffset = getLabelCssOffset(five$1, label);
577
586
  label.name.length * basicWidth;
578
587
  const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
@@ -625,16 +634,6 @@ function instance($$self, $$props, $$invalidate) {
625
634
  handleCameraUpdate();
626
635
  };
627
636
 
628
- const onFiveModeChange = mode => {
629
- $$invalidate(5, itemsVisible = false);
630
-
631
- five$1.once('initAnimationEnded', (panoIndex, pose, userAction) => {
632
- $$invalidate(2, anchorEnabled = mode === five.Five.Mode.Panorama);
633
- $$invalidate(5, itemsVisible = true);
634
- if (!userAction) return; else onItemLabelUpdate();
635
- });
636
- };
637
-
638
637
  const handleCameraUpdate = debounce(
639
638
  () => {
640
639
  $$invalidate(5, itemsVisible = true);
@@ -692,11 +691,10 @@ function instance($$self, $$props, $$invalidate) {
692
691
  const onIconClick = itemLabel => {
693
692
  if (five$1.state.mode === five.Five.Mode.Panorama) return;
694
693
  const observers = five$1.work.observers;
695
- const fromPositionVector = new Vector3(itemLabel.position[0], itemLabel.position[1], itemLabel.position[2]);
694
+ const fromPositionVector = new Vector3().fromArray(itemLabel.position);
696
695
  const observer = getNearObserverPano(fromPositionVector, observers);
697
696
 
698
697
  if (observer) {
699
- console.log('--has observer--');
700
698
  itemLabel.observerIndex = observer.panoIndex;
701
699
  }
702
700
 
@@ -739,12 +737,12 @@ function instance($$self, $$props, $$invalidate) {
739
737
  onItemLabelUpdate();
740
738
  addResizeListener();
741
739
  five$1.on('cameraUpdate', handleCameraUpdateCallback);
742
- five$1.on('modeChange', onFiveModeChange);
743
- });
740
+ }); // five.on('modeChange', onFiveModeChange)
744
741
 
745
742
  svelte.onDestroy(() => {
746
743
  five$1.off('cameraUpdate', handleCameraUpdateCallback);
747
- five$1.off('modeChange', onFiveModeChange);
744
+
745
+ // five.off('modeChange', onFiveModeChange)
748
746
  window.removeEventListener('resize', onResize, false);
749
747
  });
750
748
 
@@ -758,10 +756,11 @@ function instance($$self, $$props, $$invalidate) {
758
756
  $$self.$$set = $$props => {
759
757
  if ('five' in $$props) $$invalidate(7, five$1 = $$props.five);
760
758
  if ('modelOcclusionEnable' in $$props) $$invalidate(8, modelOcclusionEnable = $$props.modelOcclusionEnable);
761
- if ('itemLabels' in $$props) $$invalidate(9, itemLabels = $$props.itemLabels);
759
+ if ('onlyVisibleInPanorama' in $$props) $$invalidate(9, onlyVisibleInPanorama = $$props.onlyVisibleInPanorama);
760
+ if ('itemLabels' in $$props) $$invalidate(10, itemLabels = $$props.itemLabels);
762
761
  if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
763
- if ('displayStrategyType' in $$props) $$invalidate(10, displayStrategyType = $$props.displayStrategyType);
764
- if ('maxVisibleDistance' in $$props) $$invalidate(11, maxVisibleDistance = $$props.maxVisibleDistance);
762
+ if ('displayStrategyType' in $$props) $$invalidate(11, displayStrategyType = $$props.displayStrategyType);
763
+ if ('maxVisibleDistance' in $$props) $$invalidate(12, maxVisibleDistance = $$props.maxVisibleDistance);
765
764
  };
766
765
 
767
766
  return [
@@ -774,6 +773,7 @@ function instance($$self, $$props, $$invalidate) {
774
773
  onIconClick,
775
774
  five$1,
776
775
  modelOcclusionEnable,
776
+ onlyVisibleInPanorama,
777
777
  itemLabels,
778
778
  displayStrategyType,
779
779
  maxVisibleDistance,
@@ -794,10 +794,11 @@ class ItemLabelComponent extends internal.SvelteComponent {
794
794
  {
795
795
  five: 7,
796
796
  modelOcclusionEnable: 8,
797
- itemLabels: 9,
797
+ onlyVisibleInPanorama: 9,
798
+ itemLabels: 10,
798
799
  hooks: 0,
799
- displayStrategyType: 10,
800
- maxVisibleDistance: 11
800
+ displayStrategyType: 11,
801
+ maxVisibleDistance: 12
801
802
  },
802
803
  add_css,
803
804
  [-1, -1]
@@ -807,12 +808,12 @@ class ItemLabelComponent extends internal.SvelteComponent {
807
808
 
808
809
  /** @description 转成内部所需数据 */
809
810
  function parseItemLabelPluginData(data) {
810
- return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined }, label)));
811
+ return data.item_labels.map(label => (Object.assign(Object.assign({}, label), { modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined })));
811
812
  }
812
813
 
813
814
  const defaultMaxVisibleDistance = undefined;
814
815
  const Plugin = (five$1, params) => {
815
- var _a, _b, _c;
816
+ var _a, _b, _c, _d;
816
817
  const pluginState = {
817
818
  container: document.createElement('div'),
818
819
  data: null,
@@ -823,8 +824,9 @@ const Plugin = (five$1, params) => {
823
824
  app: undefined,
824
825
  hooks: new five.Subscribe(),
825
826
  modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
826
- displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
827
- maxVisibleDistance: (_c = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _c !== void 0 ? _c : defaultMaxVisibleDistance,
827
+ onlyVisibleInPanorama: (_b = params === null || params === void 0 ? void 0 : params.onlyVisibleInPanorama) !== null && _b !== void 0 ? _b : true,
828
+ displayStrategyType: (_c = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _c !== void 0 ? _c : exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
829
+ maxVisibleDistance: (_d = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _d !== void 0 ? _d : defaultMaxVisibleDistance,
828
830
  };
829
831
  pluginState.container.setAttribute('class', 'item-label-plugin-container');
830
832
  pluginState.container.style.cssText = `
@@ -861,6 +863,7 @@ const Plugin = (five$1, params) => {
861
863
  return true;
862
864
  };
863
865
  const dispose = () => {
866
+ removeListener4Five();
864
867
  pluginState.container.remove();
865
868
  };
866
869
  const render = () => {
@@ -880,6 +883,7 @@ const Plugin = (five$1, params) => {
880
883
  props: {
881
884
  five: five$1,
882
885
  modelOcclusionEnable: pluginState.modelOcclusionEnable,
886
+ onlyVisibleInPanorama: pluginState.onlyVisibleInPanorama,
883
887
  itemLabels: pluginState.itemLabels,
884
888
  wrapper: pluginState.wrapper,
885
889
  hooks: pluginState.hooks,
@@ -897,9 +901,27 @@ const Plugin = (five$1, params) => {
897
901
  };
898
902
  // 添加 five 监听
899
903
  const addListener4Five = () => {
900
- // five.on('modeChange', onFiveModeChange)
904
+ five$1.on('modeChange', onFiveModeChange);
901
905
  five$1.once('dispose', dispose);
902
906
  };
907
+ // 取消 five 监听
908
+ const removeListener4Five = () => {
909
+ five$1.off('modeChange', onFiveModeChange);
910
+ };
911
+ const onFiveModeChange = (mode) => {
912
+ // if (!pluginState.enabled) return
913
+ if (mode !== five.Five.Mode.Panorama) {
914
+ pluginState.fiveModeEnabled = false;
915
+ disable();
916
+ return;
917
+ }
918
+ // pluginState.fiveModeEnabled = false
919
+ // render()
920
+ five$1.once('initAnimationEnded', () => {
921
+ pluginState.fiveModeEnabled = true;
922
+ enable();
923
+ });
924
+ };
903
925
  addListener4Five();
904
926
  return {
905
927
  appendTo,
@@ -10,10 +10,12 @@ export declare enum ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE {
10
10
  export interface ItemLabelPluginParametersType {
11
11
  maxVisibleDistance?: number;
12
12
  modelOcclusionEnable?: boolean;
13
+ onlyVisibleInPanorama?: boolean;
13
14
  displayStrategyType?: Partial<ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE>;
14
15
  }
15
16
  export interface ItemLabelPluginData {
16
17
  item_labels: Readonly<{
18
+ panoIndex: number;
17
19
  id: string;
18
20
  code: string;
19
21
  name: string;
@@ -24,6 +26,7 @@ export interface ItemLabelPluginData {
24
26
  }>[];
25
27
  }
26
28
  export interface ItemLabel {
29
+ panoIndex: number;
27
30
  id: string;
28
31
  code: string;
29
32
  name: string;
@@ -54,6 +57,7 @@ export interface ItemLabelPluginState {
54
57
  app?: ItemLabelComponent | undefined;
55
58
  hooks: Subscribe<PluginEvent>;
56
59
  modelOcclusionEnable: boolean;
60
+ onlyVisibleInPanorama: boolean;
57
61
  displayStrategyType: Partial<ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE>;
58
62
  maxVisibleDistance: number | undefined;
59
63
  }
package/dist/index.d.ts CHANGED
@@ -14,3 +14,4 @@ export * from './PanoSpatialTagPlugin';
14
14
  export * from './ModelItemLabelPlugin';
15
15
  export * from './ModelTVVideoPlugin';
16
16
  export * from './ItemLabelPlugin';
17
+ export declare const DnalogelVersion = "2.0.0-alpha.38";
package/dist/index.es.js CHANGED
@@ -15573,18 +15573,18 @@ function add_css(target) {
15573
15573
 
15574
15574
  function get_each_context(ctx, list, i) {
15575
15575
  const child_ctx = ctx.slice();
15576
- child_ctx[30] = list[i];
15576
+ child_ctx[31] = list[i];
15577
15577
  return child_ctx;
15578
15578
  }
15579
15579
 
15580
- // (229:2) {#if itemLabelItem.visible}
15580
+ // (234:2) {#if itemLabelItem.visible}
15581
15581
  function create_if_block(ctx) {
15582
15582
  let itemlabelitem;
15583
15583
  let current;
15584
15584
 
15585
15585
  itemlabelitem = new ItemLabelItem({
15586
15586
  props: {
15587
- itemLabel: /*itemLabelItem*/ ctx[30],
15587
+ itemLabel: /*itemLabelItem*/ ctx[31],
15588
15588
  hooks: /*hooks*/ ctx[0],
15589
15589
  anchorEnabled: /*anchorEnabled*/ ctx[2],
15590
15590
  onIconClick: /*onIconClick*/ ctx[6]
@@ -15601,7 +15601,7 @@ function create_if_block(ctx) {
15601
15601
  },
15602
15602
  p(ctx, dirty) {
15603
15603
  const itemlabelitem_changes = {};
15604
- if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[30];
15604
+ if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[31];
15605
15605
  if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
15606
15606
  if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
15607
15607
  itemlabelitem.$set(itemlabelitem_changes);
@@ -15621,12 +15621,12 @@ function create_if_block(ctx) {
15621
15621
  };
15622
15622
  }
15623
15623
 
15624
- // (228:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
15624
+ // (233:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
15625
15625
  function create_each_block(key_1, ctx) {
15626
15626
  let first;
15627
15627
  let if_block_anchor;
15628
15628
  let current;
15629
- let if_block = /*itemLabelItem*/ ctx[30].visible && create_if_block(ctx);
15629
+ let if_block = /*itemLabelItem*/ ctx[31].visible && create_if_block(ctx);
15630
15630
 
15631
15631
  return {
15632
15632
  key: key_1,
@@ -15646,7 +15646,7 @@ function create_each_block(key_1, ctx) {
15646
15646
  p(new_ctx, dirty) {
15647
15647
  ctx = new_ctx;
15648
15648
 
15649
- if (/*itemLabelItem*/ ctx[30].visible) {
15649
+ if (/*itemLabelItem*/ ctx[31].visible) {
15650
15650
  if (if_block) {
15651
15651
  if_block.p(ctx, dirty);
15652
15652
 
@@ -15693,7 +15693,7 @@ function create_fragment(ctx) {
15693
15693
  let div_resize_listener;
15694
15694
  let current;
15695
15695
  let each_value = /*renderItemLabels*/ ctx[1];
15696
- const get_key = ctx => /*itemLabelItem*/ ctx[30].id;
15696
+ const get_key = ctx => /*itemLabelItem*/ ctx[31].id;
15697
15697
 
15698
15698
  for (let i = 0; i < each_value.length; i += 1) {
15699
15699
  let child_ctx = get_each_context(ctx, each_value, i);
@@ -15710,7 +15710,7 @@ function create_fragment(ctx) {
15710
15710
  }
15711
15711
 
15712
15712
  attr(div, "class", "item-labels-container svelte-gk8s47");
15713
- add_render_callback(() => /*div_elementresize_handler*/ ctx[12].call(div));
15713
+ add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
15714
15714
  set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
15715
15715
  },
15716
15716
  m(target, anchor) {
@@ -15720,7 +15720,7 @@ function create_fragment(ctx) {
15720
15720
  each_blocks[i].m(div, null);
15721
15721
  }
15722
15722
 
15723
- div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[12].bind(div));
15723
+ div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
15724
15724
  current = true;
15725
15725
  },
15726
15726
  p(ctx, dirty) {
@@ -15768,6 +15768,7 @@ function instance($$self, $$props, $$invalidate) {
15768
15768
  const { Raycaster, Vector3 } = THREE;
15769
15769
  let { five } = $$props;
15770
15770
  let { modelOcclusionEnable } = $$props;
15771
+ let { onlyVisibleInPanorama } = $$props;
15771
15772
  let { itemLabels } = $$props;
15772
15773
  let { hooks } = $$props;
15773
15774
  let { displayStrategyType } = $$props;
@@ -15819,7 +15820,10 @@ function instance($$self, $$props, $$invalidate) {
15819
15820
  const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
15820
15821
  const isFront = Math.abs(offsetZFromCenter) < 1;
15821
15822
  const cssOffset = [ratioFromLeft, ratioFromTop];
15823
+
15824
+ // 只计算在前面就行
15822
15825
  const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
15826
+
15823
15827
  return Boolean(isInViewport);
15824
15828
  };
15825
15829
 
@@ -15842,6 +15846,11 @@ function instance($$self, $$props, $$invalidate) {
15842
15846
  const getFormatedItemLabels = (five, labels) => {
15843
15847
  // 计算位置 & 可见性
15844
15848
  const newLabels = labels.map(label => {
15849
+ // 不在绑定点位则直接不可见
15850
+ if (five.state.panoIndex !== label.panoIndex) {
15851
+ return Object.assign(Object.assign({}, label), { visible: false });
15852
+ }
15853
+
15845
15854
  const cssOffset = getLabelCssOffset(five, label);
15846
15855
  label.name.length * basicWidth;
15847
15856
  const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
@@ -15894,16 +15903,6 @@ function instance($$self, $$props, $$invalidate) {
15894
15903
  handleCameraUpdate();
15895
15904
  };
15896
15905
 
15897
- const onFiveModeChange = mode => {
15898
- $$invalidate(5, itemsVisible = false);
15899
-
15900
- five.once('initAnimationEnded', (panoIndex, pose, userAction) => {
15901
- $$invalidate(2, anchorEnabled = mode === Five.Mode.Panorama);
15902
- $$invalidate(5, itemsVisible = true);
15903
- if (!userAction) return; else onItemLabelUpdate();
15904
- });
15905
- };
15906
-
15907
15906
  const handleCameraUpdate = debounce(
15908
15907
  () => {
15909
15908
  $$invalidate(5, itemsVisible = true);
@@ -15961,11 +15960,10 @@ function instance($$self, $$props, $$invalidate) {
15961
15960
  const onIconClick = itemLabel => {
15962
15961
  if (five.state.mode === Five.Mode.Panorama) return;
15963
15962
  const observers = five.work.observers;
15964
- const fromPositionVector = new Vector3(itemLabel.position[0], itemLabel.position[1], itemLabel.position[2]);
15963
+ const fromPositionVector = new Vector3().fromArray(itemLabel.position);
15965
15964
  const observer = getNearObserverPano(fromPositionVector, observers);
15966
15965
 
15967
15966
  if (observer) {
15968
- console.log('--has observer--');
15969
15967
  itemLabel.observerIndex = observer.panoIndex;
15970
15968
  }
15971
15969
 
@@ -16008,12 +16006,12 @@ function instance($$self, $$props, $$invalidate) {
16008
16006
  onItemLabelUpdate();
16009
16007
  addResizeListener();
16010
16008
  five.on('cameraUpdate', handleCameraUpdateCallback);
16011
- five.on('modeChange', onFiveModeChange);
16012
- });
16009
+ }); // five.on('modeChange', onFiveModeChange)
16013
16010
 
16014
16011
  onDestroy(() => {
16015
16012
  five.off('cameraUpdate', handleCameraUpdateCallback);
16016
- five.off('modeChange', onFiveModeChange);
16013
+
16014
+ // five.off('modeChange', onFiveModeChange)
16017
16015
  window.removeEventListener('resize', onResize, false);
16018
16016
  });
16019
16017
 
@@ -16027,10 +16025,11 @@ function instance($$self, $$props, $$invalidate) {
16027
16025
  $$self.$$set = $$props => {
16028
16026
  if ('five' in $$props) $$invalidate(7, five = $$props.five);
16029
16027
  if ('modelOcclusionEnable' in $$props) $$invalidate(8, modelOcclusionEnable = $$props.modelOcclusionEnable);
16030
- if ('itemLabels' in $$props) $$invalidate(9, itemLabels = $$props.itemLabels);
16028
+ if ('onlyVisibleInPanorama' in $$props) $$invalidate(9, onlyVisibleInPanorama = $$props.onlyVisibleInPanorama);
16029
+ if ('itemLabels' in $$props) $$invalidate(10, itemLabels = $$props.itemLabels);
16031
16030
  if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
16032
- if ('displayStrategyType' in $$props) $$invalidate(10, displayStrategyType = $$props.displayStrategyType);
16033
- if ('maxVisibleDistance' in $$props) $$invalidate(11, maxVisibleDistance = $$props.maxVisibleDistance);
16031
+ if ('displayStrategyType' in $$props) $$invalidate(11, displayStrategyType = $$props.displayStrategyType);
16032
+ if ('maxVisibleDistance' in $$props) $$invalidate(12, maxVisibleDistance = $$props.maxVisibleDistance);
16034
16033
  };
16035
16034
 
16036
16035
  return [
@@ -16043,6 +16042,7 @@ function instance($$self, $$props, $$invalidate) {
16043
16042
  onIconClick,
16044
16043
  five,
16045
16044
  modelOcclusionEnable,
16045
+ onlyVisibleInPanorama,
16046
16046
  itemLabels,
16047
16047
  displayStrategyType,
16048
16048
  maxVisibleDistance,
@@ -16063,10 +16063,11 @@ class ItemLabelComponent extends SvelteComponent {
16063
16063
  {
16064
16064
  five: 7,
16065
16065
  modelOcclusionEnable: 8,
16066
- itemLabels: 9,
16066
+ onlyVisibleInPanorama: 9,
16067
+ itemLabels: 10,
16067
16068
  hooks: 0,
16068
- displayStrategyType: 10,
16069
- maxVisibleDistance: 11
16069
+ displayStrategyType: 11,
16070
+ maxVisibleDistance: 12
16070
16071
  },
16071
16072
  add_css,
16072
16073
  [-1, -1]
@@ -16076,12 +16077,12 @@ class ItemLabelComponent extends SvelteComponent {
16076
16077
 
16077
16078
  /** @description 转成内部所需数据 */
16078
16079
  function parseItemLabelPluginData(data) {
16079
- return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined }, label)));
16080
+ return data.item_labels.map(label => (Object.assign(Object.assign({}, label), { modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined })));
16080
16081
  }
16081
16082
 
16082
16083
  const defaultMaxVisibleDistance = undefined;
16083
16084
  const Plugin = (five, params) => {
16084
- var _a, _b, _c;
16085
+ var _a, _b, _c, _d;
16085
16086
  const pluginState = {
16086
16087
  container: document.createElement('div'),
16087
16088
  data: null,
@@ -16092,8 +16093,9 @@ const Plugin = (five, params) => {
16092
16093
  app: undefined,
16093
16094
  hooks: new Subscribe(),
16094
16095
  modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
16095
- displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
16096
- maxVisibleDistance: (_c = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _c !== void 0 ? _c : defaultMaxVisibleDistance,
16096
+ onlyVisibleInPanorama: (_b = params === null || params === void 0 ? void 0 : params.onlyVisibleInPanorama) !== null && _b !== void 0 ? _b : true,
16097
+ displayStrategyType: (_c = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _c !== void 0 ? _c : ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
16098
+ maxVisibleDistance: (_d = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _d !== void 0 ? _d : defaultMaxVisibleDistance,
16097
16099
  };
16098
16100
  pluginState.container.setAttribute('class', 'item-label-plugin-container');
16099
16101
  pluginState.container.style.cssText = `
@@ -16130,6 +16132,7 @@ const Plugin = (five, params) => {
16130
16132
  return true;
16131
16133
  };
16132
16134
  const dispose = () => {
16135
+ removeListener4Five();
16133
16136
  pluginState.container.remove();
16134
16137
  };
16135
16138
  const render = () => {
@@ -16149,6 +16152,7 @@ const Plugin = (five, params) => {
16149
16152
  props: {
16150
16153
  five: five,
16151
16154
  modelOcclusionEnable: pluginState.modelOcclusionEnable,
16155
+ onlyVisibleInPanorama: pluginState.onlyVisibleInPanorama,
16152
16156
  itemLabels: pluginState.itemLabels,
16153
16157
  wrapper: pluginState.wrapper,
16154
16158
  hooks: pluginState.hooks,
@@ -16166,9 +16170,27 @@ const Plugin = (five, params) => {
16166
16170
  };
16167
16171
  // 添加 five 监听
16168
16172
  const addListener4Five = () => {
16169
- // five.on('modeChange', onFiveModeChange)
16173
+ five.on('modeChange', onFiveModeChange);
16170
16174
  five.once('dispose', dispose);
16171
16175
  };
16176
+ // 取消 five 监听
16177
+ const removeListener4Five = () => {
16178
+ five.off('modeChange', onFiveModeChange);
16179
+ };
16180
+ const onFiveModeChange = (mode) => {
16181
+ // if (!pluginState.enabled) return
16182
+ if (mode !== Five.Mode.Panorama) {
16183
+ pluginState.fiveModeEnabled = false;
16184
+ disable();
16185
+ return;
16186
+ }
16187
+ // pluginState.fiveModeEnabled = false
16188
+ // render()
16189
+ five.once('initAnimationEnded', () => {
16190
+ pluginState.fiveModeEnabled = true;
16191
+ enable();
16192
+ });
16193
+ };
16172
16194
  addListener4Five();
16173
16195
  return {
16174
16196
  appendTo,
@@ -16185,4 +16207,6 @@ const itemLabelPluginServerParams = {
16185
16207
  version: 0,
16186
16208
  };
16187
16209
 
16188
- export { CSS3DRenderPlugin, CameraMovementEffect, CameraMovementPlugin, DIRECTION, DISPLAY_STRATEGY_TYPE, FLOOR_PLAN_ATTACHED_TO, FLOOR_TYPE_MAP, ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE, Plugin as ItemLabelPlugin, Magnifier, ModelChassisCompassPlugin, ModelEntryDoorGuidePlugin, ModelFloorplanPlugin, ModelItemLabelPlugin, ModelRoomLabelPlugin, ModelTVVideoPlugin, ModelViewPlugin, PanoCompassPlugin, PanoCursorRaycasterPlugin, PanoFloorplanRadarPlugin, PanoMeasurePlugin, PanoRulerPlugin, PanoRulerProPlugin, PanoSpatialTagPlugin, ROOM_FETILE_TYPE_MAP, ROOM_TYPE_MAP, Rotation, TopviewFloorplanPlugin, itemLabelPluginServerParams, modelItemLabelPluginServerParams, modelRoomLabelPluginServerParams, panoCompassPluginServerParams };
16210
+ const DnalogelVersion = '2.0.0-alpha.38';
16211
+
16212
+ export { CSS3DRenderPlugin, CameraMovementEffect, CameraMovementPlugin, DIRECTION, DISPLAY_STRATEGY_TYPE, DnalogelVersion, FLOOR_PLAN_ATTACHED_TO, FLOOR_TYPE_MAP, ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE, Plugin as ItemLabelPlugin, Magnifier, ModelChassisCompassPlugin, ModelEntryDoorGuidePlugin, ModelFloorplanPlugin, ModelItemLabelPlugin, ModelRoomLabelPlugin, ModelTVVideoPlugin, ModelViewPlugin, PanoCompassPlugin, PanoCursorRaycasterPlugin, PanoFloorplanRadarPlugin, PanoMeasurePlugin, PanoRulerPlugin, PanoRulerProPlugin, PanoSpatialTagPlugin, ROOM_FETILE_TYPE_MAP, ROOM_TYPE_MAP, Rotation, TopviewFloorplanPlugin, itemLabelPluginServerParams, modelItemLabelPluginServerParams, modelRoomLabelPluginServerParams, panoCompassPluginServerParams };