[89] Layout-Blatt: Zeichnen wie im Grundriss (Blatt-Ebene statt eigener Annotationen)

Jedes Layout hat eine Blatt-Ebene (DrawingLevel.layoutId, Papier 1:1 in Metern); ein offenes Blatt
macht sie zur aktiven Ebene in derselben PlanView: gleiche Befehle, Fang, Griffe, Vorschau/HUD,
Auswahl, Undo und dasselbe Rendering. Das Blatt liefert nur den Hintergrund (PlanView.backdrop) und
das Platzieren der Viewports. Format 3 migriert Layout.annotations zu drawings2d. Layout-PDF legt die
Blatt-Ebene über planToPrintSvg aufs Papier. Alter Annotations-Pfad gelöscht. e2e layoutSheet.spec.ts.
This commit is contained in:
Claude committed 2026-10-29 20:29:55 +00:00
1 parent c78021473b
commit 3ff123773a
43 files changed
+1245 -2756

No files matched your search

+3 -4
View File
@@ -18,10 +18,9 @@ export interface FontMetricRatios {
}
/** Zeilenabstand-Vielfaches für gezeichneten Text, EINE Quelle für alle
* Verbraucher (primitives.tsx "drawingText" fontSize*1.25, PlanView.tsx/
* LayoutSheet.tsx Inline-Editor-Anker UND deren CSS `line-height` in
* styles.css `.planview-inline-text .rt-surface`/`.layout-sheet-inline-text
* .rt-surface` — alle MÜSSEN denselben Wert verwenden, sonst driften
* Verbraucher (primitives.tsx "drawingText" fontSize*1.25, PlanView.tsx
* Inline-Editor-Anker UND dessen CSS `line-height` in styles.css
* `.planview-inline-text .rt-surface` — alle MÜSSEN denselben Wert verwenden, sonst driften
* Editor-Position und späteres Rendering wieder auseinander). */
export const TEXT_LINE_HEIGHT_MULT = 1.25;
+1 -11
View File
@@ -3,7 +3,7 @@
import { describe, expect, it } from "vitest";
import { docFromText, makeRun, type RichTextDoc } from "./richText";
import { annotationTextLines, docToHtml, layoutText, runCssProps } from "./renderHtml";
import { docToHtml, layoutText, runCssProps } from "./renderHtml";
const OPTS = { x: 0, y: 0, lineHeight: 10, unitPerPt: 1, basePt: 10, color: "#000000" };
@@ -29,16 +29,6 @@ describe("layoutText", () => {
expect(at({ columnWidth: NaN })).toEqual(at({}));
});
it("Layout-Markup: Basis = Höhe in mm, Vorschub 1.25 × Höhe, Rahmen nur bei Breite > 0 umbrochen", () => {
const doc = docFromText("eins zwei drei");
const l = annotationTextLines({ xMm: 10, yMm: 20, heightMm: 4, widthMm: 15 }, doc);
expect(l.map((x) => x.y)).toEqual([20, 25, 30]);
expect(l[0].tspans[0]).toMatchObject({ fontSize: 4, fill: "#111111" });
// Negative Breite: kein Umbruch, aber (wie früher) Spalte für die Lage.
const r = annotationTextLines({ xMm: 10, yMm: 20, heightMm: 4, widthMm: -6 }, { version: 1, paragraphs: [{ runs: [makeRun("x")], align: "right" }] });
expect([r.length, r[0].x]).toEqual([1, 4]);
});
it("bricht lange Absätze wortweise auf mehrere Zeilen um", () => {
const doc = docFromText("eins zwei drei vier fünf");
const lines = layoutText(doc, { ...OPTS, wrapWidthUnits: 30 });
-21
View File
@@ -264,27 +264,6 @@ export function layoutText(doc: RichTextDoc, opts: SvgTextOptions): SvgLine[] {
return lines;
}
/**
* Zeilen eines Text-Markups auf dem Layout-Blatt (Papier-mm; Layout-Blatt und Layout-PDF): Höhe
* `heightMm` als Basisgrösse, Vorschub 1.25 × Höhe, erste Grundlinie bei `yMm`; mit Rahmenbreite
* (`widthMm` > 0) wortweise umbrochen, Mitte/rechts im Rahmen (jede Breite ≠ 0 zählt dafür, wie früher).
*/
export function annotationTextLines(
ann: { xMm: number; yMm: number; heightMm: number; widthMm?: number; color?: string },
doc: RichTextDoc,
): SvgLine[] {
return layoutText(doc, {
x: ann.xMm,
y: ann.yMm,
lineHeight: ann.heightMm * 1.25,
unitPerPt: 25.4 / 72,
basePt: (ann.heightMm / 25.4) * 72,
color: ann.color ?? "#111111",
wrapWidthUnits: ann.widthMm && ann.widthMm > 0 ? ann.widthMm : undefined,
columnWidth: ann.widthMm,
});
}
/**
* Raumstempel-Block (Kern `stamp_block`): Rich-Text-Zeilen (Vorschub 1.3 × Basisgrösse bzw. die
* Absatz-Zeilenhöhe) und darunter die Live-Zeilen (0.8 × Basisgrösse), vertikal um `y0` zentriert,