From 1213caedc8ed17c8f95a2ed66960573930f54c65 Mon Sep 17 00:00:00 2001 From: nnhhoang Date: Thu, 26 Mar 2026 11:46:10 +0700 Subject: [PATCH 1/2] fix: allow deleting walls and slabs via floating action menu Walls and slabs were excluded from ALLOWED_TYPES in FloatingActionMenu, so no delete UI appeared when selecting them. Added wall/slab to the allowed types and show only the delete button (no move/duplicate) since they are structural elements. Usage: switch to select mode (V), click a wall or slab, then use the floating trash icon or press Delete/Backspace to remove it. Closes #156 --- .../editor/floating-action-menu.tsx | 7 +-- .../components/editor/node-action-menu.tsx | 44 ++++++++++--------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/packages/editor/src/components/editor/floating-action-menu.tsx b/packages/editor/src/components/editor/floating-action-menu.tsx index a92d5956..cf727a6e 100644 --- a/packages/editor/src/components/editor/floating-action-menu.tsx +++ b/packages/editor/src/components/editor/floating-action-menu.tsx @@ -20,7 +20,8 @@ import { sfxEmitter } from '../../lib/sfx-bus' import useEditor from '../../store/use-editor' import { NodeActionMenu } from './node-action-menu' -const ALLOWED_TYPES = ['item', 'door', 'window', 'roof', 'roof-segment'] +const ALLOWED_TYPES = ['item', 'door', 'window', 'roof', 'roof-segment', 'wall', 'slab'] +const DELETE_ONLY_TYPES = ['wall', 'slab'] export function FloatingActionMenu() { const selectedIds = useViewer((s) => s.selection.selectedIds) @@ -174,8 +175,8 @@ export function FloatingActionMenu() { > e.stopPropagation()} onPointerUp={(e) => e.stopPropagation()} /> diff --git a/packages/editor/src/components/editor/node-action-menu.tsx b/packages/editor/src/components/editor/node-action-menu.tsx index 94bab4cb..b383a997 100644 --- a/packages/editor/src/components/editor/node-action-menu.tsx +++ b/packages/editor/src/components/editor/node-action-menu.tsx @@ -5,8 +5,8 @@ import type { MouseEventHandler, PointerEventHandler } from 'react' type NodeActionMenuProps = { onDelete: MouseEventHandler - onDuplicate: MouseEventHandler - onMove: MouseEventHandler + onDuplicate?: MouseEventHandler + onMove?: MouseEventHandler onPointerDown?: PointerEventHandler onPointerUp?: PointerEventHandler onPointerEnter?: PointerEventHandler @@ -30,24 +30,28 @@ export function NodeActionMenu({ onPointerLeave={onPointerLeave} onPointerUp={onPointerUp} > - - + {onMove && ( + + )} + {onDuplicate && ( + + )}