[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:
43 files changed
+1245
-2756
No files matched your search
@@ -11,15 +11,14 @@ import type {
|
||||
ViewSnapshot,
|
||||
} from "./types";
|
||||
import {
|
||||
addAnnotation,
|
||||
addViewport,
|
||||
buildLayoutTree,
|
||||
buildMasterTree,
|
||||
collectFolderLayouts,
|
||||
createAnnotation,
|
||||
createLayout,
|
||||
createLayoutFolder,
|
||||
createMasterLayout,
|
||||
createSheetLevel,
|
||||
createViewport,
|
||||
deleteFolder,
|
||||
deleteMasterFolder,
|
||||
@@ -28,15 +27,18 @@ import {
|
||||
findSnapshot,
|
||||
folderPdfPages,
|
||||
isDescendant,
|
||||
isSheetLevel,
|
||||
moveFolderToFolder,
|
||||
moveLayoutToFolder,
|
||||
PAPER_FORMATS,
|
||||
patchAnnotation,
|
||||
patchViewport,
|
||||
removeAnnotation,
|
||||
removeViewport,
|
||||
resolveTitleBlock,
|
||||
resolveViewportScale,
|
||||
SHEET_SCALE_DENOMINATOR,
|
||||
sheetLevelOf,
|
||||
sheetMmToModel,
|
||||
sheetModelToMm,
|
||||
sheetSizeMm,
|
||||
visibleCodesFromSnapshot,
|
||||
} from "./layoutModel";
|
||||
@@ -139,91 +141,29 @@ describe("Viewport-CRUD (immutabel)", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ── Annotationen (Linie/Rechteck/Text) ───────────────────────────────────────
|
||||
// ── Blatt-Ebene (2D-Zeichnung auf dem Blatt) ────────────────────────────────
|
||||
|
||||
describe("createAnnotation — Defaults je Art", () => {
|
||||
it("line: Default-Geometrie ohne Farbe/Strichstärke", () => {
|
||||
const a = createAnnotation("a1", "line");
|
||||
expect(a).toEqual({ id: "a1", kind: "line", x1Mm: 20, y1Mm: 20, x2Mm: 80, y2Mm: 20 });
|
||||
});
|
||||
it("line: init überschreibt einzelne Felder + optionale Farbe/Strichstärke", () => {
|
||||
const a = createAnnotation("a1", "line", { x1Mm: 5, color: "#f00", weightMm: 0.5 });
|
||||
expect(a).toMatchObject({ x1Mm: 5, y1Mm: 20, color: "#f00", weightMm: 0.5 });
|
||||
});
|
||||
it("rect: Default-Grösse", () => {
|
||||
const a = createAnnotation("a2", "rect");
|
||||
expect(a).toEqual({ id: "a2", kind: "rect", xMm: 20, yMm: 20, widthMm: 40, heightMm: 30 });
|
||||
});
|
||||
it("text: Default-Zeilenhöhe 3.5mm, leerer Text", () => {
|
||||
const a = createAnnotation("a3", "text");
|
||||
expect(a).toEqual({ id: "a3", kind: "text", xMm: 20, yMm: 20, text: "", heightMm: 3.5 });
|
||||
});
|
||||
it("text: init setzt Inhalt + Höhe", () => {
|
||||
const a = createAnnotation("a3", "text", { text: "EG", heightMm: 5 });
|
||||
expect(a).toMatchObject({ text: "EG", heightMm: 5 });
|
||||
});
|
||||
it("text: init mit doc/widthMm (Rich-Text-Frame) wird übernommen", () => {
|
||||
const doc = { version: 1 as const, paragraphs: [{ runs: [{ text: "Hi", marks: {} }] }] };
|
||||
const a = createAnnotation("a3", "text", { doc, widthMm: 50 });
|
||||
expect(a).toMatchObject({ doc, widthMm: 50 });
|
||||
});
|
||||
it("image: Default-Grösse, leere Quelle", () => {
|
||||
const a = createAnnotation("a4", "image");
|
||||
expect(a).toEqual({ id: "a4", kind: "image", xMm: 20, yMm: 20, widthMm: 60, heightMm: 40, src: "" });
|
||||
});
|
||||
it("image: init setzt Quelle + Grösse + Deckkraft", () => {
|
||||
const a = createAnnotation("a4", "image", { src: "data:image/png;base64,x", widthMm: 30, heightMm: 20, opacity: 0.5 });
|
||||
expect(a).toMatchObject({ src: "data:image/png;base64,x", widthMm: 30, heightMm: 20, opacity: 0.5 });
|
||||
});
|
||||
});
|
||||
describe("Blatt-Ebene", () => {
|
||||
const lay = createLayout("l1", "Blatt 1", "a3", "landscape");
|
||||
const sheet = createSheetLevel("sheet-l1", lay);
|
||||
|
||||
describe("Annotations-CRUD (immutabel)", () => {
|
||||
const base = createLayout("l1", "L", "a4", "portrait");
|
||||
|
||||
it("addAnnotation verändert das Original nicht", () => {
|
||||
const after = addAnnotation(base, createAnnotation("a1", "line"));
|
||||
expect(base.annotations).toBeUndefined();
|
||||
expect(after.annotations).toHaveLength(1);
|
||||
expect(after).not.toBe(base);
|
||||
it("ist eine Zeichnungsebene mit Layout-Bezug", () => {
|
||||
expect(sheet).toEqual({ id: "sheet-l1", name: "Blatt 1", kind: "drawing", visible: true, locked: false, layoutId: "l1" });
|
||||
expect(isSheetLevel(sheet)).toBe(true);
|
||||
expect(isSheetLevel({ layoutId: undefined })).toBe(false);
|
||||
expect(isSheetLevel(undefined)).toBe(false);
|
||||
});
|
||||
|
||||
it("addAnnotation baut auf einer fehlenden `annotations`-Liste auf (Alt-Layout)", () => {
|
||||
const legacy: Layout = { id: "old", name: "Alt", paper: "a4", orientation: "portrait", viewports: [] };
|
||||
const after = addAnnotation(legacy, createAnnotation("a1", "rect"));
|
||||
expect(after.annotations).toHaveLength(1);
|
||||
expect(legacy.annotations).toBeUndefined();
|
||||
it("wird über das Layout gefunden", () => {
|
||||
const p = { drawingLevels: [{ id: "eg", name: "EG", kind: "floor", visible: true, locked: false }, sheet] } as unknown as Project;
|
||||
expect(sheetLevelOf(p, "l1")).toBe(sheet);
|
||||
expect(sheetLevelOf(p, "nope")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("removeAnnotation entfernt per Id", () => {
|
||||
let l = addAnnotation(base, createAnnotation("a1", "line"));
|
||||
l = addAnnotation(l, createAnnotation("a2", "rect"));
|
||||
const removed = removeAnnotation(l, "a1");
|
||||
expect(removed.annotations!.map((a) => a.id)).toEqual(["a2"]);
|
||||
});
|
||||
|
||||
it("removeAnnotation auf Alt-Layout ohne `annotations` bleibt heil (No-op)", () => {
|
||||
const legacy: Layout = { id: "old", name: "Alt", paper: "a4", orientation: "portrait", viewports: [] };
|
||||
const r = removeAnnotation(legacy, "nope");
|
||||
expect(r.annotations).toEqual([]);
|
||||
});
|
||||
|
||||
it("patchAnnotation ändert nur das Ziel, immutabel", () => {
|
||||
const l = addAnnotation(base, createAnnotation("a1", "line", { color: "#111" }));
|
||||
const patched = patchAnnotation(l, "a1", { x1Mm: 42, color: "#0f0" });
|
||||
expect(patched.annotations![0]).toMatchObject({ x1Mm: 42, color: "#0f0" });
|
||||
expect((l.annotations![0] as { color?: string }).color).toBe("#111");
|
||||
});
|
||||
|
||||
it("patchAnnotation: unbekannte Id → No-op (gleiche Werte, neue Liste)", () => {
|
||||
const l = addAnnotation(base, createAnnotation("a1", "line"));
|
||||
const noop = patchAnnotation(l, "nope", { x1Mm: 1 });
|
||||
expect((noop.annotations![0] as { x1Mm: number }).x1Mm).toBe(20);
|
||||
});
|
||||
|
||||
it("patchAnnotation auf einer Text-Annotation ändert den Inhalt", () => {
|
||||
const l = addAnnotation(base, createAnnotation("t1", "text", { text: "EG" }));
|
||||
const patched = patchAnnotation(l, "t1", { text: "1. OG" });
|
||||
expect(patched.annotations![0]).toMatchObject({ text: "1. OG" });
|
||||
it("Papier-mm ↔ Meter (1:1, y nach unten = −y), hin und zurück", () => {
|
||||
expect(sheetMmToModel(420, 297)).toEqual({ x: 0.42, y: -0.297 });
|
||||
expect(sheetModelToMm({ x: 0.42, y: -0.297 })).toEqual({ xMm: 420, yMm: 297 });
|
||||
expect(SHEET_SCALE_DENOMINATOR).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+28
-91
@@ -7,22 +7,22 @@
|
||||
//
|
||||
// Rechnung im Rust-Kern ([K4] S3, `src-tauri/core/src/layout_model.rs`, `folder_tree.rs`): Blattgrössen,
|
||||
// Ordner-Bäume (Aufbau, Blätter eines Ordners, Löschen, Nachfahren-Test), Seitenplanung des Ordner-PDF und
|
||||
// Titelblock. Hier bleiben Fabriken, einfache Listen-Änderungen (Viewports, Annotationen, Blatt verschieben)
|
||||
// Titelblock. Hier bleiben Fabriken, einfache Listen-Änderungen (Viewports, Blatt verschieben), die Blatt-Ebene
|
||||
// und Nachschlagen; die Baum-Fassaden setzen die Knoten aus den Indizes des Kerns mit den Original-Objekten
|
||||
// zusammen (Objekt-Identität bleibt).
|
||||
//
|
||||
// Bezeichner englisch, Kommentare deutsch (CONVENTIONS.md).
|
||||
|
||||
import type {
|
||||
DrawingLevel,
|
||||
Layout,
|
||||
LayoutAnnotation,
|
||||
LayoutAnnotationPatch,
|
||||
LayoutFolder,
|
||||
LayoutOrientation,
|
||||
LayoutPaperFormat,
|
||||
LayoutViewport,
|
||||
MasterLayout,
|
||||
Project,
|
||||
Vec2,
|
||||
ViewSnapshot,
|
||||
} from "./types";
|
||||
import { core } from "../engine/coreWasm";
|
||||
@@ -413,103 +413,40 @@ export function patchViewport(
|
||||
};
|
||||
}
|
||||
|
||||
// ── Fabrik + immutable CRUD (Annotationen auf einem Layout) ─────────────────
|
||||
// Analog zu Viewports: Linie/Rechteck/Text als vom Viewport-Baum unabhängige
|
||||
// Markup-Schicht in Papier-mm. `annotations ?? []` ist überall die Basis, damit
|
||||
// Alt-Layouts (ohne das Feld) unverändert bleiben (additiv).
|
||||
// ── Blatt-Ebene (2D-Zeichnung auf dem Blatt) ─────────────────────────────────
|
||||
// Was auf einem Blatt gezeichnet wird, sind gewöhnliche `drawings2d` auf der Blatt-Ebene des Layouts
|
||||
// (`DrawingLevel.layoutId`, Art "drawing"): dieselben Werkzeuge, Fang, Griffe, Auswahl und dasselbe
|
||||
// Rendering wie im Grundriss. Koordinaten = Papier 1:1 in Metern, Ursprung oben links, Papier-y nach
|
||||
// unten = −y (s. {@link sheetMmToModel}).
|
||||
|
||||
/**
|
||||
* Neue Annotation mit Default-Geometrie je Art (Linie/Rechteck: sichtbare
|
||||
* Mindestgrösse; Text: 3.5 mm Zeilenhöhe, wie im Attribute-Editor üblich).
|
||||
* `init` überschreibt einzelne Felder — der Aufrufer (Editor) übergibt i. d. R.
|
||||
* die vollständige, aus dem Zeichnen gewonnene Geometrie.
|
||||
*/
|
||||
export function createAnnotation(
|
||||
id: string,
|
||||
kind: LayoutAnnotation["kind"],
|
||||
init: LayoutAnnotationPatch = {},
|
||||
): LayoutAnnotation {
|
||||
const colorPatch = init.color !== undefined ? { color: init.color } : {};
|
||||
if (kind === "line") {
|
||||
return {
|
||||
id,
|
||||
kind: "line",
|
||||
x1Mm: init.x1Mm ?? 20,
|
||||
y1Mm: init.y1Mm ?? 20,
|
||||
x2Mm: init.x2Mm ?? 80,
|
||||
y2Mm: init.y2Mm ?? 20,
|
||||
...colorPatch,
|
||||
...(init.weightMm !== undefined ? { weightMm: init.weightMm } : {}),
|
||||
};
|
||||
}
|
||||
if (kind === "rect") {
|
||||
return {
|
||||
id,
|
||||
kind: "rect",
|
||||
xMm: init.xMm ?? 20,
|
||||
yMm: init.yMm ?? 20,
|
||||
widthMm: init.widthMm ?? 40,
|
||||
heightMm: init.heightMm ?? 30,
|
||||
...colorPatch,
|
||||
...(init.weightMm !== undefined ? { weightMm: init.weightMm } : {}),
|
||||
};
|
||||
}
|
||||
if (kind === "image") {
|
||||
return {
|
||||
id,
|
||||
kind: "image",
|
||||
xMm: init.xMm ?? 20,
|
||||
yMm: init.yMm ?? 20,
|
||||
widthMm: init.widthMm ?? 60,
|
||||
heightMm: init.heightMm ?? 40,
|
||||
src: init.src ?? "",
|
||||
...(init.opacity !== undefined ? { opacity: init.opacity } : {}),
|
||||
};
|
||||
}
|
||||
return {
|
||||
id,
|
||||
kind: "text",
|
||||
xMm: init.xMm ?? 20,
|
||||
yMm: init.yMm ?? 20,
|
||||
text: init.text ?? "",
|
||||
heightMm: init.heightMm ?? 3.5,
|
||||
...colorPatch,
|
||||
...(init.doc !== undefined ? { doc: init.doc } : {}),
|
||||
...(init.widthMm !== undefined ? { widthMm: init.widthMm } : {}),
|
||||
};
|
||||
/** Ist die Ebene die Blatt-Ebene eines Layouts (nicht im Navigator, nur bei offenem Blatt sichtbar)? */
|
||||
export function isSheetLevel(level: Pick<DrawingLevel, "layoutId"> | undefined | null): boolean {
|
||||
return !!level?.layoutId;
|
||||
}
|
||||
|
||||
/** Fügt eine Annotation an (immutabel). */
|
||||
export function addAnnotation(layout: Layout, annotation: LayoutAnnotation): Layout {
|
||||
return { ...layout, annotations: [...(layout.annotations ?? []), annotation] };
|
||||
/** Die Blatt-Ebene des Layouts `layoutId`, falls vorhanden. */
|
||||
export function sheetLevelOf(project: Project, layoutId: string): DrawingLevel | undefined {
|
||||
return project.drawingLevels.find((l) => l.layoutId === layoutId);
|
||||
}
|
||||
|
||||
/** Entfernt eine Annotation per Id (immutabel). */
|
||||
export function removeAnnotation(layout: Layout, annotationId: string): Layout {
|
||||
return {
|
||||
...layout,
|
||||
annotations: (layout.annotations ?? []).filter((a) => a.id !== annotationId),
|
||||
};
|
||||
/** Neue (leere) Blatt-Ebene für `layout`. */
|
||||
export function createSheetLevel(id: string, layout: Pick<Layout, "id" | "name">): DrawingLevel {
|
||||
return { id, name: layout.name, kind: "drawing", visible: true, locked: false, layoutId: layout.id };
|
||||
}
|
||||
|
||||
/**
|
||||
* Ändert Felder einer Annotation (immutabel). No-op, wenn die Id fehlt. Der
|
||||
* Patch ist bewusst art-unabhängig ({@link LayoutAnnotationPatch}) — es werden
|
||||
* nur die tatsächlich übergebenen Felder gemergt.
|
||||
*/
|
||||
export function patchAnnotation(
|
||||
layout: Layout,
|
||||
annotationId: string,
|
||||
patch: LayoutAnnotationPatch,
|
||||
): Layout {
|
||||
return {
|
||||
...layout,
|
||||
annotations: (layout.annotations ?? []).map((a) =>
|
||||
a.id === annotationId ? ({ ...a, ...patch } as LayoutAnnotation) : a,
|
||||
),
|
||||
};
|
||||
/** Papier-mm (x nach rechts, y nach unten) → Blatt-Ebene (Meter, y nach oben). */
|
||||
export function sheetMmToModel(xMm: number, yMm: number): Vec2 {
|
||||
return { x: xMm / 1000, y: -yMm / 1000 };
|
||||
}
|
||||
|
||||
/** Blatt-Ebene (Meter) → Papier-mm. */
|
||||
export function sheetModelToMm(p: Vec2): { xMm: number; yMm: number } {
|
||||
return { xMm: p.x * 1000, yMm: -p.y * 1000 };
|
||||
}
|
||||
|
||||
/** Massstab der Blatt-Ebene: Papier 1:1. */
|
||||
export const SHEET_SCALE_DENOMINATOR = 1;
|
||||
|
||||
// ── Auflösungen ──────────────────────────────────────────────────────────────
|
||||
|
||||
/** Findet einen Ausschnitt (View-Snapshot) im Projekt. */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Genutzt von der Modell-Rundreise und dem Robustheitstest des Kerns.
|
||||
|
||||
import { sampleProject } from "./sampleProject";
|
||||
import type { Drawing2DGeom, LayoutAnnotation, ParametricRule, Project, RichTextDoc } from "./types";
|
||||
import type { Drawing2DGeom, ParametricRule, Project, RichTextDoc } from "./types";
|
||||
|
||||
export const plain = (p: unknown): unknown => JSON.parse(JSON.stringify(p));
|
||||
|
||||
@@ -47,19 +47,14 @@ const rules: ParametricRule[] = [
|
||||
{ type: "sequence", rules: [{ type: "reference-line", referenceLine: "right", target: "exterior" }], stopOnMatch: true },
|
||||
];
|
||||
|
||||
const annotations: LayoutAnnotation[] = [
|
||||
{ kind: "line", id: "a1", x1Mm: 0, y1Mm: 0, x2Mm: 10, y2Mm: 10, color: "#000000", weightMm: 0.25 },
|
||||
{ kind: "rect", id: "a2", xMm: 1, yMm: 2, widthMm: 30, heightMm: 20 },
|
||||
{ kind: "text", id: "a3", xMm: 1, yMm: 2, text: "Titel", heightMm: 5, doc, widthMm: 40 },
|
||||
{ kind: "image", id: "a4", xMm: 1, yMm: 2, widthMm: 30, heightMm: 20, src: "data:image/png;base64,AAAA", opacity: 1 },
|
||||
];
|
||||
|
||||
/** Beispielprojekt, ergänzt um alle Element-Arten, die es selbst nicht enthält. */
|
||||
export function richProject(): Project {
|
||||
const lvl = sampleProject.drawingLevels[0].id;
|
||||
return {
|
||||
...sampleProject,
|
||||
formatVersion: 2,
|
||||
formatVersion: 3,
|
||||
// Blatt-Ebene des Layouts „lay1" (2D-Zeichnung auf dem Blatt).
|
||||
drawingLevels: [...sampleProject.drawingLevels, { id: "sheet-lay1", name: "Blatt 1", kind: "drawing", visible: true, locked: false, layoutId: "lay1" }],
|
||||
textStyles: [{ id: "ts1", label: "Titel", marks: { bold: true, font: "Helvetica", sizePt: 14 } }],
|
||||
blockDefs: [{ id: "blk1", name: "Nordpfeil", geom2d: geoms.slice(0, 4) }],
|
||||
pens: [{ id: "pen1", name: "Kontur" }],
|
||||
@@ -111,7 +106,7 @@ export function richProject(): Project {
|
||||
layerVisibility: { "10": true, "20": false }, drawingVisibility: { [lvl]: true }, enabledOverrideRuleIds: ["or1"], cameraCenter: { x: 1, y: 2 }, cameraPxPerMeter: 40,
|
||||
}],
|
||||
viewSnapshotFolders: [{ id: "vf1", name: "Pläne" }, { id: "vf2", name: "Unter", parentId: "vf1" }],
|
||||
layouts: [{ id: "lay1", name: "Blatt 1", paper: "a3", orientation: "landscape", planNumber: "A-12", masterId: "m1", folderId: "lf1", viewports: [{ id: "vp1", snapshotId: "vs1", xMm: 10, yMm: 10, widthMm: 200, heightMm: 150, scaleDenominator: 50 }], annotations }],
|
||||
layouts: [{ id: "lay1", name: "Blatt 1", paper: "a3", orientation: "landscape", planNumber: "A-12", masterId: "m1", folderId: "lf1", viewports: [{ id: "vp1", snapshotId: "vs1", xMm: 10, yMm: 10, widthMm: 200, heightMm: 150, scaleDenominator: 50 }] }],
|
||||
masterLayouts: [{ id: "m1", name: "Master", paper: "a3", orientation: "landscape", titleBlock: { projectName: "P", sheetName: "S", scale: "1:100", date: "28.10.", author: "K" }, border: true }],
|
||||
layoutFolders: [{ id: "lf1", name: "Pläne", kind: "layout" }],
|
||||
referenceElevationMasl: 432.1,
|
||||
|
||||
@@ -927,6 +927,14 @@ export type DrawingLevel = {
|
||||
* Fehlt ⇒ an; `false` ⇒ aus.
|
||||
*/
|
||||
levelMarks?: boolean;
|
||||
/**
|
||||
* Blatt-Ebene (nur kind "drawing"): gehört zum Layout mit dieser ID und trägt dessen
|
||||
* 2D-Zeichnung (Linien, Texte, Bilder …) als gewöhnliche `drawings2d`. Koordinaten = Papier
|
||||
* im Massstab 1:1 in Metern, Ursprung oben links am Blatt, Papier-y nach unten = −y
|
||||
* (Papier-mm (x, y) ↔ Modell (x/1000, −y/1000)). Nicht im Navigator; nur sichtbar, wenn das
|
||||
* Blatt offen ist. Fehlt ⇒ gewöhnliche Ebene.
|
||||
*/
|
||||
layoutId?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1275,65 +1283,13 @@ export type Layout = {
|
||||
customWidthMm?: number;
|
||||
/** Freie Blatthöhe in mm (siehe {@link Layout.customWidthMm}). */
|
||||
customHeightMm?: number;
|
||||
viewports: Array<LayoutViewport>;
|
||||
/**
|
||||
* 2D-Markups direkt auf dem Blatt (Linie/Rechteck/Text), siehe
|
||||
* {@link LayoutAnnotation}. Additiv — Alt-Layouts ohne dieses Feld laden
|
||||
* unverändert (Editor/CRUD behandeln ein fehlendes Array wie ein leeres).
|
||||
* Die 2D-Zeichnung auf dem Blatt liegt auf der Blatt-Ebene ({@link DrawingLevel.layoutId}),
|
||||
* nicht im Layout (bis Format 2: `annotations`, s. `project_format::migrate_layout_annotations`).
|
||||
*/
|
||||
annotations?: Array<LayoutAnnotation>;
|
||||
viewports: Array<LayoutViewport>;
|
||||
};
|
||||
|
||||
/** Layout-Beschriftung (Tag `kind`). */
|
||||
export type LayoutAnnotation =
|
||||
| {
|
||||
kind: "line";
|
||||
id: string;
|
||||
x1Mm: number;
|
||||
y1Mm: number;
|
||||
x2Mm: number;
|
||||
y2Mm: number;
|
||||
color?: string;
|
||||
weightMm?: number;
|
||||
}
|
||||
| {
|
||||
kind: "rect";
|
||||
id: string;
|
||||
xMm: number;
|
||||
yMm: number;
|
||||
widthMm: number;
|
||||
heightMm: number;
|
||||
color?: string;
|
||||
weightMm?: number;
|
||||
}
|
||||
| {
|
||||
kind: "text";
|
||||
id: string;
|
||||
xMm: number;
|
||||
yMm: number;
|
||||
text: string;
|
||||
heightMm: number;
|
||||
color?: string;
|
||||
/**
|
||||
* Reiches Textfeld (mehrere Absätze, gemischte Formatierung) — Vorrang vor
|
||||
* `text`, s. gleichnamiges Feld bei `Drawing2DGeom["text"]`.
|
||||
*/
|
||||
doc?: RichTextDoc;
|
||||
/** Optionale Rahmenbreite (mm) — bricht `doc` wortweise um; fehlt sie: einzeilig. */
|
||||
widthMm?: number;
|
||||
}
|
||||
| {
|
||||
kind: "image";
|
||||
id: string;
|
||||
xMm: number;
|
||||
yMm: number;
|
||||
widthMm: number;
|
||||
heightMm: number;
|
||||
/** Bildquelle als Data-URL (PNG/JPEG) — eingebettet, keine externe Datei. */
|
||||
src: string;
|
||||
opacity?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Ein Ordner im Layouts-Baum (DOSSIER A3). Layouts verweisen per `folderId` auf
|
||||
* ihren Ordner; `parentId` erlaubt Verschachtelung (Ordner in Ordner). Fehlt
|
||||
|
||||
@@ -26,7 +26,6 @@ import type {
|
||||
LineStyle,
|
||||
Opening,
|
||||
Project,
|
||||
RichTextDoc,
|
||||
Roof,
|
||||
SashDef,
|
||||
Vec2,
|
||||
@@ -84,29 +83,6 @@ export interface ImportedText {
|
||||
layer?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flaches Patch-Objekt für {@link LayoutAnnotation} — alle Felder ALLER Arten
|
||||
* optional (statt eines pro Art unterscheidenden Unions), damit CRUD/Handler
|
||||
* unabhängig von der konkreten `kind` bleiben (der Aufrufer setzt ohnehin nur
|
||||
* die zur gewählten Annotation passenden Felder).
|
||||
*/
|
||||
export type LayoutAnnotationPatch = Partial<{
|
||||
x1Mm: number;
|
||||
y1Mm: number;
|
||||
x2Mm: number;
|
||||
y2Mm: number;
|
||||
xMm: number;
|
||||
yMm: number;
|
||||
widthMm: number;
|
||||
heightMm: number;
|
||||
text: string;
|
||||
color: string;
|
||||
weightMm: number;
|
||||
doc: RichTextDoc;
|
||||
src: string;
|
||||
opacity: number;
|
||||
}>;
|
||||
|
||||
// ── Helfer ───────────────────────────────────────────────────────────────
|
||||
|
||||
export const getWallType = (project: Project, wall: Wall): WallType => {
|
||||
|
||||
Reference in new issue
Block a user