Spur label: position at the right-angle corner (65% w, 65% h)

Shift text toward the bottom-right corner of the trapezoid where
the right angle creates the most open space for the label.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
igurielidze 2026-03-30 21:36:53 +04:00
parent 49d426eef3
commit dba857bcc6
2 changed files with 7 additions and 7 deletions

View File

@ -556,9 +556,10 @@ function drawConveyanceLabel(ctx: CanvasRenderingContext2D, sym: PlacedSymbol) {
let cx: number, cy: number, availW: number, availH: number; let cx: number, cy: number, availW: number, availH: number;
if (isSpurType(sym.symbolId)) { if (isSpurType(sym.symbolId)) {
const w2 = sym.w2 ?? sym.w; const w2 = sym.w2 ?? sym.w;
// Center text in the right half (wide area) of the trapezoid // Center text at the right-angle corner (w, h) where the most space is.
cx = sym.x + (w2 + sym.w) / 2; // The right edge at mid-height is at (w2+w)/2. Shift further right.
cy = sym.y + sym.h / 2; cx = sym.x + sym.w * 0.65;
cy = sym.y + sym.h * 0.65;
availW = sym.w; availW = sym.w;
availH = sym.h; availH = sym.h;
} else { } else {

View File

@ -43,10 +43,9 @@ function emitConveyanceLabelInner(lines: string[], sym: PlacedSymbol) {
// Mirror: label follows the mirrored shape naturally // Mirror: label follows the mirrored shape naturally
textRotDeg = (textRotRad * 180) / Math.PI; textRotDeg = (textRotRad * 180) / Math.PI;
} else if (isSpurType(sym.symbolId)) { } else if (isSpurType(sym.symbolId)) {
const w2 = sym.w2 ?? sym.w; labelCx = sym.x + sym.w * 0.65;
labelCx = sym.x + (w2 + sym.w) / 2; labelCy = sym.y + sym.h * 0.65;
labelCy = sym.y + sym.h / 2; availH = sym.h;
availH = sym.h - 4;
} else if (isInductionType(sym.symbolId)) { } else if (isInductionType(sym.symbolId)) {
const stripTopY = sym.y + sym.h * INDUCTION_CONFIG.stripTopFrac; const stripTopY = sym.y + sym.h * INDUCTION_CONFIG.stripTopFrac;
const stripBottomY = sym.y + sym.h * INDUCTION_CONFIG.stripBottomFrac; const stripBottomY = sym.y + sym.h * INDUCTION_CONFIG.stripBottomFrac;