@octostar/map-component 0.2.8 → 0.2.10
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 +27 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +27 -20
- package/dist/index.mjs.map +1 -1
- package/dist/types/components/demos/search-filter-demo.d.ts.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/dist/types/lib/utils.d.ts +1 -0
- package/dist/types/lib/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -387,6 +387,9 @@ function isValidIconValue(value) {
|
|
|
387
387
|
function cn(...inputs) {
|
|
388
388
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
389
389
|
}
|
|
390
|
+
function pushAll(target, items) {
|
|
391
|
+
for (const item of items) target.push(item);
|
|
392
|
+
}
|
|
390
393
|
function downloadBlob(blob, filename) {
|
|
391
394
|
const url = URL.createObjectURL(blob);
|
|
392
395
|
const anchor = document.createElement("a");
|
|
@@ -5877,8 +5880,12 @@ function createFlightPath3DLayer(layerId, mapInstance, flightPaths) {
|
|
|
5877
5880
|
points.push(new THREE__namespace.Vector3(mercator.x, mercator.y, mercator.z));
|
|
5878
5881
|
altitudes.push(alt);
|
|
5879
5882
|
});
|
|
5880
|
-
|
|
5881
|
-
|
|
5883
|
+
let minAlt = Infinity;
|
|
5884
|
+
let maxAlt = -Infinity;
|
|
5885
|
+
for (const alt of altitudes) {
|
|
5886
|
+
if (alt < minAlt) minAlt = alt;
|
|
5887
|
+
if (alt > maxAlt) maxAlt = alt;
|
|
5888
|
+
}
|
|
5882
5889
|
const altRange = maxAlt - minAlt || 1;
|
|
5883
5890
|
const curve = new THREE__namespace.CatmullRomCurve3(points, false, "catmullrom", 0.5);
|
|
5884
5891
|
const tubeRadius = 75e-9;
|
|
@@ -6285,7 +6292,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6285
6292
|
const drawFeatures = draw.current ? draw.current.getAll().features : [];
|
|
6286
6293
|
const readOnly = [];
|
|
6287
6294
|
readOnlyFeatures.current.forEach((features) => {
|
|
6288
|
-
readOnly
|
|
6295
|
+
pushAll(readOnly, features);
|
|
6289
6296
|
});
|
|
6290
6297
|
return [...drawFeatures, ...readOnly];
|
|
6291
6298
|
}, []);
|
|
@@ -6521,7 +6528,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6521
6528
|
readOnlyFeatures.current.forEach((features, layerId) => {
|
|
6522
6529
|
const layer = currentLayers.find((l) => l.id === layerId);
|
|
6523
6530
|
if (layer && isLayerVisible(layer)) {
|
|
6524
|
-
allFeatures
|
|
6531
|
+
pushAll(allFeatures, features);
|
|
6525
6532
|
}
|
|
6526
6533
|
});
|
|
6527
6534
|
const featureById = /* @__PURE__ */ new Map();
|
|
@@ -6987,7 +6994,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6987
6994
|
const layer2 = currentLayers.find((l) => l.featureIds.includes(featureId));
|
|
6988
6995
|
return ((_a = layer2 == null ? void 0 : layer2.traceConfig) == null ? void 0 : _a.enabled) === true;
|
|
6989
6996
|
});
|
|
6990
|
-
allFeatures
|
|
6997
|
+
pushAll(allFeatures, drawFeatures);
|
|
6991
6998
|
}
|
|
6992
6999
|
readOnlyFeatures.current.forEach((features, layerId2) => {
|
|
6993
7000
|
var _a;
|
|
@@ -6996,7 +7003,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
6996
7003
|
const traceEnabled = ((_a = layer2 == null ? void 0 : layer2.traceConfig) == null ? void 0 : _a.enabled) === true;
|
|
6997
7004
|
if ((layer2 == null ? void 0 : layer2.visible) && traceEnabled && (altitudeMode === "3d" || altitudeMode === "both")) {
|
|
6998
7005
|
const visibleFeatures = features.filter(isFeatureVisibleInTimeline);
|
|
6999
|
-
allFeatures
|
|
7006
|
+
pushAll(allFeatures, visibleFeatures);
|
|
7000
7007
|
}
|
|
7001
7008
|
});
|
|
7002
7009
|
const flightPaths = extract3DFlightPaths(allFeatures);
|
|
@@ -8034,11 +8041,11 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
8034
8041
|
if (hoveredCoords) {
|
|
8035
8042
|
const allFeatures = [];
|
|
8036
8043
|
if (draw.current) {
|
|
8037
|
-
allFeatures
|
|
8044
|
+
pushAll(allFeatures, draw.current.getAll().features);
|
|
8038
8045
|
}
|
|
8039
8046
|
readOnlyFeatures.current.forEach((features, lid) => {
|
|
8040
8047
|
const layer = layersRef.current.find((l) => l.id === lid);
|
|
8041
|
-
if (layer == null ? void 0 : layer.visible) allFeatures
|
|
8048
|
+
if (layer == null ? void 0 : layer.visible) pushAll(allFeatures, features);
|
|
8042
8049
|
});
|
|
8043
8050
|
const EPS = 1e-6;
|
|
8044
8051
|
for (const cf of allFeatures) {
|
|
@@ -8758,7 +8765,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
8758
8765
|
const drawFeatures = draw.current ? draw.current.getAll().features : [];
|
|
8759
8766
|
const readOnlyFeaturesList = [];
|
|
8760
8767
|
readOnlyFeatures.current.forEach((features) => {
|
|
8761
|
-
readOnlyFeaturesList
|
|
8768
|
+
pushAll(readOnlyFeaturesList, features);
|
|
8762
8769
|
});
|
|
8763
8770
|
const allFeatures = [...drawFeatures, ...readOnlyFeaturesList];
|
|
8764
8771
|
const currentLayers = layersRef.current;
|
|
@@ -9096,7 +9103,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
9096
9103
|
layersRef.current.filter((l) => targetLayerIds.includes(l.id)).forEach((layer) => {
|
|
9097
9104
|
const readOnly = readOnlyFeatures.current.get(layer.id);
|
|
9098
9105
|
if (readOnly) {
|
|
9099
|
-
allFeatures
|
|
9106
|
+
pushAll(allFeatures, readOnly);
|
|
9100
9107
|
} else if (layer.visible) {
|
|
9101
9108
|
layer.featureIds.forEach((id) => {
|
|
9102
9109
|
var _a;
|
|
@@ -9105,7 +9112,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
9105
9112
|
});
|
|
9106
9113
|
} else {
|
|
9107
9114
|
const hidden = hiddenFeatures.current.get(layer.id) || [];
|
|
9108
|
-
allFeatures
|
|
9115
|
+
pushAll(allFeatures, hidden);
|
|
9109
9116
|
}
|
|
9110
9117
|
});
|
|
9111
9118
|
const cleanedFeatures = allFeatures.map((f) => ({
|
|
@@ -10940,7 +10947,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
10940
10947
|
const readOnlyFeaturesList = [];
|
|
10941
10948
|
readOnlyFeatures.current.forEach((features, layerId) => {
|
|
10942
10949
|
const layer = layersRef.current.find((l) => l.id === layerId);
|
|
10943
|
-
if (layer == null ? void 0 : layer.visible) readOnlyFeaturesList
|
|
10950
|
+
if (layer == null ? void 0 : layer.visible) pushAll(readOnlyFeaturesList, features);
|
|
10944
10951
|
});
|
|
10945
10952
|
const allFeatures = [...drawFeatures, ...readOnlyFeaturesList];
|
|
10946
10953
|
const selectedIds = [];
|
|
@@ -10991,7 +10998,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
10991
10998
|
const readOnlyFeaturesList = [];
|
|
10992
10999
|
readOnlyFeatures.current.forEach((features, layerId) => {
|
|
10993
11000
|
const layer = layersRef.current.find((l) => l.id === layerId);
|
|
10994
|
-
if (layer == null ? void 0 : layer.visible) readOnlyFeaturesList
|
|
11001
|
+
if (layer == null ? void 0 : layer.visible) pushAll(readOnlyFeaturesList, features);
|
|
10995
11002
|
});
|
|
10996
11003
|
const allFeatures = [...drawFeatures, ...readOnlyFeaturesList];
|
|
10997
11004
|
const selectedIds = [];
|
|
@@ -11047,7 +11054,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
11047
11054
|
const readOnlyFeaturesList = [];
|
|
11048
11055
|
readOnlyFeatures.current.forEach((features, layerId) => {
|
|
11049
11056
|
const layer = layersRef.current.find((l) => l.id === layerId);
|
|
11050
|
-
if (layer == null ? void 0 : layer.visible) readOnlyFeaturesList
|
|
11057
|
+
if (layer == null ? void 0 : layer.visible) pushAll(readOnlyFeaturesList, features);
|
|
11051
11058
|
});
|
|
11052
11059
|
const allFeatures = [...drawFeatures, ...readOnlyFeaturesList];
|
|
11053
11060
|
const selectedIds = [];
|
|
@@ -11186,7 +11193,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
11186
11193
|
const readOnlyFeaturesList = [];
|
|
11187
11194
|
readOnlyFeatures.current.forEach((features, layerId) => {
|
|
11188
11195
|
const layer = layersRef.current.find((l) => l.id === layerId);
|
|
11189
|
-
if (layer == null ? void 0 : layer.visible) readOnlyFeaturesList
|
|
11196
|
+
if (layer == null ? void 0 : layer.visible) pushAll(readOnlyFeaturesList, features);
|
|
11190
11197
|
});
|
|
11191
11198
|
const allFeatures = [...drawFeatures, ...readOnlyFeaturesList];
|
|
11192
11199
|
const selectedIds = [];
|
|
@@ -11655,7 +11662,7 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
11655
11662
|
});
|
|
11656
11663
|
} else {
|
|
11657
11664
|
const hidden = hiddenFeatures.current.get(layerId) || [];
|
|
11658
|
-
features
|
|
11665
|
+
pushAll(features, hidden);
|
|
11659
11666
|
}
|
|
11660
11667
|
const layerMetadata = {
|
|
11661
11668
|
name: layer.name
|
|
@@ -11708,10 +11715,10 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
11708
11715
|
});
|
|
11709
11716
|
} else {
|
|
11710
11717
|
const hidden = hiddenFeatures.current.get(layer.id) || [];
|
|
11711
|
-
layerFeatures
|
|
11718
|
+
pushAll(layerFeatures, hidden);
|
|
11712
11719
|
}
|
|
11713
11720
|
const roFeatures = readOnlyFeatures.current.get(layer.id);
|
|
11714
|
-
if (roFeatures) layerFeatures
|
|
11721
|
+
if (roFeatures) pushAll(layerFeatures, roFeatures);
|
|
11715
11722
|
layerFeatures.forEach((f) => {
|
|
11716
11723
|
allFeatures.push({
|
|
11717
11724
|
...f,
|
|
@@ -12033,13 +12040,13 @@ const MapEditorCanvas = react.forwardRef(function MapEditorCanvas2({
|
|
|
12033
12040
|
});
|
|
12034
12041
|
} else {
|
|
12035
12042
|
const hidden = hiddenFeatures.current.get(layer.id) || [];
|
|
12036
|
-
allFeatures
|
|
12043
|
+
pushAll(allFeatures, hidden);
|
|
12037
12044
|
}
|
|
12038
12045
|
});
|
|
12039
12046
|
}
|
|
12040
12047
|
readOnlyFeatures.current.forEach((features, lid) => {
|
|
12041
12048
|
const layer = layersRef.current.find((l) => l.id === lid);
|
|
12042
|
-
if (!layer || layer.visible) allFeatures
|
|
12049
|
+
if (!layer || layer.visible) pushAll(allFeatures, features);
|
|
12043
12050
|
});
|
|
12044
12051
|
if (allFeatures.length === 0) {
|
|
12045
12052
|
toast({
|