diff --git a/packages/editor/src/components/editor/editor-layout-mobile.tsx b/packages/editor/src/components/editor/editor-layout-mobile.tsx index 3c4bdd83..31d9a6b4 100644 --- a/packages/editor/src/components/editor/editor-layout-mobile.tsx +++ b/packages/editor/src/components/editor/editor-layout-mobile.tsx @@ -159,6 +159,11 @@ export function EditorLayoutMobile({ const expandedThreshold = Math.max(SHEET_HANDLE_PX, defaultPx * 0.5) if (current > expandedThreshold) { sheetRef.current?.snapTo(SHEET_HANDLE_PX) + // Closing the sheet disarms any build tool back to select + const { mode, setMode } = useEditor.getState() + if (mode === 'build') { + setMode('select') + } } else { sheetRef.current?.snapTo(defaultPx) } diff --git a/packages/editor/src/components/editor/editor-layout-v2.tsx b/packages/editor/src/components/editor/editor-layout-v2.tsx index f9099c60..a30602a2 100644 --- a/packages/editor/src/components/editor/editor-layout-v2.tsx +++ b/packages/editor/src/components/editor/editor-layout-v2.tsx @@ -52,6 +52,15 @@ function LeftColumn({ } }, [activePanel]) + // Closing (collapsing) the sidebar disarms any build tool back to select + useEffect(() => { + if (!isCollapsed) return + const { mode, setMode } = useEditor.getState() + if (mode === 'build') { + setMode('select') + } + }, [isCollapsed]) + const handleResizerDown = useCallback( (e: React.PointerEvent) => { e.preventDefault() diff --git a/packages/editor/src/store/use-editor.tsx b/packages/editor/src/store/use-editor.tsx index f2521a2b..b7b4656b 100644 --- a/packages/editor/src/store/use-editor.tsx +++ b/packages/editor/src/store/use-editor.tsx @@ -66,7 +66,7 @@ import { } from '../lib/snapping-mode' import useInteractionScope from './use-interaction-scope' -const DEFAULT_ACTIVE_SIDEBAR_PANEL = 'ai' +const DEFAULT_ACTIVE_SIDEBAR_PANEL = 'build' const DEFAULT_FLOORPLAN_PANE_RATIO = 0.5 const MIN_FLOORPLAN_PANE_RATIO = 0.15 const MAX_FLOORPLAN_PANE_RATIO = 0.85