From 6545c4fc5168190f0b8f94cc7842f05a541172b6 Mon Sep 17 00:00:00 2001 From: dtoro Date: Tue, 10 Mar 2026 23:53:05 +0100 Subject: [PATCH] fix: card image vertical alignment --- frontend/src/app/platform/ProjectsPage.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/platform/ProjectsPage.tsx b/frontend/src/app/platform/ProjectsPage.tsx index 87e5f7e..89506e0 100644 --- a/frontend/src/app/platform/ProjectsPage.tsx +++ b/frontend/src/app/platform/ProjectsPage.tsx @@ -129,6 +129,8 @@ function GraphThumbnail({ projectId, className }: { projectId: string; className } const padding = 12 + const viewBoxW = 200 + const viewBoxH = 120 const xs = withPos.map((n) => n.position!.x) const ys = withPos.map((n) => n.position!.y) const minX = Math.min(...xs) @@ -137,9 +139,11 @@ function GraphThumbnail({ projectId, className }: { projectId: string; className const maxY = Math.max(...ys) const w = Math.max(maxX - minX, 1) const h = Math.max(maxY - minY, 1) - const scale = Math.min((200 - padding * 2) / w, (120 - padding * 2) / h, 8) - const ox = padding - minX * scale - const oy = padding - minY * scale + const scale = Math.min((viewBoxW - padding * 2) / w, (viewBoxH - padding * 2) / h, 8) + const graphW = w * scale + const graphH = h * scale + const ox = (viewBoxW - graphW) / 2 - minX * scale + const oy = (viewBoxH - graphH) / 2 - minY * scale const nodeById = new Map(withPos.map((n) => [n.id, n])) const validEdges = edges.filter((e) => nodeById.has(e.source) && nodeById.has(e.target))