From 49d426eef3cb791be5825d8286dc3b26caab1ab6 Mon Sep 17 00:00:00 2001 From: igurielidze Date: Mon, 30 Mar 2026 21:36:10 +0400 Subject: [PATCH] Spur label: center at midpoint between w2 and w (right half) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Text centered at x = (w2 + w) / 2 — the middle of the wide right portion of the trapezoid where there's the most space. Co-Authored-By: Claude Opus 4.6 (1M context) --- svelte-app/src/lib/canvas/renderer.ts | 4 ++-- svelte-app/src/lib/export.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/svelte-app/src/lib/canvas/renderer.ts b/svelte-app/src/lib/canvas/renderer.ts index 4989ee5..cdbedfc 100644 --- a/svelte-app/src/lib/canvas/renderer.ts +++ b/svelte-app/src/lib/canvas/renderer.ts @@ -556,8 +556,8 @@ function drawConveyanceLabel(ctx: CanvasRenderingContext2D, sym: PlacedSymbol) { let cx: number, cy: number, availW: number, availH: number; if (isSpurType(sym.symbolId)) { const w2 = sym.w2 ?? sym.w; - // Place text at the wide end corner — no horizontal padding needed - cx = sym.x + sym.w / 2; + // Center text in the right half (wide area) of the trapezoid + cx = sym.x + (w2 + sym.w) / 2; cy = sym.y + sym.h / 2; availW = sym.w; availH = sym.h; diff --git a/svelte-app/src/lib/export.ts b/svelte-app/src/lib/export.ts index 2595fb1..c6d788d 100644 --- a/svelte-app/src/lib/export.ts +++ b/svelte-app/src/lib/export.ts @@ -43,7 +43,8 @@ function emitConveyanceLabelInner(lines: string[], sym: PlacedSymbol) { // Mirror: label follows the mirrored shape naturally textRotDeg = (textRotRad * 180) / Math.PI; } else if (isSpurType(sym.symbolId)) { - labelCx = sym.x + sym.w / 2; + const w2 = sym.w2 ?? sym.w; + labelCx = sym.x + (w2 + sym.w) / 2; labelCy = sym.y + sym.h / 2; availH = sym.h - 4; } else if (isInductionType(sym.symbolId)) {