@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.cjs +26 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +26 -6
- package/dist/index.mjs.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6625,7 +6625,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6625
6625
|
draw.current = drawInstance;
|
|
6626
6626
|
mapInstance.addSource("custom-features", {
|
|
6627
6627
|
type: "geojson",
|
|
6628
|
-
data: { type: "FeatureCollection", features: [] }
|
|
6628
|
+
data: { type: "FeatureCollection", features: [] },
|
|
6629
|
+
maxzoom: 22
|
|
6629
6630
|
});
|
|
6630
6631
|
mapInstance.addLayer({
|
|
6631
6632
|
id: "custom-polygon-fill",
|
|
@@ -6860,7 +6861,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6860
6861
|
});
|
|
6861
6862
|
mapInstance.addSource("arrow-heads", {
|
|
6862
6863
|
type: "geojson",
|
|
6863
|
-
data: { type: "FeatureCollection", features: [] }
|
|
6864
|
+
data: { type: "FeatureCollection", features: [] },
|
|
6865
|
+
maxzoom: 22
|
|
6864
6866
|
});
|
|
6865
6867
|
mapInstance.addLayer({
|
|
6866
6868
|
id: "custom-arrow-heads",
|
|
@@ -6873,7 +6875,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6873
6875
|
});
|
|
6874
6876
|
mapInstance.addSource("arrow-labels", {
|
|
6875
6877
|
type: "geojson",
|
|
6876
|
-
data: { type: "FeatureCollection", features: [] }
|
|
6878
|
+
data: { type: "FeatureCollection", features: [] },
|
|
6879
|
+
maxzoom: 22
|
|
6877
6880
|
});
|
|
6878
6881
|
mapInstance.addLayer({
|
|
6879
6882
|
id: "custom-arrow-labels",
|
|
@@ -6902,7 +6905,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6902
6905
|
});
|
|
6903
6906
|
mapInstance.addSource("trace-features", {
|
|
6904
6907
|
type: "geojson",
|
|
6905
|
-
data: { type: "FeatureCollection", features: [] }
|
|
6908
|
+
data: { type: "FeatureCollection", features: [] },
|
|
6909
|
+
maxzoom: 22
|
|
6906
6910
|
});
|
|
6907
6911
|
mapInstance.addLayer({
|
|
6908
6912
|
id: "trace-lines",
|
|
@@ -11255,7 +11259,8 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
11255
11259
|
try {
|
|
11256
11260
|
mapInstance.addSource(sourceId, {
|
|
11257
11261
|
type: "geojson",
|
|
11258
|
-
data: { type: "FeatureCollection", features: pointFeatures }
|
|
11262
|
+
data: { type: "FeatureCollection", features: pointFeatures },
|
|
11263
|
+
maxzoom: 22
|
|
11259
11264
|
});
|
|
11260
11265
|
mapInstance.addLayer({
|
|
11261
11266
|
id: heatmapLayerId,
|
|
@@ -11425,12 +11430,27 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
11425
11430
|
];
|
|
11426
11431
|
});
|
|
11427
11432
|
}
|
|
11433
|
+
const rawMaxZoom = typeof mapInstance.getMaxZoom === "function" ? mapInstance.getMaxZoom() : 24;
|
|
11434
|
+
const mapStyleMaxZoom = Number.isFinite(rawMaxZoom) && rawMaxZoom > 0 ? rawMaxZoom : 24;
|
|
11435
|
+
const CLUSTER_ZOOM_CAP = 24;
|
|
11436
|
+
const cappedZoom = Math.min(mapStyleMaxZoom, CLUSTER_ZOOM_CAP);
|
|
11437
|
+
let clusterMaxZoom = Math.max(1, Math.floor(cappedZoom) - 1);
|
|
11438
|
+
let geojsonSourceMaxZoom = Math.min(
|
|
11439
|
+
CLUSTER_ZOOM_CAP,
|
|
11440
|
+
Math.max(clusterMaxZoom + 1, Math.ceil(cappedZoom))
|
|
11441
|
+
);
|
|
11442
|
+
if (clusterMaxZoom >= geojsonSourceMaxZoom) {
|
|
11443
|
+
clusterMaxZoom = Math.max(1, geojsonSourceMaxZoom - 1);
|
|
11444
|
+
}
|
|
11428
11445
|
mapInstance.addSource(sourceId, {
|
|
11429
11446
|
type: "geojson",
|
|
11430
11447
|
data: { type: "FeatureCollection", features: pointFeatures },
|
|
11448
|
+
maxzoom: geojsonSourceMaxZoom,
|
|
11431
11449
|
cluster: true,
|
|
11432
|
-
clusterMaxZoom
|
|
11450
|
+
clusterMaxZoom,
|
|
11433
11451
|
clusterRadius: 50,
|
|
11452
|
+
clusterMinPoints: 2,
|
|
11453
|
+
buffer: 256,
|
|
11434
11454
|
...Object.keys(clusterProperties).length > 0 ? { clusterProperties } : {}
|
|
11435
11455
|
});
|
|
11436
11456
|
if (groupByField && categoryValues.length > 0) {
|