diff --git a/packages/editor/src/components/editor/index.tsx b/packages/editor/src/components/editor/index.tsx index a5d4ada43b..c0b64de270 100644 --- a/packages/editor/src/components/editor/index.tsx +++ b/packages/editor/src/components/editor/index.tsx @@ -38,11 +38,13 @@ import { ViewerOverlay } from '../../components/viewer-overlay' import { ViewerZoneSystem } from '../../components/viewer-zone-system' import { type SaveStatus, useAutoSave } from '../../hooks/use-auto-save' import { useKeyboard } from '../../hooks/use-keyboard' +import { useIsMobile } from '../../hooks/use-mobile' import { useSaveShortcut } from '../../hooks/use-save-shortcut' import { useCeilingEditSessionOwner } from '../../lib/ceiling-edit-session' import { showsWholeBuilding, useEditorLevelDisplay } from '../../lib/editor-level-display' import { isSceneView } from '../../lib/editor-views' import { useGestureLifecycleOwner } from '../../lib/gesture-lifecycle' +import { shouldShowEditingControls } from '../../lib/interaction/overlay-policy' import { createLocalProjectPresentationPersistence, type LocalProjectPresentationPersistence, @@ -58,6 +60,7 @@ import { } from '../../lib/scene' import { disposeSFXBus, initSFXBus } from '../../lib/sfx-bus' import { useUnitFocusRules } from '../../lib/units' +import { cn } from '../../lib/utils' import { useViewerFloorDisplay } from '../../lib/viewer-selection' import { type CameraHintAction, useCameraHintFocus } from '../../store/use-camera-hint-focus' import useEditor from '../../store/use-editor' @@ -74,6 +77,7 @@ import { ZoneSystem } from '../systems/zone/zone-system' import { BoxSelectTool } from '../tools/select/box-select-tool' import { ToolManager } from '../tools/tool-manager' import { ActionMenu } from '../ui/action-menu' +import { type ActionMenuPlacement, TOP_MENU_CLEARANCE } from '../ui/action-menu/placement' import { CommandPalette, type CommandPaletteEmptyAction } from '../ui/command-palette' import { EditorCommands } from '../ui/command-palette/editor-commands' import { FloatingLevelSelector } from '../ui/floating-level-selector' @@ -196,6 +200,8 @@ function initializeEditorRuntime(): () => void { export interface EditorProps { // Layout version — 'v1' (default) or 'v2' (navbar + two-column) layoutVersion?: 'v1' | 'v2' + // Viewport edge the tool menu docks to (desktop only; mobile stays at the bottom) + actionMenuPlacement?: ActionMenuPlacement // UI slots (v1) appMenuButton?: ReactNode @@ -580,7 +586,13 @@ function CameraControlHintItem({ hint }: { hint: CameraControlHint }) { ) } -function ViewerCanvasControlsHint({ onDismiss }: { onDismiss: () => void }) { +function ViewerCanvasControlsHint({ + belowTopMenu = false, + onDismiss, +}: { + belowTopMenu?: boolean + onDismiss: () => void +}) { const all = CAMERA_CONTROL_HINTS // A host teaching one gesture at a time narrows this to the one it is asking // for, and to nothing once it is done. Null — the default — is all of them. @@ -592,7 +604,13 @@ function ViewerCanvasControlsHint({ onDismiss }: { onDismiss: () => void }) { } return ( -
{label} {shortcut && `(${shortcut})`}
diff --git a/packages/editor/src/components/ui/action-menu/index.tsx b/packages/editor/src/components/ui/action-menu/index.tsx
index 21c65d5cee..5eb9312b89 100644
--- a/packages/editor/src/components/ui/action-menu/index.tsx
+++ b/packages/editor/src/components/ui/action-menu/index.tsx
@@ -12,6 +12,7 @@ import useEditor from './../../../store/use-editor'
import { CameraActions } from './camera-actions'
import { ControlModes } from './control-modes'
import { FollowPascalPill } from './follow-pascal-pill'
+import { type ActionMenuPlacement, ActionMenuPlacementProvider } from './placement'
import { SecondaryToggles } from './view-toggles'
// Mobile bottom offset matches the viewer's overlap behind the sheet's
@@ -19,7 +20,16 @@ import { SecondaryToggles } from './view-toggles'
// just above that strip instead of inside it.
const MOBILE_BOTTOM_OFFSET = 24
-export function ActionMenu({ className }: { className?: string }) {
+export function ActionMenu({
+ className,
+ inline = false,
+ placement = 'bottom',
+}: {
+ className?: string
+ // Rendered in the flow of a layout slot instead of floating over the viewer.
+ inline?: boolean
+ placement?: ActionMenuPlacement
+}) {
const isMobile = useIsMobile()
const readOnly = useScene((s) => s.readOnly)
const hasSelectionOnMobile = useViewer((s) => isMobile && s.selection.selectedIds.length > 0)
@@ -48,42 +58,53 @@ export function ActionMenu({ className }: { className?: string }) {
? { duration: 0 }
: { type: 'spring' as const, bounce: 0.2, duration: 0.4 }
+ // Mobile keeps the bottom rail: the sheet owns the rest of the screen.
+ const effectivePlacement = isMobile ? 'bottom' : placement
+
return (
-