2 Commits

Author SHA1 Message Date
s4luorth
bffb7a1085 Kuvert: Empfaenger weiter nach rechts (60% statt 52% Breite)
All checks were successful
Build & Deploy / deploy (push) Successful in 20s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-01 15:43:14 +02:00
s4luorth
13f8394512 Kuvert: Absender oben links, Empfaenger unten rechts sauber positioniert
All checks were successful
Build & Deploy / deploy (push) Successful in 20s
Positionierung ueber Hoehen-/Breiten-Anteile statt ueber den grossen Kuvert-Rand
(marginTop bis ~50% der Hoehe): Absender ~14% oben/6% links, Empfaenger ~65-80%
unten/rechts. Vorher klebten beide im mittleren Band.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-01 15:30:40 +02:00

View File

@@ -297,7 +297,7 @@ function generateEnvelopeSVG(text, format, type, options = {}) {
// type === 'recipient' / 'free'. Ist ein Absender gesetzt, sitzt der
// Empfänger UNTEN RECHTS (klassisches Kuvert), sonst wie bisher oben links.
const hatAbsender = !!String(options.sender || '').trim();
const maxWidthPx = Math.min(widthPx - marginLeftPx - 20, widthPx * (hatAbsender ? 0.48 : 0.6));
const maxWidthPx = Math.min(widthPx - marginLeftPx - 20, widthPx * (hatAbsender ? 0.36 : 0.6));
lines = wrapTextToLinesByWidth({
text: String(text || ''),
@@ -307,8 +307,11 @@ function generateEnvelopeSVG(text, format, type, options = {}) {
});
if (hatAbsender) {
startX = Math.max(marginLeftPx, Math.round(widthPx * 0.48));
startY = Math.max(marginTopPx + fontSizePx, heightPx - marginTopPx - lines.length * lineHeightPx + fontSizePx);
// Empfänger unten rechts – bewusst über Höhen-/Breiten-Anteile, damit der
// große Kuvert-Rand (marginTop bis ~50 % der Höhe) nicht alles nach oben zieht.
startX = Math.round(widthPx * 0.60);
const untenBaseline = heightPx * 0.80; // unterste Zeile ~20 % über der Unterkante
startY = Math.round(untenBaseline - Math.max(0, lines.length - 1) * lineHeightPx);
} else {
startX = marginLeftPx;
startY = marginTopPx + fontSizePx;
@@ -364,8 +367,9 @@ function generateEnvelopeSVG(text, format, type, options = {}) {
lines: absLines,
fontFileName: fontConfig.file,
fontSizePx: absSize,
startX: marginLeftPx,
startY: marginTopPx + absSize,
// Echt oben links – unabhängig vom großen Kuvert-Rand.
startX: Math.round(widthPx * 0.06),
startY: Math.round(heightPx * 0.14),
lineHeightPx: absLH,
realisticHandwriting: options.realisticHandwriting ?? false,
});