Add path-related commands and update selection handling

This commit is contained in:
2026-04-13 21:21:40 +02:00
parent 0eac096de5
commit 3f4e951f41
11 changed files with 778 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ export type EditorSelection =
| { kind: "brushFace"; brushId: string; faceId: BoxFaceId }
| { kind: "brushEdge"; brushId: string; edgeId: BoxEdgeId }
| { kind: "brushVertex"; brushId: string; vertexId: BoxVertexId }
| { kind: "paths"; ids: string[] }
| { kind: "entities"; ids: string[] }
| { kind: "modelInstances"; ids: string[] };
@@ -62,6 +63,7 @@ export function areEditorSelectionsEqual(left: EditorSelection, right: EditorSel
case "brushVertex":
return right.kind === "brushVertex" && left.brushId === right.brushId && left.vertexId === right.vertexId;
case "brushes":
case "paths":
case "entities":
case "modelInstances":
return right.kind === left.kind && left.ids.length === right.ids.length && left.ids.every((id, index) => id === right.ids[index]);
@@ -112,6 +114,14 @@ export function getSingleSelectedEntityId(selection: EditorSelection): string |
return selection.ids[0];
}
export function getSingleSelectedPathId(selection: EditorSelection): string | null {
if (selection.kind !== "paths" || selection.ids.length !== 1) {
return null;
}
return selection.ids[0];
}
export function getSingleSelectedModelInstanceId(selection: EditorSelection): string | null {
if (selection.kind !== "modelInstances" || selection.ids.length !== 1) {
return null;
@@ -144,6 +154,10 @@ export function isModelInstanceSelected(selection: EditorSelection, modelInstanc
return selection.kind === "modelInstances" && selection.ids.includes(modelInstanceId);
}
export function isPathSelected(selection: EditorSelection, pathId: string): boolean {
return selection.kind === "paths" && selection.ids.includes(pathId);
}
export function normalizeSelectionForWhiteboxSelectionMode(selection: EditorSelection, mode: WhiteboxSelectionMode): EditorSelection {
switch (selection.kind) {
case "brushFace":

View File

@@ -1042,6 +1042,12 @@ export function resolveTransformTarget(
}
return createEntityTransformTarget(document, selection.ids[0]);
case "paths":
return {
target: null,
message:
"Path transforms are not available in this slice. Edit path points in the Inspector."
};
case "modelInstances":
if (selection.ids.length !== 1) {
return {