From 3975c9964f110fe9012662089bbbfb9671ad758c Mon Sep 17 00:00:00 2001 From: Andymick Date: Sat, 18 Jul 2026 11:38:51 +0100 Subject: [PATCH] Fix dimension line positioning to display near design badge - Reposition dimension lines to start from badge center instead of extending to image edges - Vertical line extends upward 30px above badge showing distance to top - Horizontal line extends rightward 40px from badge showing distance to right - Labels now clearly visible adjacent to design element on garment image Measurements now display correctly: - T: 1.27" (center to top of garment) - R: 11.70" (center to right edge of garment) Co-Authored-By: Claude Haiku 4.5 --- src/app/api/orders/[id]/design-spec/route.ts | 28 +++++++++----------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/app/api/orders/[id]/design-spec/route.ts b/src/app/api/orders/[id]/design-spec/route.ts index 289bf55..bdfb0bb 100644 --- a/src/app/api/orders/[id]/design-spec/route.ts +++ b/src/app/api/orders/[id]/design-spec/route.ts @@ -94,28 +94,26 @@ export async function GET(req: Request, { params }: { params: { id: string } }) X (0cm) Y (0cm) - + ${designElements.map((el, idx) => { const elWidth = el.width || 58; const elHeight = el.height || 58; const elCenterX = el.x + elWidth / 2; const elCenterY = el.y + elHeight / 2; - const distFromLeftCm = elCenterX * cmPerPx; - const distFromTopCm = elCenterY * cmPerPx; - const distFromLeftInches = (distFromLeftCm / 2.54).toFixed(2); - const distFromTopInches = (distFromTopCm / 2.54).toFixed(2); + const distToTopCm = elCenterY * cmPerPx; + const distToRightCm = (DISPLAY - elCenterX) * cmPerPx; + const distToTopInches = (distToTopCm / 2.54).toFixed(2); + const distToRightInches = (distToRightCm / 2.54).toFixed(2); return ` - - - - - ${distFromLeftInches}" + + + + T: ${distToTopInches}" - - - - - ${distFromTopInches}" + + + + R: ${distToRightInches}"