Extend brush command helpers and update delete command
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user