Spur label: center at midpoint between w2 and w (right half)

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) <noreply@anthropic.com>
This commit is contained in:
igurielidze 2026-03-30 21:36:10 +04:00
parent 9197697129
commit 49d426eef3
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -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)) {