diff --git a/src/components/DesignCanvas.tsx b/src/components/DesignCanvas.tsx index 63535d0..032a8ba 100644 --- a/src/components/DesignCanvas.tsx +++ b/src/components/DesignCanvas.tsx @@ -200,6 +200,77 @@ function PrintSurface({
{photo}
+ + {/* Horizontal Ruler */} +
+ {Array.from({ length: Math.ceil((stageW / (10 * (product.printAreaWidthMm / 100)))) }).map((_, i) => { + const cm = i * 2; + const px = (cm * stageW) / (product.printAreaWidthMm / 10); + if (px > stageW) return null; + return ( +
+ {cm}cm +
+ ); + })} +
+ + {/* Vertical Ruler */} +
+ {Array.from({ length: Math.ceil((stageH / (10 * (product.printAreaWidthMm / 100)))) }).map((_, i) => { + const cm = i * 2; + const px = (cm * stageH) / (product.printAreaWidthMm / 10); + if (px > stageH) return null; + return ( +
+ {cm} +
+ ); + })} +
+
(px * cmPerPx).toFixed(2); const setActiveElements = view === 'front' ? setElementsFront : setElementsBack; // Keep whichever transformer actually owns the selected element in sync, and @@ -779,25 +855,25 @@ export default function DesignCanvas({ product }: { product: ProductDTO }) { {selected && (
-

Position & Size

+

Position & Size (cm)

X: - {Math.round(selected.x)} px + {pxToCm(selected.x)} cm
Y: - {Math.round(selected.y)} px + {pxToCm(selected.y)} cm
{selected.type === 'image' && ( <>
Width: - {Math.round(selected.width)} px + {pxToCm(selected.width)} cm
Height: - {Math.round(selected.height)} px + {pxToCm(selected.height)} cm
)}