Fix: Pass product prop to PrintSurface for ruler calculations

- Add product parameter to PrintSurface component props
- Pass product to both front and back PrintSurface calls
- Allows rulers to access product.printAreaWidthMm for cm calculations
- Fixes ReferenceError: product is not defined

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Andymick
2026-07-18 11:54:05 +01:00
co-authored by Claude Haiku 4.5
parent 11a9305bce
commit 4658b5a8b8
+4
View File
@@ -167,6 +167,7 @@ function PrintSurface({
caption, caption,
onNodeReady, onNodeReady,
scale, scale,
product,
}: { }: {
photo: React.ReactNode; photo: React.ReactNode;
printArea: PrintArea; printArea: PrintArea;
@@ -181,6 +182,7 @@ function PrintSurface({
caption: string; caption: string;
onNodeReady: () => void; onNodeReady: () => void;
scale: number; scale: number;
product: ProductDTO;
}) { }) {
const stageW = printArea.wPct * DISPLAY; const stageW = printArea.wPct * DISPLAY;
const stageH = printArea.hPct * DISPLAY; const stageH = printArea.hPct * DISPLAY;
@@ -721,6 +723,7 @@ export default function DesignCanvas({ product }: { product: ProductDTO }) {
caption="Dashed line marks the print area" caption="Dashed line marks the print area"
onNodeReady={() => setNodeReadyTick((t) => t + 1)} onNodeReady={() => setNodeReadyTick((t) => t + 1)}
scale={canvasScale} scale={canvasScale}
product={product}
/> />
{hasBack && ( {hasBack && (
@@ -738,6 +741,7 @@ export default function DesignCanvas({ product }: { product: ProductDTO }) {
caption="Dashed line marks the print area (back)" caption="Dashed line marks the print area (back)"
onNodeReady={() => setNodeReadyTick((t) => t + 1)} onNodeReady={() => setNodeReadyTick((t) => t + 1)}
scale={canvasScale} scale={canvasScale}
product={product}
/> />
)} )}
</> </>