Extend brush command helpers and update delete command

This commit is contained in:
2026-04-04 20:08:10 +02:00
parent 8e97fa3485
commit f8a388b0f4
2 changed files with 26 additions and 2 deletions

View File

@@ -1,5 +1,12 @@
import { cloneEditorSelection, type EditorSelection } from "../core/selection";
import { cloneFaceUvState, type BoxBrush, type BoxFaceId, type BrushFace } from "../document/brushes";
import {
cloneFaceUvState,
type BoxBrush,
type BoxEdgeId,
type BoxFaceId,
type BoxVertexId,
type BrushFace
} from "../document/brushes";
import type { SceneDocument } from "../document/scene-document";
export function getBoxBrushOrThrow(document: SceneDocument, brushId: string): BoxBrush {
@@ -31,6 +38,22 @@ export function setSingleBrushFaceSelection(brushId: string, faceId: BoxFaceId):
};
}
export function setSingleBrushEdgeSelection(brushId: string, edgeId: BoxEdgeId): EditorSelection {
return {
kind: "brushEdge",
brushId,
edgeId
};
}
export function setSingleBrushVertexSelection(brushId: string, vertexId: BoxVertexId): EditorSelection {
return {
kind: "brushVertex",
brushId,
vertexId
};
}
export function cloneSelectionForCommand(selection: EditorSelection): EditorSelection {
return cloneEditorSelection(selection);
}

View File

@@ -9,7 +9,8 @@ import type { EditorCommand } from "./command";
function selectionIncludesBrush(selection: EditorSelection, brushId: string): boolean {
return (
(selection.kind === "brushes" && selection.ids.includes(brushId)) ||
(selection.kind === "brushFace" && selection.brushId === brushId)
((selection.kind === "brushFace" || selection.kind === "brushEdge" || selection.kind === "brushVertex") &&
selection.brushId === brushId)
);
}