Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3399cece23 |
@@ -18,6 +18,10 @@ const {
|
||||
const SIG_CANVAS_W = 600;
|
||||
const SIG_CANVAS_H = 160;
|
||||
|
||||
// Mindestabstand des Adressblocks zum rechten Rand (mm). Der Plotter braucht rechts
|
||||
// Greiffläche – gilt einheitlich für Postkarte UND Umschlag-Empfänger (mit Absender).
|
||||
const RAND_RECHTS_MM = 15;
|
||||
|
||||
/**
|
||||
* Extrahiert Path- und Polyline-Elemente aus einem SVG-String und gibt sie als
|
||||
* umgeformte <g>-Gruppe zurück, die an Position (x, y) mit Skalierung scale eingebettet ist.
|
||||
@@ -297,7 +301,12 @@ 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.36 : 0.6));
|
||||
// Empfänger unten rechts (mit Absender): Startpunkt zuerst festlegen, dann die
|
||||
// Textbreite so begrenzen, dass rechts der Plotter-Mindestabstand frei bleibt.
|
||||
const startXEmpf = Math.round(widthPx * 0.55);
|
||||
const maxWidthPx = hatAbsender
|
||||
? Math.max(mmToPx(30), (widthPx - mmToPx(RAND_RECHTS_MM)) - startXEmpf)
|
||||
: Math.min(widthPx - marginLeftPx - 20, widthPx * 0.6);
|
||||
|
||||
lines = wrapTextToLinesByWidth({
|
||||
text: String(text || ''),
|
||||
@@ -309,7 +318,7 @@ function generateEnvelopeSVG(text, format, type, options = {}) {
|
||||
if (hatAbsender) {
|
||||
// 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);
|
||||
startX = startXEmpf;
|
||||
const untenBaseline = heightPx * 0.80; // unterste Zeile ~20 % über der Unterkante
|
||||
startY = Math.round(untenBaseline - Math.max(0, lines.length - 1) * lineHeightPx);
|
||||
} else {
|
||||
@@ -452,7 +461,7 @@ function generatePostcardSVG(text, format, options = {}) {
|
||||
const textRight = widthPx * 0.48;
|
||||
const textWidth = Math.max(mmToPx(30), textRight - textLeft);
|
||||
const addrLeft = widthPx * 0.52;
|
||||
const addrRight = widthPx - mmToPx(8);
|
||||
const addrRight = widthPx - mmToPx(RAND_RECHTS_MM);
|
||||
const addrWidth = Math.max(mmToPx(30), addrRight - addrLeft);
|
||||
const stampW = mmToPx(25);
|
||||
const stampX = widthPx - mmToPx(6) - stampW;
|
||||
|
||||
Reference in New Issue
Block a user