[78] Plannummer im Titelblock (laufend oder Layout.planNumber), Sheet und PDF; Tests

This commit is contained in:
karim committed 2026-10-27 20:18:18 +01:00
1 parent 5fec1ea809
commit 8a4e7293dc
5 files changed
+27 -3

No files matched your search

+9
View File
@@ -641,6 +641,8 @@ export interface ResolvedTitleBlock {
scale: string;
date: string;
author: string;
/** Plannummer: `Layout.planNumber`, sonst laufende Nummer des Blatts im Projekt ("01", "02" …). */
planNumber: string;
}
/**
@@ -671,9 +673,16 @@ export function resolveTitleBlock(
scale: nonEmpty(tb.scale) ?? (scaleN ? `1:${scaleN}` : "—"),
date: nonEmpty(tb.date) ?? today,
author: nonEmpty(tb.author) ?? "",
planNumber: nonEmpty(layout.planNumber) ?? autoPlanNumber(project, layout),
};
}
/** Laufende Plannummer: Position des Layouts in `project.layouts` (1-basiert, zweistellig). */
function autoPlanNumber(project: Project, layout: Layout): string {
const i = (project.layouts ?? []).findIndex((l) => l.id === layout.id);
return String((i < 0 ? 0 : i) + 1).padStart(2, "0");
}
/**
* Sichtbare Kategorie-Codes eines Ausschnitts als Set (für `generatePlan`). Aus
* der gespeicherten `layerVisibility`-Map (Code → sichtbar) abgeleitet.