@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.mjs CHANGED
@@ -366,6 +366,9 @@ function isValidIconValue(value) {
366
366
  function cn(...inputs) {
367
367
  return twMerge(clsx(inputs));
368
368
  }
369
+ function pushAll(target, items) {
370
+ for (const item of items) target.push(item);
371
+ }
369
372
  function downloadBlob(blob, filename) {
370
373
  const url = URL.createObjectURL(blob);
371
374
  const anchor = document.createElement("a");
@@ -5856,8 +5859,12 @@ function createFlightPath3DLayer(layerId, mapInstance, flightPaths) {
5856
5859
  points.push(new THREE.Vector3(mercator.x, mercator.y, mercator.z));
5857
5860
  altitudes.push(alt);
5858
5861
  });
5859
- const minAlt = Math.min(...altitudes);
5860
- const maxAlt = Math.max(...altitudes);
5862
+ let minAlt = Infinity;
5863
+ let maxAlt = -Infinity;
5864
+ for (const alt of altitudes) {
5865
+ if (alt < minAlt) minAlt = alt;
5866
+ if (alt > maxAlt) maxAlt = alt;
5867
+ }
5861
5868
  const altRange = maxAlt - minAlt || 1;
5862
5869
  const curve = new THREE.CatmullRomCurve3(points, false, "catmullrom", 0.5);
5863
5870
  const tubeRadius = 75e-9;
@@ -6264,7 +6271,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6264
6271
  const drawFeatures = draw.current ? draw.current.getAll().features : [];
6265
6272
  const readOnly = [];
6266
6273
  readOnlyFeatures.current.forEach((features) => {
6267
- readOnly.push(...features);
6274
+ pushAll(readOnly, features);
6268
6275
  });
6269
6276
  return [...drawFeatures, ...readOnly];
6270
6277
  }, []);
@@ -6500,7 +6507,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6500
6507
  readOnlyFeatures.current.forEach((features, layerId) => {
6501
6508
  const layer = currentLayers.find((l) => l.id === layerId);
6502
6509
  if (layer && isLayerVisible(layer)) {
6503
- allFeatures.push(...features);
6510
+ pushAll(allFeatures, features);
6504
6511
  }
6505
6512
  });
6506
6513
  const featureById = /* @__PURE__ */ new Map();
@@ -6966,7 +6973,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6966
6973
  const layer2 = currentLayers.find((l) => l.featureIds.includes(featureId));
6967
6974
  return ((_a = layer2 == null ? void 0 : layer2.traceConfig) == null ? void 0 : _a.enabled) === true;
6968
6975
  });
6969
- allFeatures.push(...drawFeatures);
6976
+ pushAll(allFeatures, drawFeatures);
6970
6977
  }
6971
6978
  readOnlyFeatures.current.forEach((features, layerId2) => {
6972
6979
  var _a;
@@ -6975,7 +6982,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
6975
6982
  const traceEnabled = ((_a = layer2 == null ? void 0 : layer2.traceConfig) == null ? void 0 : _a.enabled) === true;
6976
6983
  if ((layer2 == null ? void 0 : layer2.visible) && traceEnabled && (altitudeMode === "3d" || altitudeMode === "both")) {
6977
6984
  const visibleFeatures = features.filter(isFeatureVisibleInTimeline);
6978
- allFeatures.push(...visibleFeatures);
6985
+ pushAll(allFeatures, visibleFeatures);
6979
6986
  }
6980
6987
  });
6981
6988
  const flightPaths = extract3DFlightPaths(allFeatures);
@@ -8013,11 +8020,11 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
8013
8020
  if (hoveredCoords) {
8014
8021
  const allFeatures = [];
8015
8022
  if (draw.current) {
8016
- allFeatures.push(...draw.current.getAll().features);
8023
+ pushAll(allFeatures, draw.current.getAll().features);
8017
8024
  }
8018
8025
  readOnlyFeatures.current.forEach((features, lid) => {
8019
8026
  const layer = layersRef.current.find((l) => l.id === lid);
8020
- if (layer == null ? void 0 : layer.visible) allFeatures.push(...features);
8027
+ if (layer == null ? void 0 : layer.visible) pushAll(allFeatures, features);
8021
8028
  });
8022
8029
  const EPS = 1e-6;
8023
8030
  for (const cf of allFeatures) {
@@ -8737,7 +8744,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
8737
8744
  const drawFeatures = draw.current ? draw.current.getAll().features : [];
8738
8745
  const readOnlyFeaturesList = [];
8739
8746
  readOnlyFeatures.current.forEach((features) => {
8740
- readOnlyFeaturesList.push(...features);
8747
+ pushAll(readOnlyFeaturesList, features);
8741
8748
  });
8742
8749
  const allFeatures = [...drawFeatures, ...readOnlyFeaturesList];
8743
8750
  const currentLayers = layersRef.current;
@@ -9075,7 +9082,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9075
9082
  layersRef.current.filter((l) => targetLayerIds.includes(l.id)).forEach((layer) => {
9076
9083
  const readOnly = readOnlyFeatures.current.get(layer.id);
9077
9084
  if (readOnly) {
9078
- allFeatures.push(...readOnly);
9085
+ pushAll(allFeatures, readOnly);
9079
9086
  } else if (layer.visible) {
9080
9087
  layer.featureIds.forEach((id) => {
9081
9088
  var _a;
@@ -9084,7 +9091,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
9084
9091
  });
9085
9092
  } else {
9086
9093
  const hidden = hiddenFeatures.current.get(layer.id) || [];
9087
- allFeatures.push(...hidden);
9094
+ pushAll(allFeatures, hidden);
9088
9095
  }
9089
9096
  });
9090
9097
  const cleanedFeatures = allFeatures.map((f) => ({
@@ -10919,7 +10926,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10919
10926
  const readOnlyFeaturesList = [];
10920
10927
  readOnlyFeatures.current.forEach((features, layerId) => {
10921
10928
  const layer = layersRef.current.find((l) => l.id === layerId);
10922
- if (layer == null ? void 0 : layer.visible) readOnlyFeaturesList.push(...features);
10929
+ if (layer == null ? void 0 : layer.visible) pushAll(readOnlyFeaturesList, features);
10923
10930
  });
10924
10931
  const allFeatures = [...drawFeatures, ...readOnlyFeaturesList];
10925
10932
  const selectedIds = [];
@@ -10970,7 +10977,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
10970
10977
  const readOnlyFeaturesList = [];
10971
10978
  readOnlyFeatures.current.forEach((features, layerId) => {
10972
10979
  const layer = layersRef.current.find((l) => l.id === layerId);
10973
- if (layer == null ? void 0 : layer.visible) readOnlyFeaturesList.push(...features);
10980
+ if (layer == null ? void 0 : layer.visible) pushAll(readOnlyFeaturesList, features);
10974
10981
  });
10975
10982
  const allFeatures = [...drawFeatures, ...readOnlyFeaturesList];
10976
10983
  const selectedIds = [];
@@ -11026,7 +11033,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11026
11033
  const readOnlyFeaturesList = [];
11027
11034
  readOnlyFeatures.current.forEach((features, layerId) => {
11028
11035
  const layer = layersRef.current.find((l) => l.id === layerId);
11029
- if (layer == null ? void 0 : layer.visible) readOnlyFeaturesList.push(...features);
11036
+ if (layer == null ? void 0 : layer.visible) pushAll(readOnlyFeaturesList, features);
11030
11037
  });
11031
11038
  const allFeatures = [...drawFeatures, ...readOnlyFeaturesList];
11032
11039
  const selectedIds = [];
@@ -11165,7 +11172,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11165
11172
  const readOnlyFeaturesList = [];
11166
11173
  readOnlyFeatures.current.forEach((features, layerId) => {
11167
11174
  const layer = layersRef.current.find((l) => l.id === layerId);
11168
- if (layer == null ? void 0 : layer.visible) readOnlyFeaturesList.push(...features);
11175
+ if (layer == null ? void 0 : layer.visible) pushAll(readOnlyFeaturesList, features);
11169
11176
  });
11170
11177
  const allFeatures = [...drawFeatures, ...readOnlyFeaturesList];
11171
11178
  const selectedIds = [];
@@ -11634,7 +11641,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11634
11641
  });
11635
11642
  } else {
11636
11643
  const hidden = hiddenFeatures.current.get(layerId) || [];
11637
- features.push(...hidden);
11644
+ pushAll(features, hidden);
11638
11645
  }
11639
11646
  const layerMetadata = {
11640
11647
  name: layer.name
@@ -11687,10 +11694,10 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
11687
11694
  });
11688
11695
  } else {
11689
11696
  const hidden = hiddenFeatures.current.get(layer.id) || [];
11690
- layerFeatures.push(...hidden);
11697
+ pushAll(layerFeatures, hidden);
11691
11698
  }
11692
11699
  const roFeatures = readOnlyFeatures.current.get(layer.id);
11693
- if (roFeatures) layerFeatures.push(...roFeatures);
11700
+ if (roFeatures) pushAll(layerFeatures, roFeatures);
11694
11701
  layerFeatures.forEach((f) => {
11695
11702
  allFeatures.push({
11696
11703
  ...f,
@@ -12012,13 +12019,13 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
12012
12019
  });
12013
12020
  } else {
12014
12021
  const hidden = hiddenFeatures.current.get(layer.id) || [];
12015
- allFeatures.push(...hidden);
12022
+ pushAll(allFeatures, hidden);
12016
12023
  }
12017
12024
  });
12018
12025
  }
12019
12026
  readOnlyFeatures.current.forEach((features, lid) => {
12020
12027
  const layer = layersRef.current.find((l) => l.id === lid);
12021
- if (!layer || layer.visible) allFeatures.push(...features);
12028
+ if (!layer || layer.visible) pushAll(allFeatures, features);
12022
12029
  });
12023
12030
  if (allFeatures.length === 0) {
12024
12031
  toast({