diff --git a/svelte-app/src/lib/canvas/renderer.ts b/svelte-app/src/lib/canvas/renderer.ts index ea4d014..a49d201 100644 --- a/svelte-app/src/lib/canvas/renderer.ts +++ b/svelte-app/src/lib/canvas/renderer.ts @@ -573,8 +573,7 @@ function drawConveyanceLabel(ctx: CanvasRenderingContext2D, sym: PlacedSymbol) { // - Counter-mirror if symbol is mirrored (so text doesn't read backwards) const rot = ((sym.rotation || 0) % 360 + 360) % 360; const needsFlip = rot > 90 && rot < 270; - const needsMirrorFix = sym.mirrored; - const hasCorrection = needsFlip || needsMirrorFix; + const hasCorrection = needsFlip; ctx.fillStyle = '#000000'; ctx.textAlign = 'center'; @@ -603,7 +602,6 @@ function drawConveyanceLabel(ctx: CanvasRenderingContext2D, sym: PlacedSymbol) { ctx.save(); ctx.translate(cx, cy); if (needsFlip) ctx.rotate(Math.PI); - if (needsMirrorFix) ctx.scale(-1, 1); for (let i = 0; i < tryLines.length; i++) { const dy = -(lineCount - 1) * lineH / 2 + i * lineH; ctx.fillText(tryLines[i], 0, dy); @@ -643,8 +641,7 @@ function drawCurvedLabel(ctx: CanvasRenderingContext2D, sym: PlacedSymbol) { if (worldAngle > Math.PI / 2 && worldAngle < Math.PI * 3 / 2) { textRot += Math.PI; } - // Handle mirror - if (sym.mirrored) textRot = -textRot; + // Mirror: label follows the mirrored shape naturally const availW = bandW - 4; diff --git a/svelte-app/src/lib/export.ts b/svelte-app/src/lib/export.ts index 8f980ab..1bac73c 100644 --- a/svelte-app/src/lib/export.ts +++ b/svelte-app/src/lib/export.ts @@ -40,7 +40,7 @@ function emitConveyanceLabelInner(lines: string[], sym: PlacedSymbol) { let worldAngle = (textRotRad + symRotRad) % (2 * Math.PI); if (worldAngle < 0) worldAngle += 2 * Math.PI; if (worldAngle > Math.PI / 2 && worldAngle < Math.PI * 3 / 2) textRotRad += Math.PI; - if (sym.mirrored) textRotRad = -textRotRad; + // Mirror: label follows the mirrored shape naturally textRotDeg = (textRotRad * 180) / Math.PI; } else if (isSpurType(sym.symbolId)) { const w2 = sym.w2 ?? sym.w; @@ -63,8 +63,7 @@ function emitConveyanceLabelInner(lines: string[], sym: PlacedSymbol) { if (!isCurvedType(sym.symbolId)) { const rot = ((sym.rotation || 0) % 360 + 360) % 360; if (rot > 90 && rot < 270) textRotDeg = 180; - // Mirror fix: text inside group inherits mirror, counter it - if (sym.mirrored && textRotDeg === 0) textRotDeg = 0; // mirrored handled by scale in group + // Mirror: label follows mirrored shape naturally (inside group) } const fontSize = Math.min(14, availH / textLines.length);