@realsee/dnalogel 2.0.0-alpha.35-beta2 → 2.0.0-alpha.35

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 (93) hide show
  1. package/dist/PanoSpatialTagPlugin/Plugin.d.ts +2 -0
  2. package/dist/PanoSpatialTagPlugin/index.js +40 -45
  3. package/dist/index.es.js +40 -45
  4. package/dist/index.js +40 -45
  5. package/dist/index.umd.js +40 -45
  6. package/docs/assets/search.js +1 -1
  7. package/docs/classes/Magnifier.html +4 -4
  8. package/docs/classes/ModelRoomLabelController.html +4 -4
  9. package/docs/classes/PanoFloorplanRadarPluginController.html +2 -2
  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/ModelFloorplanErrorType.html +1 -1
  16. package/docs/enums/Rotation.html +2 -2
  17. package/docs/index.html +1 -1
  18. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  19. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  20. package/docs/interfaces/FloorplanBounding.html +4 -4
  21. package/docs/interfaces/FloorplanData.html +2 -2
  22. package/docs/interfaces/FloorplanEntrance.html +7 -7
  23. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  24. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  25. package/docs/interfaces/FloorplanFloorData.html +2 -2
  26. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  27. package/docs/interfaces/FloorplanObserver.html +2 -2
  28. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  29. package/docs/interfaces/FloorplanPosition.html +2 -2
  30. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  31. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  32. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  33. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  34. package/docs/interfaces/FloorplanServerData.html +2 -2
  35. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  36. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  37. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  38. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  39. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  40. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  41. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  42. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  43. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  44. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  45. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  46. package/docs/interfaces/LineJson.html +1 -1
  47. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  48. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  49. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  50. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  51. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  52. package/docs/interfaces/ModelFloorplanParameterType.html +1 -1
  53. package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
  54. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  55. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  56. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  57. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  58. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  59. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  60. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  61. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  62. package/docs/interfaces/OpenParameter.html +2 -2
  63. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  64. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  65. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  66. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  67. package/docs/interfaces/PanoFloorplanRadarPluginControllerParameter.html +1 -1
  68. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  69. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  70. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  71. package/docs/interfaces/PanoRulerPluginParameterType.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/interfaces/TopviewFloorplanPluginParameterType.html +9 -9
  89. package/docs/modules.html +20 -20
  90. package/libs/PanoSpatialTagPlugin/Components/tag.js +2 -2
  91. package/libs/PanoSpatialTagPlugin/Plugin.d.ts +2 -0
  92. package/libs/PanoSpatialTagPlugin/Plugin.js +38 -43
  93. package/package.json +1 -1
@@ -15,6 +15,8 @@ export interface PanoSpatialTagPluginParameterType {
15
15
  minRad?: number;
16
16
  nearTolerance?: number;
17
17
  upsideHeight?: number;
18
+ minDistance?: number;
19
+ maxDistance?: number;
18
20
  }
19
21
  export interface PanoSpatialTagPluginExportType {
20
22
  load: (data: PanoSpatialTagPluginData) => void;
@@ -423,7 +423,7 @@ function create_fragment(ctx) {
423
423
  div3 = internal.element("div");
424
424
  div2 = internal.element("div");
425
425
  internal.attr(div0, "class", "PanoSpatialTagPlugin__tag-shadow svelte-eb8bdm");
426
- internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
426
+ internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
427
427
  internal.attr(i0, "class", "PanoSpatialTagPlugin__tag-flagpole svelte-eb8bdm");
428
428
  internal.set_style(i0, "width", /*lineWidthZoom*/ ctx[4] + "rem");
429
429
  internal.attr(i1, "class", "PanoSpatialTagPlugin__tag-line1 svelte-eb8bdm");
@@ -463,7 +463,7 @@ function create_fragment(ctx) {
463
463
  },
464
464
  p(ctx, [dirty]) {
465
465
  if (dirty & /*contentWidth, contentZoom, contentHeight, upsideDown*/ 394) {
466
- internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
466
+ internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
467
467
  }
468
468
 
469
469
  if (dirty & /*lineWidthZoom*/ 16) {
@@ -887,13 +887,11 @@ class Template {
887
887
  const MESH_SIZE = 0.001;
888
888
  const RAY_TOLERANT_DISTANCE = 0.01;
889
889
  const BLUR_IMAGE_URL = 'https://vrlab-image4.ljcdn.com/release/web/PanoSpatialTagPlugin__blur.png';
890
- const MIN_DISTANCE = 1.2;
891
- const MAX_DISTANCE = 3.5;
892
890
  /**
893
891
  * 空间游走标签插件
894
892
  */
895
893
  const PanoSpatialTagPlugin = (five$1, params) => {
896
- var _a, _b, _c, _d, _e, _f;
894
+ var _a, _b, _c, _d, _e, _f, _g, _h;
897
895
  let wrapper = params === null || params === void 0 ? void 0 : params.container;
898
896
  let centerY = 1.4;
899
897
  const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
@@ -901,6 +899,8 @@ const PanoSpatialTagPlugin = (five$1, params) => {
901
899
  const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
902
900
  const nearTolerance = (_d = params === null || params === void 0 ? void 0 : params.nearTolerance) !== null && _d !== void 0 ? _d : 100;
903
901
  const upsideHeight = (_e = params === null || params === void 0 ? void 0 : params.upsideHeight) !== null && _e !== void 0 ? _e : 1.6;
902
+ const minDistance = (_f = params === null || params === void 0 ? void 0 : params.minDistance) !== null && _f !== void 0 ? _f : 1.2;
903
+ const maxDistance = (_g = params === null || params === void 0 ? void 0 : params.maxDistance) !== null && _g !== void 0 ? _g : 3.5;
904
904
  // const foldPercent = params?.foldPercent ?? 20
905
905
  const css3DRender = CSS3DRenderPlugin(five$1);
906
906
  const container = document.createElement('div');
@@ -955,7 +955,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
955
955
  frustum.setFromProjectionMatrix(projScreenMatrix);
956
956
  state.tags.forEach(tag => {
957
957
  const distance = camera.position.clone().setY(centerY).distanceTo(tag.position);
958
- if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
958
+ if (distance < minDistance || distance > maxDistance)
959
959
  return tag.destroying = true;
960
960
  if (!frustum.containsPoint(tag.position))
961
961
  return tag.destroying = true;
@@ -967,16 +967,16 @@ const PanoSpatialTagPlugin = (five$1, params) => {
967
967
  state.tags.forEach(tag => {
968
968
  if (tag.destroying) {
969
969
  tag.app.$set({
970
- contentZoom: 0.1 + camera.position.distanceTo(tag.position) / MAX_DISTANCE,
971
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / MAX_DISTANCE),
970
+ contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
971
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
972
972
  destroying: tag.destroying,
973
973
  });
974
974
  }
975
975
  else {
976
976
  tag.app.$set({
977
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / MAX_DISTANCE),
978
- lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - MIN_DISTANCE) / MAX_DISTANCE * 0.6,
979
- contentZoom: 0.1 + camera.position.distanceTo(tag.position) / MAX_DISTANCE,
977
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
978
+ lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - minDistance) / maxDistance * 0.6,
979
+ contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
980
980
  });
981
981
  }
982
982
  });
@@ -1050,7 +1050,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1050
1050
  if (state.tags.find(tag => point.id === tag.id && !tag.destroying))
1051
1051
  return result;
1052
1052
  const distance = camera.position.clone().setY(centerY).distanceTo(point.position);
1053
- if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
1053
+ if (distance < minDistance || distance > maxDistance)
1054
1054
  return result;
1055
1055
  if (!frustum.containsPoint(point.position))
1056
1056
  return result;
@@ -1135,9 +1135,9 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1135
1135
  props: {
1136
1136
  id,
1137
1137
  content: state.render(state.template, replacement),
1138
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / MAX_DISTANCE),
1139
- lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - MIN_DISTANCE) / MAX_DISTANCE * 0.6,
1140
- contentZoom: 0.1 + camera.position.distanceTo(position) / MAX_DISTANCE,
1138
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / maxDistance),
1139
+ lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - minDistance) / maxDistance * 0.6,
1140
+ contentZoom: 0.1 + camera.position.distanceTo(position) / maxDistance,
1141
1141
  upsideDown: position.y > upsideHeight,
1142
1142
  folded: state.folded,
1143
1143
  events: state.events,
@@ -1248,6 +1248,22 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1248
1248
  tag.app.$set({ folded: true });
1249
1249
  });
1250
1250
  };
1251
+ const onResize = () => {
1252
+ five$1.once('renderFrame', updateOrigins);
1253
+ };
1254
+ const onModelLoaded = () => {
1255
+ if (!wrapper)
1256
+ wrapper = five$1.getElement().parentElement;
1257
+ if (wrapper)
1258
+ wrapper.appendChild(container);
1259
+ state.forbidden = false;
1260
+ centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
1261
+ updateTags();
1262
+ five$1.on('panoWillArrive', onPanoWillArrive);
1263
+ five$1.on('panoArrived', onPanoArrived);
1264
+ five$1.on('modeChange', onModeChange);
1265
+ five$1.on('cameraUpdate', onCameraUpdate);
1266
+ };
1251
1267
  const dispose = () => {
1252
1268
  blurImage = null;
1253
1269
  css3DRender.disposeAll();
@@ -1258,41 +1274,20 @@ const PanoSpatialTagPlugin = (five$1, params) => {
1258
1274
  });
1259
1275
  state.origins = [];
1260
1276
  state.tags = [];
1277
+ five$1.off('modelLoaded', onModelLoaded);
1278
+ five$1.off('renderFrame', updateOrigins);
1261
1279
  five$1.off('panoWillArrive', onPanoWillArrive);
1262
1280
  five$1.off('panoArrived', onPanoArrived);
1263
1281
  five$1.off('modeChange', onModeChange);
1264
1282
  five$1.off('cameraUpdate', onCameraUpdate);
1265
- window.removeEventListener('resize', updateOrigins, false);
1283
+ five$1.off('dispose', dispose);
1284
+ window.removeEventListener('resize', onResize, false);
1266
1285
  };
1267
- window.addEventListener('resize', updateOrigins, false);
1268
- if ((_f = five$1 === null || five$1 === void 0 ? void 0 : five$1.model) === null || _f === void 0 ? void 0 : _f.loaded) {
1269
- if (!wrapper)
1270
- wrapper = five$1.getElement().parentElement;
1271
- if (wrapper)
1272
- wrapper.appendChild(container);
1273
- state.forbidden = false;
1274
- centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
1275
- updateTags();
1276
- five$1.on('panoWillArrive', onPanoWillArrive);
1277
- five$1.on('panoArrived', onPanoArrived);
1278
- five$1.on('modeChange', onModeChange);
1279
- five$1.on('cameraUpdate', onCameraUpdate);
1280
- }
1281
- else {
1282
- five$1.once('modelLoaded', () => {
1283
- if (!wrapper)
1284
- wrapper = five$1.getElement().parentElement;
1285
- if (wrapper)
1286
- wrapper.appendChild(container);
1287
- centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
1288
- state.forbidden = false;
1289
- updateTags();
1290
- five$1.on('panoWillArrive', onPanoWillArrive);
1291
- five$1.on('panoArrived', onPanoArrived);
1292
- five$1.on('modeChange', onModeChange);
1293
- five$1.on('cameraUpdate', onCameraUpdate);
1294
- });
1295
- }
1286
+ window.addEventListener('resize', onResize, false);
1287
+ if ((_h = five$1 === null || five$1 === void 0 ? void 0 : five$1.model) === null || _h === void 0 ? void 0 : _h.loaded)
1288
+ onModelLoaded();
1289
+ else
1290
+ five$1.once('modelLoaded', onModelLoaded);
1296
1291
  five$1.on('dispose', dispose);
1297
1292
  return {
1298
1293
  load,
package/dist/index.es.js CHANGED
@@ -11964,7 +11964,7 @@ function create_fragment$4(ctx) {
11964
11964
  div3 = element("div");
11965
11965
  div2 = element("div");
11966
11966
  attr(div0, "class", "PanoSpatialTagPlugin__tag-shadow svelte-eb8bdm");
11967
- set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
11967
+ set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
11968
11968
  attr(i0, "class", "PanoSpatialTagPlugin__tag-flagpole svelte-eb8bdm");
11969
11969
  set_style(i0, "width", /*lineWidthZoom*/ ctx[4] + "rem");
11970
11970
  attr(i1, "class", "PanoSpatialTagPlugin__tag-line1 svelte-eb8bdm");
@@ -12004,7 +12004,7 @@ function create_fragment$4(ctx) {
12004
12004
  },
12005
12005
  p(ctx, [dirty]) {
12006
12006
  if (dirty & /*contentWidth, contentZoom, contentHeight, upsideDown*/ 394) {
12007
- set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
12007
+ set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
12008
12008
  }
12009
12009
 
12010
12010
  if (dirty & /*lineWidthZoom*/ 16) {
@@ -12428,13 +12428,11 @@ class Template {
12428
12428
  const MESH_SIZE = 0.001;
12429
12429
  const RAY_TOLERANT_DISTANCE = 0.01;
12430
12430
  const BLUR_IMAGE_URL = 'https://vrlab-image4.ljcdn.com/release/web/PanoSpatialTagPlugin__blur.png';
12431
- const MIN_DISTANCE = 1.2;
12432
- const MAX_DISTANCE = 3.5;
12433
12431
  /**
12434
12432
  * 空间游走标签插件
12435
12433
  */
12436
12434
  const PanoSpatialTagPlugin = (five, params) => {
12437
- var _a, _b, _c, _d, _e, _f;
12435
+ var _a, _b, _c, _d, _e, _f, _g, _h;
12438
12436
  let wrapper = params === null || params === void 0 ? void 0 : params.container;
12439
12437
  let centerY = 1.4;
12440
12438
  const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
@@ -12442,6 +12440,8 @@ const PanoSpatialTagPlugin = (five, params) => {
12442
12440
  const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
12443
12441
  const nearTolerance = (_d = params === null || params === void 0 ? void 0 : params.nearTolerance) !== null && _d !== void 0 ? _d : 100;
12444
12442
  const upsideHeight = (_e = params === null || params === void 0 ? void 0 : params.upsideHeight) !== null && _e !== void 0 ? _e : 1.6;
12443
+ const minDistance = (_f = params === null || params === void 0 ? void 0 : params.minDistance) !== null && _f !== void 0 ? _f : 1.2;
12444
+ const maxDistance = (_g = params === null || params === void 0 ? void 0 : params.maxDistance) !== null && _g !== void 0 ? _g : 3.5;
12445
12445
  // const foldPercent = params?.foldPercent ?? 20
12446
12446
  const css3DRender = CSS3DRenderPlugin(five);
12447
12447
  const container = document.createElement('div');
@@ -12496,7 +12496,7 @@ const PanoSpatialTagPlugin = (five, params) => {
12496
12496
  frustum.setFromProjectionMatrix(projScreenMatrix);
12497
12497
  state.tags.forEach(tag => {
12498
12498
  const distance = camera.position.clone().setY(centerY).distanceTo(tag.position);
12499
- if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
12499
+ if (distance < minDistance || distance > maxDistance)
12500
12500
  return tag.destroying = true;
12501
12501
  if (!frustum.containsPoint(tag.position))
12502
12502
  return tag.destroying = true;
@@ -12508,16 +12508,16 @@ const PanoSpatialTagPlugin = (five, params) => {
12508
12508
  state.tags.forEach(tag => {
12509
12509
  if (tag.destroying) {
12510
12510
  tag.app.$set({
12511
- contentZoom: 0.1 + camera.position.distanceTo(tag.position) / MAX_DISTANCE,
12512
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / MAX_DISTANCE),
12511
+ contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
12512
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
12513
12513
  destroying: tag.destroying,
12514
12514
  });
12515
12515
  }
12516
12516
  else {
12517
12517
  tag.app.$set({
12518
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / MAX_DISTANCE),
12519
- lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - MIN_DISTANCE) / MAX_DISTANCE * 0.6,
12520
- contentZoom: 0.1 + camera.position.distanceTo(tag.position) / MAX_DISTANCE,
12518
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
12519
+ lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - minDistance) / maxDistance * 0.6,
12520
+ contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
12521
12521
  });
12522
12522
  }
12523
12523
  });
@@ -12591,7 +12591,7 @@ const PanoSpatialTagPlugin = (five, params) => {
12591
12591
  if (state.tags.find(tag => point.id === tag.id && !tag.destroying))
12592
12592
  return result;
12593
12593
  const distance = camera.position.clone().setY(centerY).distanceTo(point.position);
12594
- if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
12594
+ if (distance < minDistance || distance > maxDistance)
12595
12595
  return result;
12596
12596
  if (!frustum.containsPoint(point.position))
12597
12597
  return result;
@@ -12676,9 +12676,9 @@ const PanoSpatialTagPlugin = (five, params) => {
12676
12676
  props: {
12677
12677
  id,
12678
12678
  content: state.render(state.template, replacement),
12679
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / MAX_DISTANCE),
12680
- lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - MIN_DISTANCE) / MAX_DISTANCE * 0.6,
12681
- contentZoom: 0.1 + camera.position.distanceTo(position) / MAX_DISTANCE,
12679
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / maxDistance),
12680
+ lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - minDistance) / maxDistance * 0.6,
12681
+ contentZoom: 0.1 + camera.position.distanceTo(position) / maxDistance,
12682
12682
  upsideDown: position.y > upsideHeight,
12683
12683
  folded: state.folded,
12684
12684
  events: state.events,
@@ -12789,6 +12789,22 @@ const PanoSpatialTagPlugin = (five, params) => {
12789
12789
  tag.app.$set({ folded: true });
12790
12790
  });
12791
12791
  };
12792
+ const onResize = () => {
12793
+ five.once('renderFrame', updateOrigins);
12794
+ };
12795
+ const onModelLoaded = () => {
12796
+ if (!wrapper)
12797
+ wrapper = five.getElement().parentElement;
12798
+ if (wrapper)
12799
+ wrapper.appendChild(container);
12800
+ state.forbidden = false;
12801
+ centerY = five.model.bounding.getCenter(new THREE.Vector3()).y;
12802
+ updateTags();
12803
+ five.on('panoWillArrive', onPanoWillArrive);
12804
+ five.on('panoArrived', onPanoArrived);
12805
+ five.on('modeChange', onModeChange);
12806
+ five.on('cameraUpdate', onCameraUpdate);
12807
+ };
12792
12808
  const dispose = () => {
12793
12809
  blurImage = null;
12794
12810
  css3DRender.disposeAll();
@@ -12799,41 +12815,20 @@ const PanoSpatialTagPlugin = (five, params) => {
12799
12815
  });
12800
12816
  state.origins = [];
12801
12817
  state.tags = [];
12818
+ five.off('modelLoaded', onModelLoaded);
12819
+ five.off('renderFrame', updateOrigins);
12802
12820
  five.off('panoWillArrive', onPanoWillArrive);
12803
12821
  five.off('panoArrived', onPanoArrived);
12804
12822
  five.off('modeChange', onModeChange);
12805
12823
  five.off('cameraUpdate', onCameraUpdate);
12806
- window.removeEventListener('resize', updateOrigins, false);
12824
+ five.off('dispose', dispose);
12825
+ window.removeEventListener('resize', onResize, false);
12807
12826
  };
12808
- window.addEventListener('resize', updateOrigins, false);
12809
- if ((_f = five === null || five === void 0 ? void 0 : five.model) === null || _f === void 0 ? void 0 : _f.loaded) {
12810
- if (!wrapper)
12811
- wrapper = five.getElement().parentElement;
12812
- if (wrapper)
12813
- wrapper.appendChild(container);
12814
- state.forbidden = false;
12815
- centerY = five.model.bounding.getCenter(new THREE.Vector3()).y;
12816
- updateTags();
12817
- five.on('panoWillArrive', onPanoWillArrive);
12818
- five.on('panoArrived', onPanoArrived);
12819
- five.on('modeChange', onModeChange);
12820
- five.on('cameraUpdate', onCameraUpdate);
12821
- }
12822
- else {
12823
- five.once('modelLoaded', () => {
12824
- if (!wrapper)
12825
- wrapper = five.getElement().parentElement;
12826
- if (wrapper)
12827
- wrapper.appendChild(container);
12828
- centerY = five.model.bounding.getCenter(new THREE.Vector3()).y;
12829
- state.forbidden = false;
12830
- updateTags();
12831
- five.on('panoWillArrive', onPanoWillArrive);
12832
- five.on('panoArrived', onPanoArrived);
12833
- five.on('modeChange', onModeChange);
12834
- five.on('cameraUpdate', onCameraUpdate);
12835
- });
12836
- }
12827
+ window.addEventListener('resize', onResize, false);
12828
+ if ((_h = five === null || five === void 0 ? void 0 : five.model) === null || _h === void 0 ? void 0 : _h.loaded)
12829
+ onModelLoaded();
12830
+ else
12831
+ five.once('modelLoaded', onModelLoaded);
12837
12832
  five.on('dispose', dispose);
12838
12833
  return {
12839
12834
  load,
package/dist/index.js CHANGED
@@ -11992,7 +11992,7 @@ function create_fragment$4(ctx) {
11992
11992
  div3 = internal.element("div");
11993
11993
  div2 = internal.element("div");
11994
11994
  internal.attr(div0, "class", "PanoSpatialTagPlugin__tag-shadow svelte-eb8bdm");
11995
- internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
11995
+ internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
11996
11996
  internal.attr(i0, "class", "PanoSpatialTagPlugin__tag-flagpole svelte-eb8bdm");
11997
11997
  internal.set_style(i0, "width", /*lineWidthZoom*/ ctx[4] + "rem");
11998
11998
  internal.attr(i1, "class", "PanoSpatialTagPlugin__tag-line1 svelte-eb8bdm");
@@ -12032,7 +12032,7 @@ function create_fragment$4(ctx) {
12032
12032
  },
12033
12033
  p(ctx, [dirty]) {
12034
12034
  if (dirty & /*contentWidth, contentZoom, contentHeight, upsideDown*/ 394) {
12035
- internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px)");
12035
+ internal.set_style(div0, "transform", "translate(" + /*contentWidth*/ ctx[7] / 2 * /*contentZoom*/ ctx[3] * 3 + "px, " + /*contentHeight*/ ctx[8] / 2 * (/*upsideDown*/ ctx[1] ? -1 : 1) * /*contentZoom*/ ctx[3] * 3 + "px) scale(" + 1 / /*contentZoom*/ ctx[3] + ")");
12036
12036
  }
12037
12037
 
12038
12038
  if (dirty & /*lineWidthZoom*/ 16) {
@@ -12456,13 +12456,11 @@ class Template {
12456
12456
  const MESH_SIZE = 0.001;
12457
12457
  const RAY_TOLERANT_DISTANCE = 0.01;
12458
12458
  const BLUR_IMAGE_URL = 'https://vrlab-image4.ljcdn.com/release/web/PanoSpatialTagPlugin__blur.png';
12459
- const MIN_DISTANCE = 1.2;
12460
- const MAX_DISTANCE = 3.5;
12461
12459
  /**
12462
12460
  * 空间游走标签插件
12463
12461
  */
12464
12462
  const PanoSpatialTagPlugin = (five$1, params) => {
12465
- var _a, _b, _c, _d, _e, _f;
12463
+ var _a, _b, _c, _d, _e, _f, _g, _h;
12466
12464
  let wrapper = params === null || params === void 0 ? void 0 : params.container;
12467
12465
  let centerY = 1.4;
12468
12466
  const wait = (_a = params === null || params === void 0 ? void 0 : params.wait) !== null && _a !== void 0 ? _a : 200;
@@ -12470,6 +12468,8 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12470
12468
  const minRad = (_c = params === null || params === void 0 ? void 0 : params.minRad) !== null && _c !== void 0 ? _c : Math.PI / 4;
12471
12469
  const nearTolerance = (_d = params === null || params === void 0 ? void 0 : params.nearTolerance) !== null && _d !== void 0 ? _d : 100;
12472
12470
  const upsideHeight = (_e = params === null || params === void 0 ? void 0 : params.upsideHeight) !== null && _e !== void 0 ? _e : 1.6;
12471
+ const minDistance = (_f = params === null || params === void 0 ? void 0 : params.minDistance) !== null && _f !== void 0 ? _f : 1.2;
12472
+ const maxDistance = (_g = params === null || params === void 0 ? void 0 : params.maxDistance) !== null && _g !== void 0 ? _g : 3.5;
12473
12473
  // const foldPercent = params?.foldPercent ?? 20
12474
12474
  const css3DRender = CSS3DRenderPlugin(five$1);
12475
12475
  const container = document.createElement('div');
@@ -12524,7 +12524,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12524
12524
  frustum.setFromProjectionMatrix(projScreenMatrix);
12525
12525
  state.tags.forEach(tag => {
12526
12526
  const distance = camera.position.clone().setY(centerY).distanceTo(tag.position);
12527
- if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
12527
+ if (distance < minDistance || distance > maxDistance)
12528
12528
  return tag.destroying = true;
12529
12529
  if (!frustum.containsPoint(tag.position))
12530
12530
  return tag.destroying = true;
@@ -12536,16 +12536,16 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12536
12536
  state.tags.forEach(tag => {
12537
12537
  if (tag.destroying) {
12538
12538
  tag.app.$set({
12539
- contentZoom: 0.1 + camera.position.distanceTo(tag.position) / MAX_DISTANCE,
12540
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / MAX_DISTANCE),
12539
+ contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
12540
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
12541
12541
  destroying: tag.destroying,
12542
12542
  });
12543
12543
  }
12544
12544
  else {
12545
12545
  tag.app.$set({
12546
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / MAX_DISTANCE),
12547
- lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - MIN_DISTANCE) / MAX_DISTANCE * 0.6,
12548
- contentZoom: 0.1 + camera.position.distanceTo(tag.position) / MAX_DISTANCE,
12546
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(tag.position) / maxDistance),
12547
+ lineHeightZoom: 0.4 + (camera.position.distanceTo(tag.position) - minDistance) / maxDistance * 0.6,
12548
+ contentZoom: 0.1 + camera.position.distanceTo(tag.position) / maxDistance,
12549
12549
  });
12550
12550
  }
12551
12551
  });
@@ -12619,7 +12619,7 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12619
12619
  if (state.tags.find(tag => point.id === tag.id && !tag.destroying))
12620
12620
  return result;
12621
12621
  const distance = camera.position.clone().setY(centerY).distanceTo(point.position);
12622
- if (distance < MIN_DISTANCE || distance > MAX_DISTANCE)
12622
+ if (distance < minDistance || distance > maxDistance)
12623
12623
  return result;
12624
12624
  if (!frustum.containsPoint(point.position))
12625
12625
  return result;
@@ -12704,9 +12704,9 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12704
12704
  props: {
12705
12705
  id,
12706
12706
  content: state.render(state.template, replacement),
12707
- lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / MAX_DISTANCE),
12708
- lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - MIN_DISTANCE) / MAX_DISTANCE * 0.6,
12709
- contentZoom: 0.1 + camera.position.distanceTo(position) / MAX_DISTANCE,
12707
+ lineWidthZoom: 0.38 * (0.01 + camera.position.distanceTo(position) / maxDistance),
12708
+ lineHeightZoom: 0.4 + (camera.position.distanceTo(position) - minDistance) / maxDistance * 0.6,
12709
+ contentZoom: 0.1 + camera.position.distanceTo(position) / maxDistance,
12710
12710
  upsideDown: position.y > upsideHeight,
12711
12711
  folded: state.folded,
12712
12712
  events: state.events,
@@ -12817,6 +12817,22 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12817
12817
  tag.app.$set({ folded: true });
12818
12818
  });
12819
12819
  };
12820
+ const onResize = () => {
12821
+ five$1.once('renderFrame', updateOrigins);
12822
+ };
12823
+ const onModelLoaded = () => {
12824
+ if (!wrapper)
12825
+ wrapper = five$1.getElement().parentElement;
12826
+ if (wrapper)
12827
+ wrapper.appendChild(container);
12828
+ state.forbidden = false;
12829
+ centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
12830
+ updateTags();
12831
+ five$1.on('panoWillArrive', onPanoWillArrive);
12832
+ five$1.on('panoArrived', onPanoArrived);
12833
+ five$1.on('modeChange', onModeChange);
12834
+ five$1.on('cameraUpdate', onCameraUpdate);
12835
+ };
12820
12836
  const dispose = () => {
12821
12837
  blurImage = null;
12822
12838
  css3DRender.disposeAll();
@@ -12827,41 +12843,20 @@ const PanoSpatialTagPlugin = (five$1, params) => {
12827
12843
  });
12828
12844
  state.origins = [];
12829
12845
  state.tags = [];
12846
+ five$1.off('modelLoaded', onModelLoaded);
12847
+ five$1.off('renderFrame', updateOrigins);
12830
12848
  five$1.off('panoWillArrive', onPanoWillArrive);
12831
12849
  five$1.off('panoArrived', onPanoArrived);
12832
12850
  five$1.off('modeChange', onModeChange);
12833
12851
  five$1.off('cameraUpdate', onCameraUpdate);
12834
- window.removeEventListener('resize', updateOrigins, false);
12852
+ five$1.off('dispose', dispose);
12853
+ window.removeEventListener('resize', onResize, false);
12835
12854
  };
12836
- window.addEventListener('resize', updateOrigins, false);
12837
- if ((_f = five$1 === null || five$1 === void 0 ? void 0 : five$1.model) === null || _f === void 0 ? void 0 : _f.loaded) {
12838
- if (!wrapper)
12839
- wrapper = five$1.getElement().parentElement;
12840
- if (wrapper)
12841
- wrapper.appendChild(container);
12842
- state.forbidden = false;
12843
- centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
12844
- updateTags();
12845
- five$1.on('panoWillArrive', onPanoWillArrive);
12846
- five$1.on('panoArrived', onPanoArrived);
12847
- five$1.on('modeChange', onModeChange);
12848
- five$1.on('cameraUpdate', onCameraUpdate);
12849
- }
12850
- else {
12851
- five$1.once('modelLoaded', () => {
12852
- if (!wrapper)
12853
- wrapper = five$1.getElement().parentElement;
12854
- if (wrapper)
12855
- wrapper.appendChild(container);
12856
- centerY = five$1.model.bounding.getCenter(new THREE__namespace.Vector3()).y;
12857
- state.forbidden = false;
12858
- updateTags();
12859
- five$1.on('panoWillArrive', onPanoWillArrive);
12860
- five$1.on('panoArrived', onPanoArrived);
12861
- five$1.on('modeChange', onModeChange);
12862
- five$1.on('cameraUpdate', onCameraUpdate);
12863
- });
12864
- }
12855
+ window.addEventListener('resize', onResize, false);
12856
+ if ((_h = five$1 === null || five$1 === void 0 ? void 0 : five$1.model) === null || _h === void 0 ? void 0 : _h.loaded)
12857
+ onModelLoaded();
12858
+ else
12859
+ five$1.once('modelLoaded', onModelLoaded);
12865
12860
  five$1.on('dispose', dispose);
12866
12861
  return {
12867
12862
  load,