@octostar/map-component 0.3.6 → 0.3.8
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 +23 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +23 -4
- package/dist/index.mjs.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/dist/types/lib/paintable-geometry.d.ts +8 -0
- package/dist/types/lib/paintable-geometry.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8592,6 +8592,25 @@ function geometryEquals(a, b) {
|
|
|
8592
8592
|
b.coordinates
|
|
8593
8593
|
);
|
|
8594
8594
|
}
|
|
8595
|
+
function isPaintableGeometry(geometry) {
|
|
8596
|
+
switch (geometry.type) {
|
|
8597
|
+
case "Point":
|
|
8598
|
+
return isPosition(geometry.coordinates);
|
|
8599
|
+
case "MultiPoint":
|
|
8600
|
+
case "LineString":
|
|
8601
|
+
return geometry.coordinates.every(isPosition);
|
|
8602
|
+
case "MultiLineString":
|
|
8603
|
+
case "Polygon":
|
|
8604
|
+
return geometry.coordinates.every((line) => line.every(isPosition));
|
|
8605
|
+
case "MultiPolygon":
|
|
8606
|
+
return geometry.coordinates.every((polygon) => polygon.every((ring) => ring.every(isPosition)));
|
|
8607
|
+
case "GeometryCollection":
|
|
8608
|
+
return geometry.geometries.every(isPaintableGeometry);
|
|
8609
|
+
}
|
|
8610
|
+
}
|
|
8611
|
+
function isPosition(position) {
|
|
8612
|
+
return Array.isArray(position) && typeof position[0] === "number" && typeof position[1] === "number";
|
|
8613
|
+
}
|
|
8595
8614
|
function prepareFeaturesForLayer(input, caller, cap) {
|
|
8596
8615
|
const logging = mapPerfLogEnabled();
|
|
8597
8616
|
const started = logging ? performance.now() : 0;
|
|
@@ -10245,7 +10264,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
10245
10264
|
try {
|
|
10246
10265
|
const source = map.current.getSource("custom-features");
|
|
10247
10266
|
if (!source) return;
|
|
10248
|
-
const drawFeatures = draw.current ? draw.current.getAll() :
|
|
10267
|
+
const drawFeatures = (draw.current ? draw.current.getAll().features : []).filter((f) => isPaintableGeometry(f.geometry));
|
|
10249
10268
|
const timelineWindow = timelineWindowRef.current;
|
|
10250
10269
|
const currentLayers = layersRef.current;
|
|
10251
10270
|
const isLayerVisible = (layer) => {
|
|
@@ -10258,12 +10277,12 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
10258
10277
|
if (isShardEligible(layer, count, shardSizeRef.current)) shardedLayerIds.add(layer.id);
|
|
10259
10278
|
});
|
|
10260
10279
|
shardedLayerIdsRef.current = shardedLayerIds;
|
|
10261
|
-
const allFeatures = [...drawFeatures
|
|
10280
|
+
const allFeatures = [...drawFeatures];
|
|
10262
10281
|
const sharedSlices = [];
|
|
10263
10282
|
const addSlice = (features) => {
|
|
10264
10283
|
if (features.length > 0) sharedSlices.push({ features, start: 0, end: features.length });
|
|
10265
10284
|
};
|
|
10266
|
-
addSlice(drawFeatures
|
|
10285
|
+
addSlice(drawFeatures);
|
|
10267
10286
|
readOnlyFeatures.current.forEach((features, layerId) => {
|
|
10268
10287
|
if (shardedLayerIds.has(layerId)) return;
|
|
10269
10288
|
const layer = currentLayers.find((l) => l.id === layerId);
|
|
@@ -10343,7 +10362,7 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
|
|
|
10343
10362
|
tracePointIds,
|
|
10344
10363
|
tracePointColors
|
|
10345
10364
|
};
|
|
10346
|
-
const drawFeatureCount = drawFeatures.
|
|
10365
|
+
const drawFeatureCount = drawFeatures.length;
|
|
10347
10366
|
const sourceData = {
|
|
10348
10367
|
type: "FeatureCollection",
|
|
10349
10368
|
features: allFeatures.map((f, i) => {
|