Refactor path deletion logic and add utilities for managing spline corridor path clip intervals

This commit is contained in:
2026-05-13 13:15:01 +02:00
parent 9bc55b468f
commit 61426b5e79
2 changed files with 69 additions and 13 deletions

View File

@@ -65,19 +65,24 @@ export function createDeletePathCommand(pathId: string): EditorCommand {
...currentDocument.paths
};
delete nextPaths[pathId];
const nextJunctions = Object.fromEntries(
Object.entries(currentDocument.splineCorridorJunctions)
.map(([junctionId, junction]) => [
junctionId,
cloneSplineCorridorJunction({
...junction,
connections: junction.connections.filter(
(connection) => connection.pathId !== pathId
)
})
])
.filter(([, junction]) => junction.connections.length >= 2)
);
const nextJunctions: Record<string, SplineCorridorJunction> = {};
for (const [junctionId, junction] of Object.entries(
currentDocument.splineCorridorJunctions
)) {
const connections = junction.connections.filter(
(connection) => connection.pathId !== pathId
);
if (connections.length < 2) {
continue;
}
nextJunctions[junctionId] = cloneSplineCorridorJunction({
...junction,
connections
});
}
context.setDocument({
...currentDocument,