import { Stage, Layer, Line } from "react-konva"; import useEditorStore from "./useEditorStore"; import TextElement from "./elements/TextElement"; import TableElement from "./elements/TableElement"; import ImageElement from "./elements/ImageElement.jsx"; import QRCodeElement from "./elements/QRCodeElement"; import LineElement from "./elements/LineElement"; import SummaryElement from "./elements/SummaryElement"; import RectangleElement from "./elements/RectangleElement"; export default function CanvasStage() { const elements = useEditorStore((state) => state.elements); const page = useEditorStore((state) => state.page); const setSelectedId = useEditorStore((state) => state.setSelectedId); const centerX = page.width / 2; const centerY = page.height / 2; return ( { // Deselect when clicking on empty canvas if (e.target === e.target.getStage()) { setSelectedId(null); } }} > {/* GRID */} {Array.from({ length: 50 }).map((_, i) => ( ))} {/* CENTER GUIDES */} {elements.map((el) => { if (el.type === "text") { return ; } if (el.type === "table") { return ; } if (el.type === "image") { return ; } if (el.type === "qrcode") { return ; } if (el.type === "line") { return ; } if (el.type === "rectangle") { return ; } if (el.type === "summary") { return ; } return null; })} ); }