fix(editor): auto-switch to structure phase when interacting with nodes in floorplan

Two fixes for stair selection in 2D floorplan not working:

1. floorplan-panel: remove level > 0 restriction on auto-switch to structure
   phase. When viewing ANY level in the floorplan while in site phase, auto-enter
   structure mode so structural nodes (stairs, walls, slabs) become selectable.

2. selection-manager: expand auto-switch to also cover site phase. Clicking a
   structural or furnish element now auto-switches from site → structure/furnish,
   just like it already did between structure ↔ furnish ↔ zones.

This fixes the issue where stairs couldn't be selected in 2D and the floating
action menu (move/duplicate/delete) wouldn't appear.
This commit is contained in:
Pascal
2026-04-08 01:18:37 +00:00
parent 11104bc512
commit 6c3ac3e030
2 changed files with 3 additions and 2 deletions
@@ -5664,7 +5664,7 @@ export function FloorplanPanel() {
}, [fittedViewport, levelId]) }, [fittedViewport, levelId])
useEffect(() => { useEffect(() => {
if (!(phase === 'site' && levelNode?.type === 'level' && levelNode.level > 0)) { if (!(phase === 'site' && levelNode?.type === 'level')) {
return return
} }
@@ -389,7 +389,8 @@ export const SelectionManager = () => {
let currentStructureLayer = useEditor.getState().structureLayer let currentStructureLayer = useEditor.getState().structureLayer
// Auto-switch between zones, structure, and furnish when clicking elements on the same level. // Auto-switch between zones, structure, and furnish when clicking elements on the same level.
if (currentPhase === 'structure' || currentPhase === 'furnish') { // Also auto-switch from site phase when clicking structural/furnish elements (e.g. 2D floorplan).
if (currentPhase === 'structure' || currentPhase === 'furnish' || currentPhase === 'site') {
if (isNodeInCurrentLevel(node)) { if (isNodeInCurrentLevel(node)) {
const target = getSelectionTarget(node) const target = getSelectionTarget(node)
if (target) { if (target) {