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)
36 lines
945 B
TypeScript
36 lines
945 B
TypeScript
'use client'
|
|
|
|
import useEditor from '../../../store/use-editor'
|
|
import { BuildingHelper } from './building-helper'
|
|
import { CeilingHelper } from './ceiling-helper'
|
|
import { ItemHelper } from './item-helper'
|
|
import { RoofHelper } from './roof-helper'
|
|
import { SlabHelper } from './slab-helper'
|
|
import { WallHelper } from './wall-helper'
|
|
|
|
export function HelperManager() {
|
|
const tool = useEditor((s) => s.tool)
|
|
const movingNode = useEditor((state) => state.movingNode)
|
|
|
|
if (movingNode) {
|
|
if (movingNode.type === 'building') return <BuildingHelper showRotate />
|
|
return <ItemHelper showEsc />
|
|
}
|
|
|
|
// Show appropriate helper based on current tool
|
|
switch (tool) {
|
|
case 'wall':
|
|
return <WallHelper />
|
|
case 'item':
|
|
return <ItemHelper />
|
|
case 'slab':
|
|
return <SlabHelper />
|
|
case 'ceiling':
|
|
return <CeilingHelper />
|
|
case 'roof':
|
|
return <RoofHelper />
|
|
default:
|
|
return null
|
|
}
|
|
}
|