feat: move/rotate building + relative positioning for all tools (#220)

Sync monorepo PRs #243 and #248 to the open-source editor.

Move/Rotate Building:
- New move-building-tool with grid snapping, R/T rotation, and Esc cancel
- Floating building action menu with move button
- Building helper with keyboard shortcut hints
- BuildingRenderer now applies position and rotation from node data

Building-Relative Coordinate System:
- GridEvent gains localPosition (building-local coords)
- use-grid-events computes building-local intersection from building mesh
- ToolManager wraps building-relative tools in a building-local <group>
- All tools (wall, slab, ceiling, stair, roof, zone, polygon-editor,
  placement coordinator) updated to use event.localPosition
- Placement coordinator adds worldToBuildingLocal helper for cursor
  position conversion

2D Floorplan Fix:
- SVG layers wrapped in <g transform=rotate(...)> for building rotation
- Pointer-to-plan conversion un-rotates when building is rotated
- Grid events from 2D include localPosition

Store Changes:
- useEditor movingNode union includes BuildingNode
- NodeActionMenu onDelete is now optional (buildings can move but not delete)
This commit is contained in:
Pascal
2026-04-09 14:36:34 -04:00
committed by GitHub
parent 6c3ac3e030
commit 00b8f42899
22 changed files with 521 additions and 107 deletions
@@ -10,7 +10,12 @@ export const BuildingRenderer = ({ node }: { node: BuildingNode }) => {
useRegistry(node.id, node.type, ref)
const handlers = useNodeEvents(node, 'building')
return (
<group ref={ref} {...handlers}>
<group
position={node.position}
ref={ref}
rotation={[node.rotation[0], node.rotation[1], node.rotation[2]]}
{...handlers}
>
{node.children.map((childId) => (
<NodeRenderer key={childId} nodeId={childId} />
))}