@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
package/dist/index.js CHANGED
@@ -15601,18 +15601,18 @@ function add_css(target) {
15601
15601
 
15602
15602
  function get_each_context(ctx, list, i) {
15603
15603
  const child_ctx = ctx.slice();
15604
- child_ctx[30] = list[i];
15604
+ child_ctx[31] = list[i];
15605
15605
  return child_ctx;
15606
15606
  }
15607
15607
 
15608
- // (229:2) {#if itemLabelItem.visible}
15608
+ // (234:2) {#if itemLabelItem.visible}
15609
15609
  function create_if_block(ctx) {
15610
15610
  let itemlabelitem;
15611
15611
  let current;
15612
15612
 
15613
15613
  itemlabelitem = new ItemLabelItem({
15614
15614
  props: {
15615
- itemLabel: /*itemLabelItem*/ ctx[30],
15615
+ itemLabel: /*itemLabelItem*/ ctx[31],
15616
15616
  hooks: /*hooks*/ ctx[0],
15617
15617
  anchorEnabled: /*anchorEnabled*/ ctx[2],
15618
15618
  onIconClick: /*onIconClick*/ ctx[6]
@@ -15629,7 +15629,7 @@ function create_if_block(ctx) {
15629
15629
  },
15630
15630
  p(ctx, dirty) {
15631
15631
  const itemlabelitem_changes = {};
15632
- if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[30];
15632
+ if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[31];
15633
15633
  if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
15634
15634
  if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
15635
15635
  itemlabelitem.$set(itemlabelitem_changes);
@@ -15649,12 +15649,12 @@ function create_if_block(ctx) {
15649
15649
  };
15650
15650
  }
15651
15651
 
15652
- // (228:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
15652
+ // (233:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
15653
15653
  function create_each_block(key_1, ctx) {
15654
15654
  let first;
15655
15655
  let if_block_anchor;
15656
15656
  let current;
15657
- let if_block = /*itemLabelItem*/ ctx[30].visible && create_if_block(ctx);
15657
+ let if_block = /*itemLabelItem*/ ctx[31].visible && create_if_block(ctx);
15658
15658
 
15659
15659
  return {
15660
15660
  key: key_1,
@@ -15674,7 +15674,7 @@ function create_each_block(key_1, ctx) {
15674
15674
  p(new_ctx, dirty) {
15675
15675
  ctx = new_ctx;
15676
15676
 
15677
- if (/*itemLabelItem*/ ctx[30].visible) {
15677
+ if (/*itemLabelItem*/ ctx[31].visible) {
15678
15678
  if (if_block) {
15679
15679
  if_block.p(ctx, dirty);
15680
15680
 
@@ -15721,7 +15721,7 @@ function create_fragment(ctx) {
15721
15721
  let div_resize_listener;
15722
15722
  let current;
15723
15723
  let each_value = /*renderItemLabels*/ ctx[1];
15724
- const get_key = ctx => /*itemLabelItem*/ ctx[30].id;
15724
+ const get_key = ctx => /*itemLabelItem*/ ctx[31].id;
15725
15725
 
15726
15726
  for (let i = 0; i < each_value.length; i += 1) {
15727
15727
  let child_ctx = get_each_context(ctx, each_value, i);
@@ -15738,7 +15738,7 @@ function create_fragment(ctx) {
15738
15738
  }
15739
15739
 
15740
15740
  internal.attr(div, "class", "item-labels-container svelte-gk8s47");
15741
- internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[12].call(div));
15741
+ internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
15742
15742
  internal.set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
15743
15743
  },
15744
15744
  m(target, anchor) {
@@ -15748,7 +15748,7 @@ function create_fragment(ctx) {
15748
15748
  each_blocks[i].m(div, null);
15749
15749
  }
15750
15750
 
15751
- div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[12].bind(div));
15751
+ div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
15752
15752
  current = true;
15753
15753
  },
15754
15754
  p(ctx, dirty) {
@@ -15796,6 +15796,7 @@ function instance($$self, $$props, $$invalidate) {
15796
15796
  const { Raycaster, Vector3 } = THREE__namespace;
15797
15797
  let { five: five$1 } = $$props;
15798
15798
  let { modelOcclusionEnable } = $$props;
15799
+ let { onlyVisibleInPanorama } = $$props;
15799
15800
  let { itemLabels } = $$props;
15800
15801
  let { hooks } = $$props;
15801
15802
  let { displayStrategyType } = $$props;
@@ -15847,7 +15848,10 @@ function instance($$self, $$props, $$invalidate) {
15847
15848
  const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
15848
15849
  const isFront = Math.abs(offsetZFromCenter) < 1;
15849
15850
  const cssOffset = [ratioFromLeft, ratioFromTop];
15851
+
15852
+ // 只计算在前面就行
15850
15853
  const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
15854
+
15851
15855
  return Boolean(isInViewport);
15852
15856
  };
15853
15857
 
@@ -15870,6 +15874,11 @@ function instance($$self, $$props, $$invalidate) {
15870
15874
  const getFormatedItemLabels = (five$1, labels) => {
15871
15875
  // 计算位置 & 可见性
15872
15876
  const newLabels = labels.map(label => {
15877
+ // 不在绑定点位则直接不可见
15878
+ if (five$1.state.panoIndex !== label.panoIndex) {
15879
+ return Object.assign(Object.assign({}, label), { visible: false });
15880
+ }
15881
+
15873
15882
  const cssOffset = getLabelCssOffset(five$1, label);
15874
15883
  label.name.length * basicWidth;
15875
15884
  const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
@@ -15922,16 +15931,6 @@ function instance($$self, $$props, $$invalidate) {
15922
15931
  handleCameraUpdate();
15923
15932
  };
15924
15933
 
15925
- const onFiveModeChange = mode => {
15926
- $$invalidate(5, itemsVisible = false);
15927
-
15928
- five$1.once('initAnimationEnded', (panoIndex, pose, userAction) => {
15929
- $$invalidate(2, anchorEnabled = mode === five.Five.Mode.Panorama);
15930
- $$invalidate(5, itemsVisible = true);
15931
- if (!userAction) return; else onItemLabelUpdate();
15932
- });
15933
- };
15934
-
15935
15934
  const handleCameraUpdate = debounce(
15936
15935
  () => {
15937
15936
  $$invalidate(5, itemsVisible = true);
@@ -15989,11 +15988,10 @@ function instance($$self, $$props, $$invalidate) {
15989
15988
  const onIconClick = itemLabel => {
15990
15989
  if (five$1.state.mode === five.Five.Mode.Panorama) return;
15991
15990
  const observers = five$1.work.observers;
15992
- const fromPositionVector = new Vector3(itemLabel.position[0], itemLabel.position[1], itemLabel.position[2]);
15991
+ const fromPositionVector = new Vector3().fromArray(itemLabel.position);
15993
15992
  const observer = getNearObserverPano(fromPositionVector, observers);
15994
15993
 
15995
15994
  if (observer) {
15996
- console.log('--has observer--');
15997
15995
  itemLabel.observerIndex = observer.panoIndex;
15998
15996
  }
15999
15997
 
@@ -16036,12 +16034,12 @@ function instance($$self, $$props, $$invalidate) {
16036
16034
  onItemLabelUpdate();
16037
16035
  addResizeListener();
16038
16036
  five$1.on('cameraUpdate', handleCameraUpdateCallback);
16039
- five$1.on('modeChange', onFiveModeChange);
16040
- });
16037
+ }); // five.on('modeChange', onFiveModeChange)
16041
16038
 
16042
16039
  svelte.onDestroy(() => {
16043
16040
  five$1.off('cameraUpdate', handleCameraUpdateCallback);
16044
- five$1.off('modeChange', onFiveModeChange);
16041
+
16042
+ // five.off('modeChange', onFiveModeChange)
16045
16043
  window.removeEventListener('resize', onResize, false);
16046
16044
  });
16047
16045
 
@@ -16055,10 +16053,11 @@ function instance($$self, $$props, $$invalidate) {
16055
16053
  $$self.$$set = $$props => {
16056
16054
  if ('five' in $$props) $$invalidate(7, five$1 = $$props.five);
16057
16055
  if ('modelOcclusionEnable' in $$props) $$invalidate(8, modelOcclusionEnable = $$props.modelOcclusionEnable);
16058
- if ('itemLabels' in $$props) $$invalidate(9, itemLabels = $$props.itemLabels);
16056
+ if ('onlyVisibleInPanorama' in $$props) $$invalidate(9, onlyVisibleInPanorama = $$props.onlyVisibleInPanorama);
16057
+ if ('itemLabels' in $$props) $$invalidate(10, itemLabels = $$props.itemLabels);
16059
16058
  if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
16060
- if ('displayStrategyType' in $$props) $$invalidate(10, displayStrategyType = $$props.displayStrategyType);
16061
- if ('maxVisibleDistance' in $$props) $$invalidate(11, maxVisibleDistance = $$props.maxVisibleDistance);
16059
+ if ('displayStrategyType' in $$props) $$invalidate(11, displayStrategyType = $$props.displayStrategyType);
16060
+ if ('maxVisibleDistance' in $$props) $$invalidate(12, maxVisibleDistance = $$props.maxVisibleDistance);
16062
16061
  };
16063
16062
 
16064
16063
  return [
@@ -16071,6 +16070,7 @@ function instance($$self, $$props, $$invalidate) {
16071
16070
  onIconClick,
16072
16071
  five$1,
16073
16072
  modelOcclusionEnable,
16073
+ onlyVisibleInPanorama,
16074
16074
  itemLabels,
16075
16075
  displayStrategyType,
16076
16076
  maxVisibleDistance,
@@ -16091,10 +16091,11 @@ class ItemLabelComponent extends internal.SvelteComponent {
16091
16091
  {
16092
16092
  five: 7,
16093
16093
  modelOcclusionEnable: 8,
16094
- itemLabels: 9,
16094
+ onlyVisibleInPanorama: 9,
16095
+ itemLabels: 10,
16095
16096
  hooks: 0,
16096
- displayStrategyType: 10,
16097
- maxVisibleDistance: 11
16097
+ displayStrategyType: 11,
16098
+ maxVisibleDistance: 12
16098
16099
  },
16099
16100
  add_css,
16100
16101
  [-1, -1]
@@ -16104,12 +16105,12 @@ class ItemLabelComponent extends internal.SvelteComponent {
16104
16105
 
16105
16106
  /** @description 转成内部所需数据 */
16106
16107
  function parseItemLabelPluginData(data) {
16107
- return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined }, label)));
16108
+ return data.item_labels.map(label => (Object.assign(Object.assign({}, label), { modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined })));
16108
16109
  }
16109
16110
 
16110
16111
  const defaultMaxVisibleDistance = undefined;
16111
16112
  const Plugin = (five$1, params) => {
16112
- var _a, _b, _c;
16113
+ var _a, _b, _c, _d;
16113
16114
  const pluginState = {
16114
16115
  container: document.createElement('div'),
16115
16116
  data: null,
@@ -16120,8 +16121,9 @@ const Plugin = (five$1, params) => {
16120
16121
  app: undefined,
16121
16122
  hooks: new five.Subscribe(),
16122
16123
  modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
16123
- displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
16124
- maxVisibleDistance: (_c = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _c !== void 0 ? _c : defaultMaxVisibleDistance,
16124
+ onlyVisibleInPanorama: (_b = params === null || params === void 0 ? void 0 : params.onlyVisibleInPanorama) !== null && _b !== void 0 ? _b : true,
16125
+ displayStrategyType: (_c = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _c !== void 0 ? _c : exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
16126
+ maxVisibleDistance: (_d = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _d !== void 0 ? _d : defaultMaxVisibleDistance,
16125
16127
  };
16126
16128
  pluginState.container.setAttribute('class', 'item-label-plugin-container');
16127
16129
  pluginState.container.style.cssText = `
@@ -16158,6 +16160,7 @@ const Plugin = (five$1, params) => {
16158
16160
  return true;
16159
16161
  };
16160
16162
  const dispose = () => {
16163
+ removeListener4Five();
16161
16164
  pluginState.container.remove();
16162
16165
  };
16163
16166
  const render = () => {
@@ -16177,6 +16180,7 @@ const Plugin = (five$1, params) => {
16177
16180
  props: {
16178
16181
  five: five$1,
16179
16182
  modelOcclusionEnable: pluginState.modelOcclusionEnable,
16183
+ onlyVisibleInPanorama: pluginState.onlyVisibleInPanorama,
16180
16184
  itemLabels: pluginState.itemLabels,
16181
16185
  wrapper: pluginState.wrapper,
16182
16186
  hooks: pluginState.hooks,
@@ -16194,9 +16198,27 @@ const Plugin = (five$1, params) => {
16194
16198
  };
16195
16199
  // 添加 five 监听
16196
16200
  const addListener4Five = () => {
16197
- // five.on('modeChange', onFiveModeChange)
16201
+ five$1.on('modeChange', onFiveModeChange);
16198
16202
  five$1.once('dispose', dispose);
16199
16203
  };
16204
+ // 取消 five 监听
16205
+ const removeListener4Five = () => {
16206
+ five$1.off('modeChange', onFiveModeChange);
16207
+ };
16208
+ const onFiveModeChange = (mode) => {
16209
+ // if (!pluginState.enabled) return
16210
+ if (mode !== five.Five.Mode.Panorama) {
16211
+ pluginState.fiveModeEnabled = false;
16212
+ disable();
16213
+ return;
16214
+ }
16215
+ // pluginState.fiveModeEnabled = false
16216
+ // render()
16217
+ five$1.once('initAnimationEnded', () => {
16218
+ pluginState.fiveModeEnabled = true;
16219
+ enable();
16220
+ });
16221
+ };
16200
16222
  addListener4Five();
16201
16223
  return {
16202
16224
  appendTo,
@@ -16213,8 +16235,11 @@ const itemLabelPluginServerParams = {
16213
16235
  version: 0,
16214
16236
  };
16215
16237
 
16238
+ const DnalogelVersion = '2.0.0-alpha.38';
16239
+
16216
16240
  exports.CSS3DRenderPlugin = CSS3DRenderPlugin;
16217
16241
  exports.CameraMovementPlugin = CameraMovementPlugin;
16242
+ exports.DnalogelVersion = DnalogelVersion;
16218
16243
  exports.FLOOR_TYPE_MAP = FLOOR_TYPE_MAP;
16219
16244
  exports.ItemLabelPlugin = Plugin;
16220
16245
  exports.Magnifier = Magnifier;
package/dist/index.umd.js CHANGED
@@ -15589,18 +15589,18 @@ void main() {
15589
15589
 
15590
15590
  function get_each_context(ctx, list, i) {
15591
15591
  const child_ctx = ctx.slice();
15592
- child_ctx[30] = list[i];
15592
+ child_ctx[31] = list[i];
15593
15593
  return child_ctx;
15594
15594
  }
15595
15595
 
15596
- // (229:2) {#if itemLabelItem.visible}
15596
+ // (234:2) {#if itemLabelItem.visible}
15597
15597
  function create_if_block(ctx) {
15598
15598
  let itemlabelitem;
15599
15599
  let current;
15600
15600
 
15601
15601
  itemlabelitem = new ItemLabelItem({
15602
15602
  props: {
15603
- itemLabel: /*itemLabelItem*/ ctx[30],
15603
+ itemLabel: /*itemLabelItem*/ ctx[31],
15604
15604
  hooks: /*hooks*/ ctx[0],
15605
15605
  anchorEnabled: /*anchorEnabled*/ ctx[2],
15606
15606
  onIconClick: /*onIconClick*/ ctx[6]
@@ -15617,7 +15617,7 @@ void main() {
15617
15617
  },
15618
15618
  p(ctx, dirty) {
15619
15619
  const itemlabelitem_changes = {};
15620
- if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[30];
15620
+ if (dirty[0] & /*renderItemLabels*/ 2) itemlabelitem_changes.itemLabel = /*itemLabelItem*/ ctx[31];
15621
15621
  if (dirty[0] & /*hooks*/ 1) itemlabelitem_changes.hooks = /*hooks*/ ctx[0];
15622
15622
  if (dirty[0] & /*anchorEnabled*/ 4) itemlabelitem_changes.anchorEnabled = /*anchorEnabled*/ ctx[2];
15623
15623
  itemlabelitem.$set(itemlabelitem_changes);
@@ -15637,12 +15637,12 @@ void main() {
15637
15637
  };
15638
15638
  }
15639
15639
 
15640
- // (228:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
15640
+ // (233:1) {#each renderItemLabels as itemLabelItem (itemLabelItem.id)}
15641
15641
  function create_each_block(key_1, ctx) {
15642
15642
  let first;
15643
15643
  let if_block_anchor;
15644
15644
  let current;
15645
- let if_block = /*itemLabelItem*/ ctx[30].visible && create_if_block(ctx);
15645
+ let if_block = /*itemLabelItem*/ ctx[31].visible && create_if_block(ctx);
15646
15646
 
15647
15647
  return {
15648
15648
  key: key_1,
@@ -15662,7 +15662,7 @@ void main() {
15662
15662
  p(new_ctx, dirty) {
15663
15663
  ctx = new_ctx;
15664
15664
 
15665
- if (/*itemLabelItem*/ ctx[30].visible) {
15665
+ if (/*itemLabelItem*/ ctx[31].visible) {
15666
15666
  if (if_block) {
15667
15667
  if_block.p(ctx, dirty);
15668
15668
 
@@ -15709,7 +15709,7 @@ void main() {
15709
15709
  let div_resize_listener;
15710
15710
  let current;
15711
15711
  let each_value = /*renderItemLabels*/ ctx[1];
15712
- const get_key = ctx => /*itemLabelItem*/ ctx[30].id;
15712
+ const get_key = ctx => /*itemLabelItem*/ ctx[31].id;
15713
15713
 
15714
15714
  for (let i = 0; i < each_value.length; i += 1) {
15715
15715
  let child_ctx = get_each_context(ctx, each_value, i);
@@ -15726,7 +15726,7 @@ void main() {
15726
15726
  }
15727
15727
 
15728
15728
  internal.attr(div, "class", "item-labels-container svelte-gk8s47");
15729
- internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[12].call(div));
15729
+ internal.add_render_callback(() => /*div_elementresize_handler*/ ctx[13].call(div));
15730
15730
  internal.set_style(div, "opacity", /*itemsVisible*/ ctx[5] ? 1 : 0, false);
15731
15731
  },
15732
15732
  m(target, anchor) {
@@ -15736,7 +15736,7 @@ void main() {
15736
15736
  each_blocks[i].m(div, null);
15737
15737
  }
15738
15738
 
15739
- div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[12].bind(div));
15739
+ div_resize_listener = internal.add_resize_listener(div, /*div_elementresize_handler*/ ctx[13].bind(div));
15740
15740
  current = true;
15741
15741
  },
15742
15742
  p(ctx, dirty) {
@@ -15784,6 +15784,7 @@ void main() {
15784
15784
  const { Raycaster, Vector3 } = THREE__namespace;
15785
15785
  let { five: five$1 } = $$props;
15786
15786
  let { modelOcclusionEnable } = $$props;
15787
+ let { onlyVisibleInPanorama } = $$props;
15787
15788
  let { itemLabels } = $$props;
15788
15789
  let { hooks } = $$props;
15789
15790
  let { displayStrategyType } = $$props;
@@ -15835,7 +15836,10 @@ void main() {
15835
15836
  const ratioFromTop = (2 - (offsetYFromCenter + 1)) / 2;
15836
15837
  const isFront = Math.abs(offsetZFromCenter) < 1;
15837
15838
  const cssOffset = [ratioFromLeft, ratioFromTop];
15839
+
15840
+ // 只计算在前面就行
15838
15841
  const isInViewport = isFront && cssOffset.every(ratio => ratio < 1 && ratio >= 0);
15842
+
15839
15843
  return Boolean(isInViewport);
15840
15844
  };
15841
15845
 
@@ -15858,6 +15862,11 @@ void main() {
15858
15862
  const getFormatedItemLabels = (five$1, labels) => {
15859
15863
  // 计算位置 & 可见性
15860
15864
  const newLabels = labels.map(label => {
15865
+ // 不在绑定点位则直接不可见
15866
+ if (five$1.state.panoIndex !== label.panoIndex) {
15867
+ return Object.assign(Object.assign({}, label), { visible: false });
15868
+ }
15869
+
15861
15870
  const cssOffset = getLabelCssOffset(five$1, label);
15862
15871
  label.name.length * basicWidth;
15863
15872
  const strokeLength = getStrokeLength(label.modelPosition[1], displayStrategyType);
@@ -15910,16 +15919,6 @@ void main() {
15910
15919
  handleCameraUpdate();
15911
15920
  };
15912
15921
 
15913
- const onFiveModeChange = mode => {
15914
- $$invalidate(5, itemsVisible = false);
15915
-
15916
- five$1.once('initAnimationEnded', (panoIndex, pose, userAction) => {
15917
- $$invalidate(2, anchorEnabled = mode === five.Five.Mode.Panorama);
15918
- $$invalidate(5, itemsVisible = true);
15919
- if (!userAction) return; else onItemLabelUpdate();
15920
- });
15921
- };
15922
-
15923
15922
  const handleCameraUpdate = debounce(
15924
15923
  () => {
15925
15924
  $$invalidate(5, itemsVisible = true);
@@ -15977,11 +15976,10 @@ void main() {
15977
15976
  const onIconClick = itemLabel => {
15978
15977
  if (five$1.state.mode === five.Five.Mode.Panorama) return;
15979
15978
  const observers = five$1.work.observers;
15980
- const fromPositionVector = new Vector3(itemLabel.position[0], itemLabel.position[1], itemLabel.position[2]);
15979
+ const fromPositionVector = new Vector3().fromArray(itemLabel.position);
15981
15980
  const observer = getNearObserverPano(fromPositionVector, observers);
15982
15981
 
15983
15982
  if (observer) {
15984
- console.log('--has observer--');
15985
15983
  itemLabel.observerIndex = observer.panoIndex;
15986
15984
  }
15987
15985
 
@@ -16024,12 +16022,12 @@ void main() {
16024
16022
  onItemLabelUpdate();
16025
16023
  addResizeListener();
16026
16024
  five$1.on('cameraUpdate', handleCameraUpdateCallback);
16027
- five$1.on('modeChange', onFiveModeChange);
16028
- });
16025
+ }); // five.on('modeChange', onFiveModeChange)
16029
16026
 
16030
16027
  svelte.onDestroy(() => {
16031
16028
  five$1.off('cameraUpdate', handleCameraUpdateCallback);
16032
- five$1.off('modeChange', onFiveModeChange);
16029
+
16030
+ // five.off('modeChange', onFiveModeChange)
16033
16031
  window.removeEventListener('resize', onResize, false);
16034
16032
  });
16035
16033
 
@@ -16043,10 +16041,11 @@ void main() {
16043
16041
  $$self.$$set = $$props => {
16044
16042
  if ('five' in $$props) $$invalidate(7, five$1 = $$props.five);
16045
16043
  if ('modelOcclusionEnable' in $$props) $$invalidate(8, modelOcclusionEnable = $$props.modelOcclusionEnable);
16046
- if ('itemLabels' in $$props) $$invalidate(9, itemLabels = $$props.itemLabels);
16044
+ if ('onlyVisibleInPanorama' in $$props) $$invalidate(9, onlyVisibleInPanorama = $$props.onlyVisibleInPanorama);
16045
+ if ('itemLabels' in $$props) $$invalidate(10, itemLabels = $$props.itemLabels);
16047
16046
  if ('hooks' in $$props) $$invalidate(0, hooks = $$props.hooks);
16048
- if ('displayStrategyType' in $$props) $$invalidate(10, displayStrategyType = $$props.displayStrategyType);
16049
- if ('maxVisibleDistance' in $$props) $$invalidate(11, maxVisibleDistance = $$props.maxVisibleDistance);
16047
+ if ('displayStrategyType' in $$props) $$invalidate(11, displayStrategyType = $$props.displayStrategyType);
16048
+ if ('maxVisibleDistance' in $$props) $$invalidate(12, maxVisibleDistance = $$props.maxVisibleDistance);
16050
16049
  };
16051
16050
 
16052
16051
  return [
@@ -16059,6 +16058,7 @@ void main() {
16059
16058
  onIconClick,
16060
16059
  five$1,
16061
16060
  modelOcclusionEnable,
16061
+ onlyVisibleInPanorama,
16062
16062
  itemLabels,
16063
16063
  displayStrategyType,
16064
16064
  maxVisibleDistance,
@@ -16079,10 +16079,11 @@ void main() {
16079
16079
  {
16080
16080
  five: 7,
16081
16081
  modelOcclusionEnable: 8,
16082
- itemLabels: 9,
16082
+ onlyVisibleInPanorama: 9,
16083
+ itemLabels: 10,
16083
16084
  hooks: 0,
16084
- displayStrategyType: 10,
16085
- maxVisibleDistance: 11
16085
+ displayStrategyType: 11,
16086
+ maxVisibleDistance: 12
16086
16087
  },
16087
16088
  add_css,
16088
16089
  [-1, -1]
@@ -16092,12 +16093,12 @@ void main() {
16092
16093
 
16093
16094
  /** @description 转成内部所需数据 */
16094
16095
  function parseItemLabelPluginData(data) {
16095
- return data.item_labels.map(label => (Object.assign({ modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined }, label)));
16096
+ return data.item_labels.map(label => (Object.assign(Object.assign({}, label), { modelPosition: [label.position[0], label.position[1], label.position[2]], observerIndex: undefined })));
16096
16097
  }
16097
16098
 
16098
16099
  const defaultMaxVisibleDistance = undefined;
16099
16100
  const Plugin = (five$1, params) => {
16100
- var _a, _b, _c;
16101
+ var _a, _b, _c, _d;
16101
16102
  const pluginState = {
16102
16103
  container: document.createElement('div'),
16103
16104
  data: null,
@@ -16108,8 +16109,9 @@ void main() {
16108
16109
  app: undefined,
16109
16110
  hooks: new five.Subscribe(),
16110
16111
  modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
16111
- displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
16112
- maxVisibleDistance: (_c = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _c !== void 0 ? _c : defaultMaxVisibleDistance,
16112
+ onlyVisibleInPanorama: (_b = params === null || params === void 0 ? void 0 : params.onlyVisibleInPanorama) !== null && _b !== void 0 ? _b : true,
16113
+ displayStrategyType: (_c = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _c !== void 0 ? _c : exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.SMALL,
16114
+ maxVisibleDistance: (_d = params === null || params === void 0 ? void 0 : params.maxVisibleDistance) !== null && _d !== void 0 ? _d : defaultMaxVisibleDistance,
16113
16115
  };
16114
16116
  pluginState.container.setAttribute('class', 'item-label-plugin-container');
16115
16117
  pluginState.container.style.cssText = `
@@ -16146,6 +16148,7 @@ void main() {
16146
16148
  return true;
16147
16149
  };
16148
16150
  const dispose = () => {
16151
+ removeListener4Five();
16149
16152
  pluginState.container.remove();
16150
16153
  };
16151
16154
  const render = () => {
@@ -16165,6 +16168,7 @@ void main() {
16165
16168
  props: {
16166
16169
  five: five$1,
16167
16170
  modelOcclusionEnable: pluginState.modelOcclusionEnable,
16171
+ onlyVisibleInPanorama: pluginState.onlyVisibleInPanorama,
16168
16172
  itemLabels: pluginState.itemLabels,
16169
16173
  wrapper: pluginState.wrapper,
16170
16174
  hooks: pluginState.hooks,
@@ -16182,9 +16186,27 @@ void main() {
16182
16186
  };
16183
16187
  // 添加 five 监听
16184
16188
  const addListener4Five = () => {
16185
- // five.on('modeChange', onFiveModeChange)
16189
+ five$1.on('modeChange', onFiveModeChange);
16186
16190
  five$1.once('dispose', dispose);
16187
16191
  };
16192
+ // 取消 five 监听
16193
+ const removeListener4Five = () => {
16194
+ five$1.off('modeChange', onFiveModeChange);
16195
+ };
16196
+ const onFiveModeChange = (mode) => {
16197
+ // if (!pluginState.enabled) return
16198
+ if (mode !== five.Five.Mode.Panorama) {
16199
+ pluginState.fiveModeEnabled = false;
16200
+ disable();
16201
+ return;
16202
+ }
16203
+ // pluginState.fiveModeEnabled = false
16204
+ // render()
16205
+ five$1.once('initAnimationEnded', () => {
16206
+ pluginState.fiveModeEnabled = true;
16207
+ enable();
16208
+ });
16209
+ };
16188
16210
  addListener4Five();
16189
16211
  return {
16190
16212
  appendTo,
@@ -16201,8 +16223,11 @@ void main() {
16201
16223
  version: 0,
16202
16224
  };
16203
16225
 
16226
+ const DnalogelVersion = '2.0.0-alpha.38';
16227
+
16204
16228
  exports.CSS3DRenderPlugin = CSS3DRenderPlugin;
16205
16229
  exports.CameraMovementPlugin = CameraMovementPlugin;
16230
+ exports.DnalogelVersion = DnalogelVersion;
16206
16231
  exports.FLOOR_TYPE_MAP = FLOOR_TYPE_MAP;
16207
16232
  exports.ItemLabelPlugin = Plugin;
16208
16233
  exports.Magnifier = Magnifier;