[195b] Objekteinstellungen: gemischte Werte und Setzen für alle bei Decke, Dach, Öffnung, Höhen; Öffnungs-Editor als Abschnitt statt Dialog

This commit is contained in:
Claude committed 2026-11-12 03:43:10 +00:00
1 parent c5118d66db
commit df950694ee
28 files changed
+479 -148

No files matched your search

+45 -1
View File
@@ -1,7 +1,7 @@
// [195] Mehrfach-Werte: gleiche Werte → ein Wert, abweichende → leer (gemischt).
import { describe, expect, it } from "vitest";
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
import { commonValue, selectionAppearance, selectionWallValues, selectedCount } from "./mixedValues";
import { commonValue, selectionAppearance, selectionWallValues, selectedCount, selectionCeilingValues, selectionOpeningValues, selectionRoofValues, selectionWallHeights } from "./mixedValues";
import { EMPTY_SELECTION, mergeSelection } from "./selection";
describe("commonValue [195]", () => {
@@ -60,3 +60,47 @@ describe("Mehrfachwerte Füllung/Typ/Masse [195b]", () => {
expect(selectionAppearance(changed, sel).hatch.mixed).toBe(true);
});
});
describe("Mehrfachwerte Decke, Dach, Öffnung, Höhen [195b]", () => {
const p = buildComplexSampleProject();
it("Decken: gleiche Werte → ein Wert, abweichende Oberkante → gemischt", () => {
const [a, b] = p.ceilings!.slice(0, 2).map((c) => c.id);
const same = selectionCeilingValues(p, mergeSelection(EMPTY_SELECTION, { ceilings: [a, a] }));
expect(same.thickness.mixed).toBe(false);
expect(same.top.mixed).toBe(false);
const q = {
...p,
ceilings: p.ceilings!.map((c) => (c.id === b ? { ...c, top: { mode: "custom" as const, z: 17.5 } } : c)),
};
const mixed = selectionCeilingValues(q, mergeSelection(EMPTY_SELECTION, { ceilings: [a, b] }));
expect(mixed.top).toEqual({ value: undefined, mixed: true });
});
it("Dächer: abweichende Neigung/Typ → gemischt", () => {
const [a, b] = p.roofs!.slice(0, 2).map((r) => r.id);
const q = { ...p, roofs: p.roofs!.map((r) => (r.id === a ? { ...r, pitchDeg: 20, roofTypeId: undefined } : r.id === b ? { ...r, pitchDeg: 35, roofTypeId: "x" } : r)) };
const v = selectionRoofValues(q, mergeSelection(EMPTY_SELECTION, { roofs: [a, b] }));
expect(v.pitchDeg.mixed).toBe(true);
expect(v.roofTypeId.mixed).toBe(true);
const one = selectionRoofValues(q, mergeSelection(EMPTY_SELECTION, { roofs: [a] }));
expect(one.pitchDeg).toEqual({ value: 20, mixed: false });
});
it("Öffnungen: abweichende Breite → gemischt, gleiche Höhe → Wert", () => {
const [a, b] = p.openings!.slice(0, 2).map((o) => o.id);
const q = { ...p, openings: p.openings!.map((o) => (o.id === a ? { ...o, width: 1, height: 2, sillHeight: 0.9 } : o.id === b ? { ...o, width: 1.5, height: 2, sillHeight: 0.9 } : o)) };
const v = selectionOpeningValues(q, mergeSelection(EMPTY_SELECTION, { openings: [a, b] }));
expect(v.width.mixed).toBe(true);
expect(v.height).toEqual({ value: 2, mixed: false });
expect(v.sillHeight).toEqual({ value: 0.9, mixed: false });
});
it("Wand-Höhen: abweichende Unterkante → gemischt", () => {
const [a, b] = p.walls.slice(0, 2).map((w) => w.id);
const q = { ...p, walls: p.walls.map((w) => (w.id === b ? { ...w, bottom: { mode: "custom" as const, z: 0.37 } } : w)) };
const v = selectionWallHeights(q, mergeSelection(EMPTY_SELECTION, { walls: [a, b] }));
expect(v.bottom.mixed).toBe(true);
});
});