[110] Linientyp ohne Strichstärke: Stärke an Schraffur, Schichtfuge, Element; Migration Format 4

This commit is contained in:
Claude committed 2026-10-30 01:27:35 +00:00
1 parent ae52efae58
commit 765a93e562
27 files changed
+350 -153

No files matched your search

+4 -1
View File
@@ -1121,6 +1121,9 @@ export const de = {
"resources.col.component": "Bauteil",
"resources.col.thickness": "Dicke (mm)",
"resources.col.joint": "Fuge",
"resources.col.jointWeight": "Fugen-Strichstärke (mm, 0 = Standard)",
"resources.col.hatchLineWeight": "Strichstärke (mm)",
"resources.col.hatchLineWeight.hint": "Stärke der Musterlinien auf dem Papier; der Linienstil legt nur das Muster fest.",
"resources.joint.default": "— (Haarlinie)",
"resources.layer.add": "Schicht hinzufügen",
"resources.layer.remove": "Schicht entfernen",
@@ -1320,7 +1323,7 @@ export const de = {
"pattern.custom": "Eigenes Motiv",
// Linien.
"resources.lines.hint": "Strichstärke in Millimetern (Paper-Space). Strichmuster: durchgezogen, gestrichelt oder gepunktet.",
"resources.lines.hint": "Linientyp = Muster (durchgezogen, gestrichelt, gepunktet, Zickzack …) und Farbe. Die Strichstärke legt das Element, die Schraffur, die Schichtfuge oder die Ebene fest.",
"resources.lines.empty": "Noch keine Linienstile.",
"resources.lines.placeholder": "Linienstil",
"resources.col.weight": "Stärke (mm)",
+4 -1
View File
@@ -1115,6 +1115,9 @@ export const en: Record<TranslationKey, string> = {
"resources.col.component": "Component",
"resources.col.thickness": "Thickness (mm)",
"resources.col.joint": "Joint",
"resources.col.jointWeight": "Joint line weight (mm, 0 = default)",
"resources.col.hatchLineWeight": "Line weight (mm)",
"resources.col.hatchLineWeight.hint": "Weight of the pattern lines on paper; the line style only sets the pattern.",
"resources.joint.default": "— (hairline)",
"resources.layer.add": "Add layer",
"resources.layer.remove": "Remove layer",
@@ -1310,7 +1313,7 @@ export const en: Record<TranslationKey, string> = {
"pattern.crosshatch": "Crosshatch",
"pattern.custom": "Custom motif",
"resources.lines.hint": "Line weight in millimetres (paper space). Stroke: solid, dashed or dotted.",
"resources.lines.hint": "Line type = pattern (solid, dashed, dotted, zigzag …) and colour. The line weight is set by the element, the hatch, the layer joint or the layer.",
"resources.lines.empty": "No line styles yet.",
"resources.lines.placeholder": "Line style",
"resources.col.weight": "Weight (mm)",
+1 -1
View File
@@ -21,7 +21,7 @@ import { documentFor, sharedDocument } from "../core/document";
import type { LoadFileResult } from "../core/document";
/** Aktuelle Version des Dateiformats (muss `PROJECT_FORMAT_VERSION` im Kern entsprechen — Test). */
export const PROJECT_FORMAT_VERSION = 3;
export const PROJECT_FORMAT_VERSION = 4;
export type ParseProjectResult = LoadFileResult;
+1 -1
View File
@@ -52,7 +52,7 @@ export function richProject(): Project {
const lvl = sampleProject.drawingLevels[0].id;
return {
...sampleProject,
formatVersion: 3,
formatVersion: 4,
// 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 } }],
+16 -21
View File
@@ -26,18 +26,13 @@ export const sampleProject: Project = {
id: "demo",
name: "Demo-Haus",
// ── Ressourcen-Bibliotheken (zentral verwiesen per id) ──────────────────
// Linienstile: aufgeräumt auf kanonische VOLLLINIEN je Strichstärke (dash=null)
// + eine gestrichelte Linie. Früher gab es drei funktional identische 0.13-
// Volllinien ("thin"/"hatch-line"/"joint-massive") — zusammengeführt auf "thin"
// ("Volllinie 0.13"); Schraffur-/Schichtfugen-Referenzen zeigen jetzt darauf.
// (Die ids bleiben stabil, damit geladene Projekte + interne Referenzen halten.)
// Linienstile: nur Muster + Farbe ([110]) — die Strichstärke tragen Schraffur (`lineWeight`),
// Schichtfuge (`jointWeightMm`) bzw. Element/Ebene. Früher gab es „Volllinie 0.02/0.13/0.25/0.5";
// zusammengeführt auf „thin" (Volllinie). Die ids bleiben stabil.
lineStyles: [
{ id: "hatch-hair", name: "Volllinie 0.02", weight: 0.02, color: "#1a1a1a", dash: null },
{ id: "thin", name: "Volllinie 0.13", weight: 0.13, color: "#1a1a1a", dash: null },
{ id: "medium", name: "Volllinie 0.25", weight: 0.25, color: "#1a1a1a", dash: null },
{ id: "thick", name: "Volllinie 0.5", weight: 0.5, color: "#0a0a0a", dash: null },
// Gestrichelte Haarlinie für die Dämmung (Striche quer durch die Wanddicke).
{ id: "hatch-dash", name: "Dämmungsstrich", weight: 0.02, color: "#1a1a1a", dash: [0.35, 0.3] },
{ id: "thin", name: "Volllinie", color: "#1a1a1a", dash: null },
// Gestrichelte Linie (z. B. Dämmung, Striche quer durch die Wanddicke).
{ id: "hatch-dash", name: "Dämmungsstrich", color: "#1a1a1a", dash: [0.35, 0.3] },
],
// Schraffuren: color = Linien-/Vollfüllfarbe des Musters; angle in Grad.
// "none" = keine Schraffur (nur Component-Füllung).
@@ -52,7 +47,7 @@ export const sampleProject: Project = {
scale: 1,
angle: 0,
color: "#1a1a1a",
lineStyleId: "thin",
lineWeight: 0.13,
},
{
id: "diagonal",
@@ -61,7 +56,7 @@ export const sampleProject: Project = {
scale: 1,
angle: 45,
color: "#1a1a1a",
lineStyleId: "thin",
lineWeight: 0.13,
},
{
id: "crosshatch",
@@ -70,7 +65,7 @@ export const sampleProject: Project = {
scale: 1,
angle: 0,
color: "#1a1a1a",
lineStyleId: "thin",
lineWeight: 0.13,
},
{
id: "solid-concrete",
@@ -79,7 +74,7 @@ export const sampleProject: Project = {
scale: 1,
angle: 0,
color: "#9aa0a6",
lineStyleId: "thin",
lineWeight: 0.13,
},
// ── SIA-Schnittschraffuren (Haarlinie) ──────────────────────────────────
// Dichte Teilung (scale < 1; Muster-Kachel = 8·scale) für den SIA-Look.
@@ -91,7 +86,7 @@ export const sampleProject: Project = {
scale: 0.5,
angle: 45,
color: "#1a1a1a",
lineStyleId: "hatch-hair",
lineWeight: 0.02,
},
// Backstein: Diagonale, 45° RELATIV zur Wandachse (dreht mit der Wand mit).
{
@@ -102,7 +97,7 @@ export const sampleProject: Project = {
angle: 45,
relativeToWall: true,
color: "#1a1a1a",
lineStyleId: "hatch-hair",
lineWeight: 0.02,
},
// Dämmung: DURCHGEZOGENE (nicht gestrichelte) Linien QUER durch die Wanddicke
// (senkrecht zur Wandachse), wandbezogen. Basiswinkel 0 = Musterlinie steht
@@ -115,7 +110,7 @@ export const sampleProject: Project = {
angle: 0,
relativeToWall: true,
color: "#1a1a1a",
lineStyleId: "hatch-hair",
lineWeight: 0.02,
},
],
// Bauteil-Materialien: color = Poché-Füllung im Grundriss UND 3D-Diffusfarbe;
@@ -182,7 +177,7 @@ export const sampleProject: Project = {
layers: [
{ componentId: "render-ext", thickness: 0.02 },
// Innere Fuge der Dämmung trifft auf den Backstein (massiv↔massiv) → 0.13 mm.
{ componentId: "insulation", thickness: 0.16, jointLineStyleId: "thin" },
{ componentId: "insulation", thickness: 0.16, jointLineStyleId: "thin", jointWeightMm: 0.13 },
{ componentId: "brick", thickness: 0.15 },
{ componentId: "render-int", thickness: 0.015 },
],
@@ -209,7 +204,7 @@ export const sampleProject: Project = {
// Estrich (schwimmend) → Trittschalldämmung.
{ componentId: "screed", thickness: 0.06 },
// Innere Fuge der Dämmung trifft auf die Betondecke (massiv) → 0.13 mm.
{ componentId: "insulation", thickness: 0.04, jointLineStyleId: "thin" },
{ componentId: "insulation", thickness: 0.04, jointLineStyleId: "thin", jointWeightMm: 0.13 },
// Betondecke (Rohdecke, tragend) — innerste/unterste Schicht.
{ componentId: "concrete", thickness: 0.2 },
],
@@ -222,7 +217,7 @@ export const sampleProject: Project = {
// Aussen (Eindeckung) → innen (Verkleidung); Bauteile aus der Bibliothek.
layers: [
{ componentId: "roof-tiles", thickness: 0.04 }, // Eindeckung (Tonziegel)
{ componentId: "insulation", thickness: 0.22, jointLineStyleId: "thin" }, // Sparren/Dämmung
{ componentId: "insulation", thickness: 0.22, jointLineStyleId: "thin", jointWeightMm: 0.13 }, // Sparren/Dämmung
{ componentId: "render-int", thickness: 0.0125 }, // Innenverkleidung (GK)
],
},
+14 -13
View File
@@ -693,7 +693,7 @@ export type Drawing2D = {
fillColor?: string;
/**
* Optionale direkte Strichstärke-Übersteuerung in Millimetern; hat Vorrang
* vor dem LineStyle-Gewicht und der Kategorie-Strichstärke.
* vor der Kategorie-Strichstärke (Linienstile tragen keine Stärke, [110]).
*/
weightMm?: number;
/**
@@ -707,8 +707,8 @@ export type Drawing2D = {
backgroundSource?: AttributeSource;
/**
* Quelle der Strichstärke, wenn kein explizites `weightMm` gesetzt ist:
* "layer" erzwingt `LayerCategory.lw` (unter Umgehung des LineStyle-Gewichts),
* "object"/`undefined` (Default) = heutige Kette (LineStyle.weight ?? Kategorie).
* "layer" erzwingt `LayerCategory.lw`,
* "object"/`undefined` (Default) = Kategorie-Strichstärke.
*/
strokeWeightSource?: AttributeSource;
/**
@@ -1185,8 +1185,10 @@ export type HatchStyle = {
* Vollfüllfarbe, bei `pattern==="none"` ungenutzt.
*/
color: string;
/** Optionaler Linienstil für die Musterlinien (Line Manager). */
/** Optionaler Linienstil für die Musterlinien (Line Manager): nur Muster/Farbe. */
lineStyleId?: string;
/** Strichstärke der Musterlinien in Papier-mm ([110]); fehlt sie, gilt 0.13. */
lineWeight?: number;
/**
* Steuer-Parameter der Random-Vektor-Schraffur (`kind`/"vector" + `lines`===
* "random", z. B. Kies/Splitt). ALLE additiv & optional — fehlen sie, gilt das
@@ -1261,6 +1263,8 @@ export type Layer = {
* Fehlt das Feld, wird die Standard-Haarlinie (0.02 mm) gezeichnet.
*/
jointLineStyleId?: string;
/** Strichstärke der Schichtfuge in Papier-mm ([110]); fehlt sie, gilt die Standard-Fuge. */
jointWeightMm?: number;
};
/**
@@ -1401,16 +1405,13 @@ export type LineStyle = {
id: string;
name: string;
/**
* @deprecated Die Strichstärke gehört NICHT mehr in den Linienstil — es gibt nur
* „Vollinie/Strich", die tatsächliche Dicke wird per Element-Attribut (bzw.
* Ebene/Default) aufgelöst. Das Feld bleibt für die Backward-Compat-Auflösung
* erhalten und dient den Renderern noch als Fallback für die Muster-/Fugen-Stärke
* (siehe `resolveHatch` → `HatchRender.lineWeight`). Der Linien-Detail-Editor
* zeigt es nicht mehr an; neue Linienstile bekommen einen Haarlinien-Default.
* Die echte per-Element-Strichstärken-Auflösung (Attribut → Ebene → Default)
* folgt separat mit dem By-Layer/By-Object-Refactor — NICHT hier.
* @deprecated Nur noch für die Migration alter Dateien gelesen ([110], Format 4): Ein Linienstil
* legt nur das Muster (Volllinie, Strich, Punkt, Zickzack …) und die Farbe fest — die Strichstärke
* kommt vom Element (`Drawing2D.weightMm`), der Schraffur (`HatchStyle.lineWeight`), der
* Schichtfuge (`Layer.jointWeightMm`) bzw. Ebene/Stift. Die Migration trägt das alte Gewicht dort
* ein und entfernt es hier; die Renderer werten es nicht mehr aus.
*/
weight: number;
weight?: number;
/** Farbe (hex). */
color: string;
/**
+5 -5
View File
@@ -12,7 +12,7 @@ import { selectionHighlightLines, projectToWalls3d, projectToModel3d, pickGeomet
import { hexToRgb } from "./toWalls3d/shared";
import type { ToolDraft } from "../tools/types";
import { generatePlan } from "./generatePlan";
import { getHatch, getLineStyle } from "../model/types";
import { getHatch } from "../model/types";
import { roofGeometry, roofBaseElevation } from "../geometry/roof";
const RGB: [number, number, number] = [1, 0.5, 0.1];
@@ -1805,7 +1805,7 @@ describe("Schnitt-Schraffur-Orientierung: relativeToWall dreht bei Wand, nicht b
const h = getHatch(p, id);
return {
angle: h.relativeToWall && wallAngleDeg != null ? h.angle - wallAngleDeg : h.angle,
lineWeight: (h.lineStyleId ? getLineStyle(p, h.lineStyleId) : null)?.weight ?? 0.13,
lineWeight: h.lineWeight ?? 0.13,
};
};
// 2D-Referenz (verbindlich): splitWallLayers ruft resolveHatch(…, 90, …) (Wand
@@ -1844,9 +1844,9 @@ describe("Schnitt-Schraffur-Orientierung: relativeToWall dreht bei Wand, nicht b
expect(brick.hatch?.angle).toBeCloseTo(resolveHatch(sampleProject, "sia-brick", 90).angle, 6);
});
it("Musterlinien-Stärke kommt aus dem LineStyle des Hatch durch (2D-Parität)", () => {
// sia-insulation nutzt lineStyleId "hatch-hair" (0.02 mm). Der 3D-Hatch muss die
// resolveHatch-lineWeight (aus dem LineStyle) tragen — für Wand UND Decke gleich.
it("Musterlinien-Stärke kommt aus der Schraffur durch (2D-Parität)", () => {
// sia-insulation trägt lineWeight 0.02 mm ([110]). Der 3D-Hatch muss die
// resolveHatch-lineWeight (aus der Schraffur) tragen — für Wand UND Decke gleich.
const expected = resolveHatch(sampleProject, "sia-insulation", 90).lineWeight;
expect(wallInsul().hatch?.lineWeight).toBeCloseTo(expected, 6);
expect(slabInsul().hatch?.lineWeight).toBeCloseTo(expected, 6);
-1
View File
@@ -894,7 +894,6 @@ export function createProjectSlice(
const lineStyle: LineStyle = {
id: `line-${Date.now()}`,
name: t("default.lineStyleName"),
weight: 0.18,
color: "#2b3039",
dash: null,
};
+3 -3
View File
@@ -52,7 +52,7 @@ describe("Projekt laden ([K4] S4)", () => {
st().undo();
expect(st().project).toBe(next);
// Kern-Dokument = Leseansicht (Speichern aus dem Kern).
expect(JSON.parse(serializeProject(st().project))).toEqual({ ...next, formatVersion: 3 });
expect(JSON.parse(serializeProject(st().project))).toEqual({ ...next, formatVersion: 4 });
});
it("openProjectFile: Kern liest, migriert und lädt direkt; Verlauf leer; kaputte Datei ändert nichts", () => {
@@ -70,7 +70,7 @@ describe("Projekt laden ([K4] S4)", () => {
expect(r.ok && r.migratedFrom).toBe(1);
expect(st().undoDepth).toBe(0);
expect(st().redoDepth).toBe(0);
expect(st().project.formatVersion).toBe(3);
expect(st().project.formatVersion).toBe(4);
expect(st().project.openings?.some((o) => o.id === "TX" && o.kind === "door")).toBe(true);
expect("doors" in st().project).toBe(false);
// Danach normal weiterarbeiten: ein Schritt, Undo zurück auf den geladenen Stand.
@@ -78,6 +78,6 @@ describe("Projekt laden ([K4] S4)", () => {
st().setProject(opsMutation((p) => patchItem(p, "walls", p.walls[0].id, { height: 7 })));
st().undo();
expect(st().project).toEqual(loaded);
expect(serializeProject(st().project)).toBe(JSON.stringify({ formatVersion: 3, ...loaded }, null, 2));
expect(serializeProject(st().project)).toBe(JSON.stringify({ formatVersion: 4, ...loaded }, null, 2));
});
});
+2 -1
View File
@@ -471,7 +471,8 @@ export function LineSwatch({
width?: number;
height?: number;
}) {
const px = Math.max(1, Math.min(6, style.weight * 6));
// Linienstile tragen keine Stärke mehr ([110]): Vorschau mit einheitlicher Linie.
const px = 1.5;
const midY = height / 2;
const x0 = 4;
const x1 = width - 4;
+10 -2
View File
@@ -212,6 +212,14 @@ function HatchDetail({
options={lineOptions}
/>
</FieldRow>
<FieldRow label={t("resources.col.hatchLineWeight")} hint={t("resources.col.hatchLineWeight.hint")}>
<NumberField
value={hatch.lineWeight ?? 0.13}
onChange={(w) => onPatch({ lineWeight: Math.max(0.01, w) })}
step={0.01}
min={0.01}
/>
</FieldRow>
{lines === "random" && (
<>
<FieldRow label={t("resources.field.density")}>
@@ -327,8 +335,8 @@ function patToHatches(text: string): Omit<HatchStyle, "id">[] {
scale: 1,
angle: p.families[0]?.angle ?? 45,
color: "#1a1a1a",
// Kanonische Volllinie 0.13 (früher "hatch-line", zusammengeführt auf "thin").
lineStyleId: "thin",
// Volllinie (Muster); die Stärke trägt die Schraffur ([110]).
lineWeight: 0.13,
}));
}
@@ -166,6 +166,16 @@ function LayeredStyleDetail({
/>
)}
</FieldRow>
{!isInner && (
<FieldRow label={t("resources.col.jointWeight")}>
<NumberField
value={layer.jointWeightMm ?? 0}
onChange={(w) => patchLayer(i, { jointWeightMm: w > 0 ? w : undefined })}
step={0.01}
min={0}
/>
</FieldRow>
)}
</div>
<DeleteButton
onClick={() => removeLayer(i)}
+1 -9
View File
@@ -4,7 +4,6 @@
import { useState } from "react";
import type { LineStyle, Project } from "../../model/types";
import { PEN_WEIGHTS } from "../../model/types";
import { parseLin } from "../../io/linParser";
import { LineSwatch } from "../hatchPreview";
import { segmentsToDash, dashToSegments, presetOfDash, LINE_PRESETS, type LineSegment, type LineSegmentType, type LinePresetKey } from "../../core";
@@ -249,11 +248,10 @@ function LineStyleDetail({
);
}
/** .lin-Text → id-lose Linienstile (schwarze Haarlinie 0.18 als Default). */
/** .lin-Text → id-lose Linienstile (nur Muster; die Stärke trägt das Element, [110]). */
function linToStyles(text: string): Omit<LineStyle, "id">[] {
return parseLin(text).map((p) => ({
name: p.name,
weight: 0.18,
color: "#1a1a1a",
dash: p.dash,
}));
@@ -278,12 +276,6 @@ export function LinesTab({
return (
<div className="res-tab">
{/* Vorschlagswerte für die Strichstärke (Standard-Stiftbreiten in mm). */}
<datalist id="pen-weights">
{PEN_WEIGHTS.map((w) => (
<option key={w} value={w} />
))}
</datalist>
<div className="res-hint">{t("resources.lines.hint")}</div>
<div className="res-md">
<div className="res-md-list">