From 89907753d14214b4fbed29c0ec0c514981413ef6 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 15 Apr 2026 14:57:44 +0200 Subject: [PATCH] Implement delete functionality for brushes, entities, and model instances --- src/app/App.tsx | 77 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/src/app/App.tsx b/src/app/App.tsx index 80874bd3..98743791 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -8470,6 +8470,31 @@ export function App({ store, initialStatusMessage }: AppProps) { return true; } + if (editorState.selection.kind === "brushes") { + try { + store.executeCommand( + createDeleteSelectionCommand( + editorState.selection, + editorState.selection.ids.length === 1 + ? "Delete whitebox solid" + : "Delete whitebox solids" + ) + ); + setStatusMessage( + editorState.selection.ids.length === 1 + ? `Deleted ${getBrushLabelById( + editorState.selection.ids[0], + brushList + )}.` + : `Deleted ${editorState.selection.ids.length} whitebox solids.` + ); + return true; + } catch (error) { + setStatusMessage(getErrorMessage(error)); + return false; + } + } + const selectedBrushId = getSingleSelectedBrushId(editorState.selection); if (selectedBrushId !== null) { @@ -8482,6 +8507,32 @@ export function App({ store, initialStatusMessage }: AppProps) { return handleDeletePath(selectedPathId); } + if (editorState.selection.kind === "entities") { + try { + store.executeCommand( + createDeleteSelectionCommand( + editorState.selection, + editorState.selection.ids.length === 1 + ? "Delete entity" + : "Delete entities" + ) + ); + setStatusMessage( + editorState.selection.ids.length === 1 + ? `Deleted ${getEntityDisplayLabelById( + editorState.selection.ids[0], + editorState.document.entities, + editorState.document.assets + )}.` + : `Deleted ${editorState.selection.ids.length} entities.` + ); + return true; + } catch (error) { + setStatusMessage(getErrorMessage(error)); + return false; + } + } + const selectedEntityId = getSingleSelectedEntityId(editorState.selection); if (selectedEntityId !== null) { @@ -8492,6 +8543,32 @@ export function App({ store, initialStatusMessage }: AppProps) { editorState.selection ); + if (editorState.selection.kind === "modelInstances") { + try { + store.executeCommand( + createDeleteSelectionCommand( + editorState.selection, + editorState.selection.ids.length === 1 + ? "Delete model instance" + : "Delete model instances" + ) + ); + setStatusMessage( + editorState.selection.ids.length === 1 + ? `Deleted ${getModelInstanceDisplayLabelById( + editorState.selection.ids[0], + editorState.document.modelInstances, + editorState.document.assets + )}.` + : `Deleted ${editorState.selection.ids.length} model instances.` + ); + return true; + } catch (error) { + setStatusMessage(getErrorMessage(error)); + return false; + } + } + if (selectedModelInstanceId !== null) { return handleDeleteModelInstance(selectedModelInstanceId); }