@octostar/map-component 0.1.24 → 0.1.25

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.
package/dist/index.mjs CHANGED
@@ -6604,7 +6604,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6604
6604
  draw.current = drawInstance;
6605
6605
  mapInstance.addSource("custom-features", {
6606
6606
  type: "geojson",
6607
- data: { type: "FeatureCollection", features: [] }
6607
+ data: { type: "FeatureCollection", features: [] },
6608
+ maxzoom: 22
6608
6609
  });
6609
6610
  mapInstance.addLayer({
6610
6611
  id: "custom-polygon-fill",
@@ -6839,7 +6840,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6839
6840
  });
6840
6841
  mapInstance.addSource("arrow-heads", {
6841
6842
  type: "geojson",
6842
- data: { type: "FeatureCollection", features: [] }
6843
+ data: { type: "FeatureCollection", features: [] },
6844
+ maxzoom: 22
6843
6845
  });
6844
6846
  mapInstance.addLayer({
6845
6847
  id: "custom-arrow-heads",
@@ -6852,7 +6854,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6852
6854
  });
6853
6855
  mapInstance.addSource("arrow-labels", {
6854
6856
  type: "geojson",
6855
- data: { type: "FeatureCollection", features: [] }
6857
+ data: { type: "FeatureCollection", features: [] },
6858
+ maxzoom: 22
6856
6859
  });
6857
6860
  mapInstance.addLayer({
6858
6861
  id: "custom-arrow-labels",
@@ -6881,7 +6884,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6881
6884
  });
6882
6885
  mapInstance.addSource("trace-features", {
6883
6886
  type: "geojson",
6884
- data: { type: "FeatureCollection", features: [] }
6887
+ data: { type: "FeatureCollection", features: [] },
6888
+ maxzoom: 22
6885
6889
  });
6886
6890
  mapInstance.addLayer({
6887
6891
  id: "trace-lines",
@@ -11234,7 +11238,8 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11234
11238
  try {
11235
11239
  mapInstance.addSource(sourceId, {
11236
11240
  type: "geojson",
11237
- data: { type: "FeatureCollection", features: pointFeatures }
11241
+ data: { type: "FeatureCollection", features: pointFeatures },
11242
+ maxzoom: 22
11238
11243
  });
11239
11244
  mapInstance.addLayer({
11240
11245
  id: heatmapLayerId,
@@ -11404,12 +11409,27 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11404
11409
  ];
11405
11410
  });
11406
11411
  }
11412
+ const rawMaxZoom = typeof mapInstance.getMaxZoom === "function" ? mapInstance.getMaxZoom() : 24;
11413
+ const mapStyleMaxZoom = Number.isFinite(rawMaxZoom) && rawMaxZoom > 0 ? rawMaxZoom : 24;
11414
+ const CLUSTER_ZOOM_CAP = 24;
11415
+ const cappedZoom = Math.min(mapStyleMaxZoom, CLUSTER_ZOOM_CAP);
11416
+ let clusterMaxZoom = Math.max(1, Math.floor(cappedZoom) - 1);
11417
+ let geojsonSourceMaxZoom = Math.min(
11418
+ CLUSTER_ZOOM_CAP,
11419
+ Math.max(clusterMaxZoom + 1, Math.ceil(cappedZoom))
11420
+ );
11421
+ if (clusterMaxZoom >= geojsonSourceMaxZoom) {
11422
+ clusterMaxZoom = Math.max(1, geojsonSourceMaxZoom - 1);
11423
+ }
11407
11424
  mapInstance.addSource(sourceId, {
11408
11425
  type: "geojson",
11409
11426
  data: { type: "FeatureCollection", features: pointFeatures },
11427
+ maxzoom: geojsonSourceMaxZoom,
11410
11428
  cluster: true,
11411
- clusterMaxZoom: 14,
11429
+ clusterMaxZoom,
11412
11430
  clusterRadius: 50,
11431
+ clusterMinPoints: 2,
11432
+ buffer: 256,
11413
11433
  ...Object.keys(clusterProperties).length > 0 ? { clusterProperties } : {}
11414
11434
  });
11415
11435
  if (groupByField && categoryValues.length > 0) {