Merge branch 'worktree-agent-a89936bb3fbc2bbb1' into claude/practical-noether-1hb2s1
This commit is contained in:
17 files changed
+213
-26
No files matched your search
@@ -17,7 +17,7 @@ import { buildVariantenSampleProject } from "./sampleProjectVarianten";
|
||||
import { sampleProject } from "./sampleProject";
|
||||
import { generatePlan } from "../plan/generatePlan";
|
||||
import { computeKennzahlen } from "../analysis/kennzahlen";
|
||||
import { projectToModel3d, projectToModel3dParts } from "../plan/toWalls3d";
|
||||
import { classFilterText, ghostFilter3d, pickGeometry, projectToModel3d, projectToModel3dParts } from "../plan/toWalls3d";
|
||||
import { withDocument } from "../core/document";
|
||||
import type { Project } from "./types";
|
||||
|
||||
@@ -304,4 +304,32 @@ describe("[272] Varianten bearbeiten wie Archicad (Auge, Stift, grau, sperren)",
|
||||
expect(fills(designOptionEditArg(p, dach("b"), true))).toContain(DESIGN_OPTION_GHOST_FILL);
|
||||
expect(fills(designOptionEditArg(p, dach("b"), false))).not.toContain(DESIGN_OPTION_GHOST_FILL);
|
||||
});
|
||||
it("3D: Edit-Argument mit Geisterschicht und Sperre; Geisterschicht nur bei Stift mit Grau", () => {
|
||||
const p = buildVariantenSampleProject();
|
||||
expect(designOptionEditArg(p, dach("b"), true, { lock: false })).toEqual({ set: "dachform", option: "b", grey: true, layer: true });
|
||||
expect(designOptionEditArg(p, dach("b"), true, { lock: true })).toEqual({ set: "dachform", option: "b", grey: true, layer: true, lock: true });
|
||||
const g = designOptionEditArg(p, dach("b"), true, { lock: false })!;
|
||||
expect(ghostFilter3d({ designOptionEdit: g })?.ghost).toBe(true);
|
||||
expect(ghostFilter3d({ designOptionEdit: { ...g, grey: false } })).toBeNull();
|
||||
// Ohne `layer` (2D-Form) keine Schicht: das Grau bleibt Teilefarbe.
|
||||
expect(ghostFilter3d({ designOptionEdit: designOptionEditArg(p, dach("b"), true)! })).toBeNull();
|
||||
expect(JSON.parse(classFilterText({ designOptionEdit: g, ghost: true }))).toMatchObject({ ghost: true, designOptionEdit: { layer: true } });
|
||||
});
|
||||
|
||||
it("3D: Geisterschicht trägt die Elemente ausserhalb, das Hauptmodell nur die der Variante; Pick folgt Stift und Sperre", () => {
|
||||
const p = buildVariantenSampleProject();
|
||||
const g = designOptionEditArg(p, dach("b"), true, { lock: false })!;
|
||||
const wallIds = (h: Parameters<typeof projectToModel3d>[1]) => withDocument(p, () => projectToModel3d(p, h).walls.map((w) => w.wallId));
|
||||
const main = wallIds({ hide: { designOptionEdit: g } });
|
||||
const ghost = wallIds({ hide: { designOptionEdit: g, ghost: true } });
|
||||
expect(ghost.length).toBeGreaterThan(0);
|
||||
expect(main.filter((w) => ghost.includes(w))).toEqual([]);
|
||||
// Pick: ohne Sperre bleiben graue Elemente anwählbar, mit Sperre nicht.
|
||||
const pickWalls = (e: typeof g) => withDocument(p, () => pickGeometry(p, 0, { designOptionEdit: e }).walls.map((w) => w.wallId));
|
||||
const free = pickWalls(g);
|
||||
const locked = pickWalls({ ...g, lock: true });
|
||||
expect(free.some((w) => ghost.includes(w))).toBe(true);
|
||||
expect(locked.filter((w) => ghost.includes(w))).toEqual([]);
|
||||
expect(locked.length).toBeLessThan(free.length);
|
||||
});
|
||||
});
|
||||
@@ -441,18 +441,36 @@ export interface DesignOptionEditArg {
|
||||
option: string;
|
||||
/** Häkchen „Elemente ausserhalb der Variante grau einfärben“. */
|
||||
grey: boolean;
|
||||
/** 3D-Pick: „sperren“ — Elemente ausserhalb der Variante sind nicht anwählbar (Kern `design_options::Edit::locked`). */
|
||||
lock?: boolean;
|
||||
/** 3D-Fenster: das Grau kommt als durchscheinende Geisterschicht (render3d), nicht als helle Teilefarbe. */
|
||||
layer?: boolean;
|
||||
}
|
||||
|
||||
/** Füllfarbe des Graus ausserhalb der Bearbeitungsvariante (gleich wie `renovation::ghost_style` im Kern). */
|
||||
export const DESIGN_OPTION_GHOST_FILL = "#e3e3e3";
|
||||
/** Linien-/Randfarbe des Grau (Kern `renovation::ghost_style`): Räume, Möbel und andere 2D-Elemente ausserhalb. */
|
||||
export const DESIGN_OPTION_GHOST_LINE = "#a8a8a8";
|
||||
|
||||
function knownTarget(project: Project, t: DesignOptionTarget | null | undefined): t is DesignOptionTarget {
|
||||
return !!t && designOptionSets(project).some((s) => s.id === t.set && s.options.some((o) => o.id === t.option));
|
||||
}
|
||||
|
||||
/** Bearbeitungsvariante für Bildschirm-Anfragen; `null` ohne Stift oder bei unbekannter Variante. */
|
||||
export function designOptionEditArg(project: Project, draw: DesignOptionTarget | null | undefined, grey: boolean): DesignOptionEditArg | null {
|
||||
return knownTarget(project, draw) ? { set: draw.set, option: draw.option, grey } : null;
|
||||
export function designOptionEditArg(
|
||||
project: Project,
|
||||
draw: DesignOptionTarget | null | undefined,
|
||||
grey: boolean,
|
||||
/** Nur das 3D-Fenster: Sperre im Pick (`lock`) und Geisterschicht statt Teilefarbe (`layer`). */
|
||||
view3d?: { lock: boolean },
|
||||
): DesignOptionEditArg | null {
|
||||
if (!knownTarget(project, draw)) return null;
|
||||
const e: DesignOptionEditArg = { set: draw.set, option: draw.option, grey };
|
||||
if (view3d) {
|
||||
e.layer = true;
|
||||
if (view3d.lock) e.lock = true;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
/** Auge: die in der aktiven Ansicht sichtbare Variante des Satzes (der Stift geht vor, sonst die Kombination der Ebene). */
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
//
|
||||
// Satz „Dachform": A Flachdach (Hauptvariante, neues Dach RF2), B Satteldach (das Dach RF1 des Demo-Hauses).
|
||||
// Satz „Fassade": A Lochfenster (Nordfenster O2 des Demo-Hauses, Hauptvariante), B Bandfenster (O-band, 3.6 m breit).
|
||||
// Dazu ein Sofa (2D-Möbel) in Fassade A: bei Bearbeitung einer Dachform-Variante steht es ausserhalb (grau).
|
||||
// Alles Übrige gehört zum Hauptmodell. Ein eigenes Beispiel, damit die bestehenden Goldens unverändert bleiben.
|
||||
|
||||
import type { DesignOptionCombination, DesignOptionSet, Opening, Project, Roof } from "./types";
|
||||
@@ -36,6 +37,10 @@ export function buildVariantenSampleProject(): Project {
|
||||
name: "Beispiel Varianten",
|
||||
roofs,
|
||||
openings,
|
||||
drawings2d: [
|
||||
...(base.drawings2d ?? []),
|
||||
{ id: "M-sofa", type: "drawing2d", levelId: "eg", categoryCode: "22", geom: { shape: "libobj", libId: "lib:sofa-2", at: { x: 1.4, y: 1.0 }, rotation: 0 }, designOption: { set: "fassade", option: "a" } },
|
||||
],
|
||||
designOptionSets: structuredClone(VARIANTEN_SETS),
|
||||
designOptionCombinations: structuredClone(VARIANTEN_COMBINATIONS),
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user