import { usePileCapStore } from '../../store/pileCapStore'; import { DraggableLabel } from './DraggableLabel'; export const ConstructionDiagram = () => { const geometry = usePileCapStore(state => state.geometry); const reinforcement = usePileCapStore(state => state.reinforcement); // Global Diagram State const isLocked = usePileCapStore(state => state.diagramState.isLocked); const labelPositions = usePileCapStore(state => state.diagramState.labelPositions); const setDiagramLocked = usePileCapStore(state => state.setDiagramLocked); const updateLabelPosition = usePileCapStore(state => state.updateLabelPosition); const getLabelPos = (id: string, defaultX: number, defaultY: number) => { return labelPositions[id] || { x: defaultX, y: defaultY }; }; // --- Drawing Logic --- const scale = 25; const padding = 80; // Increased padding // Dimensions const capWidthPx = geometry.length * scale; const capHeightPx = geometry.width * scale; // Plan view height const capDepthPx = (geometry.depth / 12) * scale; // Corrected: geometry.depth const colWidthPx = (geometry.columnLength / 12) * scale; const colDepthPx = (geometry.columnWidth / 12) * scale; // Plan view column depth // Layout const elevationY = padding + 60; // More space at top const planY = elevationY + capDepthPx + padding + 40; const centerX = padding + capWidthPx / 2; const svgWidth = capWidthPx + 2 * padding + 100; // Extra space for side labels const svgHeight = planY + capHeightPx + padding + 40; // Extra space at bottom // --- Elevation View --- // Cap const capRect = { x: padding, y: elevationY, w: capWidthPx, h: capDepthPx }; // Column Stub const colStubH = 40; const colStubRect = { x: centerX - colWidthPx / 2, y: elevationY - colStubH, w: colWidthPx, h: colStubH }; const pileDepth = 60; const pileWidth = (geometry.pileSize / 12) * scale; // --- Plan View --- const planRect = { x: padding, y: planY, w: capWidthPx, h: capHeightPx }; const colPlanRect = { x: centerX - colWidthPx / 2, y: planY + capHeightPx / 2 - colDepthPx / 2, w: colWidthPx, h: colDepthPx }; return (
{/* Controls */}
{/* --- Elevation View --- */} {/* Piles */} {/* Just drawing 4 schematic piles for now to match the "look" */} {[0.2, 0.4, 0.6, 0.8].map((f, i) => ( ))} {/* Cap */} {/* Column Stub */} {/* Column Reinf Schematic */} {/* Ties */} {/* Bottom Reinf Schematic */} {[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9].map((f, i) => ( ))} {/* Hooks */} {/* Dimensions Elevation */} {/* Depth */} {/* --- Plan View --- */} {/* Piles Plan */} {/* Schematic grid of piles */} {[0.2, 0.5, 0.8].map(fx => ( [0.2, 0.5, 0.8].map(fy => ( )) ))} {/* Column Plan */} {/* Column Reinf Plan */} {/* Centerlines */} Z X {/* Dimensions Plan */} {/* Length */} {/* Width */} {/* Reinf Callouts */} {/* Bottom Bars X */} {/* Bottom Bars Z */} {/* Column Reinf Label */}
); };