diff --git a/svelte-app/src/lib/canvas/renderer.ts b/svelte-app/src/lib/canvas/renderer.ts index fd28957..c498ee6 100644 --- a/svelte-app/src/lib/canvas/renderer.ts +++ b/svelte-app/src/lib/canvas/renderer.ts @@ -556,10 +556,13 @@ 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; - const midW = (w2 + sym.w) / 2; // width at vertical midpoint - cx = sym.x + midW / 2; - cy = sym.y + sym.h / 2; - availW = midW - pad * 2; + // Use the width at 40% from top (biased toward narrow end for safe fit) + const t = 0.4; + const widthAtT = w2 + t * (sym.w - w2); + cx = sym.x + widthAtT / 2; + cy = sym.y + sym.h * t; + // Use narrower of top/bottom edge with padding for safe text fit + availW = Math.min(w2, widthAtT) - pad * 2; availH = sym.h - pad * 2; } else { cx = sym.x + sym.w / 2; diff --git a/svelte-app/src/lib/export.ts b/svelte-app/src/lib/export.ts index 1413a04..63c1f59 100644 --- a/svelte-app/src/lib/export.ts +++ b/svelte-app/src/lib/export.ts @@ -44,9 +44,11 @@ function emitConveyanceLabelInner(lines: string[], sym: PlacedSymbol) { textRotDeg = (textRotRad * 180) / Math.PI; } else if (isSpurType(sym.symbolId)) { const w2 = sym.w2 ?? sym.w; - labelCx = sym.x + (w2 + sym.w) / 4; - labelCy = sym.y + sym.h / 2; - availH = sym.h - 4; + const t = 0.4; + const widthAtT = w2 + t * (sym.w - w2); + labelCx = sym.x + widthAtT / 2; + labelCy = sym.y + sym.h * t; + availH = Math.min(sym.h - 4, widthAtT - 4); } else if (isInductionType(sym.symbolId)) { const stripTopY = sym.y + sym.h * INDUCTION_CONFIG.stripTopFrac; const stripBottomY = sym.y + sym.h * INDUCTION_CONFIG.stripBottomFrac;