[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:
28 files changed
+479
-148
No files matched your search
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -73,3 +73,91 @@ export function selectionWallValues(project: Project, sel: Selection): Selection
|
||||
}
|
||||
return { wallTypeId: commonValue(types), thickness: commonValue(thick) };
|
||||
}
|
||||
|
||||
/** Schlüssel einer Höhenangabe (Anker + aufgelöstes Z), damit gleiche Lagen als gleich gelten. */
|
||||
function heightKey(anchor: unknown, z: number): string {
|
||||
return `${JSON.stringify(anchor ?? null)}|${Math.round(z * 1e6)}`;
|
||||
}
|
||||
|
||||
/** [195b] Unter-/Oberkante der gewählten Wände. */
|
||||
export interface SelectionHeights {
|
||||
bottom: Common<string>;
|
||||
top: Common<string>;
|
||||
}
|
||||
|
||||
/** Wandtyp/Dicke und Höhen: eine Abfrage je Wand. */
|
||||
export function selectionWallHeights(project: Project, sel: Selection): SelectionHeights {
|
||||
const b: string[] = [];
|
||||
const t: string[] = [];
|
||||
for (const id of sel.walls.slice(0, MAX_COMPARED)) {
|
||||
const w = deriveSelection(project, { walls: [id] })?.wall;
|
||||
if (!w) continue;
|
||||
b.push(heightKey(w.bottom, w.zBottom));
|
||||
t.push(heightKey(w.top, w.zTop));
|
||||
}
|
||||
return { bottom: commonValue(b), top: commonValue(t) };
|
||||
}
|
||||
|
||||
/** [195b] Typ, Dicke und Höhen der gewählten Decken. */
|
||||
export interface SelectionCeilingValues extends SelectionHeights {
|
||||
typeId: Common<string>;
|
||||
thickness: Common<number>;
|
||||
}
|
||||
|
||||
export function selectionCeilingValues(project: Project, sel: Selection): SelectionCeilingValues {
|
||||
const types: string[] = [];
|
||||
const thick: number[] = [];
|
||||
const b: string[] = [];
|
||||
const t: string[] = [];
|
||||
for (const id of sel.ceilings.slice(0, MAX_COMPARED)) {
|
||||
const c = deriveSelection(project, { ceilings: [id] })?.ceiling;
|
||||
if (!c) continue;
|
||||
types.push(c.typeId);
|
||||
thick.push(c.thickness);
|
||||
b.push(heightKey(c.bottom, c.zBottom));
|
||||
t.push(heightKey(c.top, c.zTop));
|
||||
}
|
||||
return { typeId: commonValue(types), thickness: commonValue(thick), bottom: commonValue(b), top: commonValue(t) };
|
||||
}
|
||||
|
||||
/** [195b] Typ und Neigung der gewählten Dächer. */
|
||||
export interface SelectionRoofValues {
|
||||
roofTypeId: Common<string>;
|
||||
pitchDeg: Common<number>;
|
||||
}
|
||||
|
||||
export function selectionRoofValues(project: Project, sel: Selection): SelectionRoofValues {
|
||||
const types: string[] = [];
|
||||
const pitch: number[] = [];
|
||||
for (const id of sel.roofs.slice(0, MAX_COMPARED)) {
|
||||
const r = deriveSelection(project, { roofs: [id] })?.roof;
|
||||
if (!r) continue;
|
||||
types.push(r.roofTypeId ?? "");
|
||||
pitch.push(r.pitchDeg);
|
||||
}
|
||||
return { roofTypeId: commonValue(types), pitchDeg: commonValue(pitch) };
|
||||
}
|
||||
|
||||
/** [195b] Breite, Höhe, Brüstung und Typ der gewählten Öffnungen. */
|
||||
export interface SelectionOpeningValues {
|
||||
width: Common<number>;
|
||||
height: Common<number>;
|
||||
sillHeight: Common<number>;
|
||||
typeId: Common<string>;
|
||||
}
|
||||
|
||||
export function selectionOpeningValues(project: Project, sel: Selection): SelectionOpeningValues {
|
||||
const w: number[] = [];
|
||||
const h: number[] = [];
|
||||
const s: number[] = [];
|
||||
const ty: string[] = [];
|
||||
for (const id of sel.openings.slice(0, MAX_COMPARED)) {
|
||||
const o = deriveSelection(project, { openings: [id] })?.opening;
|
||||
if (!o) continue;
|
||||
w.push(o.width);
|
||||
h.push(o.height);
|
||||
s.push(o.sillHeight);
|
||||
ty.push(o.typeId ?? "");
|
||||
}
|
||||
return { width: commonValue(w), height: commonValue(h), sillHeight: commonValue(s), typeId: commonValue(ty) };
|
||||
}
|
||||
@@ -26,3 +26,78 @@ describe("onSetWallType [195b]", () => {
|
||||
expect(getState().undoDepth).toBe(depth + 1);
|
||||
});
|
||||
});
|
||||
|
||||
type Host = Record<string, (...a: never[]) => void>;
|
||||
function hostFor(kind: string, id: string): Host {
|
||||
const s = getState();
|
||||
return buildElementAttributesHost({
|
||||
applyChange: s.applyChange,
|
||||
updateWall: s.updateWall,
|
||||
updateCeiling: s.updateCeiling,
|
||||
updateOpening: s.updateOpening,
|
||||
updateRoof: s.updateRoof,
|
||||
setWallThickness: s.setWallThickness,
|
||||
setCeilingThickness: s.setCeilingThickness,
|
||||
selection: { kind, id },
|
||||
} as unknown as FlatHostOpts) as unknown as Host;
|
||||
}
|
||||
|
||||
describe("Mehrfachauswahl setzt alle gewählten Elemente in einem Schritt [195b]", () => {
|
||||
it("Öffnungen: Breite und Brüstung gelten für alle, je ein Undo-Schritt", () => {
|
||||
getState().loadProject(buildComplexSampleProject());
|
||||
const [a, b] = getState().project.openings!;
|
||||
setState({ selection: { ...EMPTY_SELECTION, openings: [a.id, b.id] } });
|
||||
const host = hostFor("opening", a.id);
|
||||
const depth = getState().undoDepth;
|
||||
(host.onSetOpeningWidth as (w: number) => void)(1.234);
|
||||
const os = getState().project.openings!;
|
||||
expect(os.find((o) => o.id === a.id)!.width).toBe(1.234);
|
||||
expect(os.find((o) => o.id === b.id)!.width).toBe(1.234);
|
||||
expect(getState().undoDepth).toBe(depth + 1);
|
||||
(host.onSetOpeningSill as (w: number) => void)(0.77);
|
||||
expect(getState().project.openings!.find((o) => o.id === b.id)!.sillHeight).toBe(0.77);
|
||||
expect(getState().undoDepth).toBe(depth + 2);
|
||||
});
|
||||
|
||||
it("Decken: Oberkante und Dicke für alle, je ein Undo-Schritt", () => {
|
||||
getState().loadProject(buildComplexSampleProject());
|
||||
const [a, b] = getState().project.ceilings!;
|
||||
setState({ selection: { ...EMPTY_SELECTION, ceilings: [a.id, b.id] } });
|
||||
const host = hostFor("ceiling", a.id);
|
||||
let depth = getState().undoDepth;
|
||||
(host.onSetCeilingTop as (x: unknown) => void)({ mode: "custom", z: 9.5 });
|
||||
const cs = getState().project.ceilings!;
|
||||
expect(cs.find((c) => c.id === b.id)!.top).toEqual({ mode: "custom", z: 9.5 });
|
||||
expect(getState().undoDepth).toBe(depth + 1);
|
||||
depth = getState().undoDepth;
|
||||
(host.onSetCeilingThickness as (x: number) => void)(0.31);
|
||||
expect(getState().undoDepth).toBe(depth + 1);
|
||||
getState().undo();
|
||||
expect(getState().undoDepth).toBe(depth);
|
||||
});
|
||||
|
||||
it("Dächer: Neigung für alle; andere Felder nur für das erste", () => {
|
||||
getState().loadProject(buildComplexSampleProject());
|
||||
const [a, b] = getState().project.roofs!;
|
||||
setState({ selection: { ...EMPTY_SELECTION, roofs: [a.id, b.id] } });
|
||||
const host = hostFor("roof", a.id);
|
||||
(host.onSetRoofPatch as (p: object) => void)({ pitchDeg: 33 });
|
||||
expect(getState().project.roofs!.find((r) => r.id === b.id)!.pitchDeg).toBe(33);
|
||||
(host.onSetRoofPatch as (p: object) => void)({ overhang: 0.77 });
|
||||
const r2 = getState().project.roofs!;
|
||||
expect(r2.find((r) => r.id === a.id)!.overhang).toBe(0.77);
|
||||
expect(r2.find((r) => r.id === b.id)!.overhang).not.toBe(0.77);
|
||||
});
|
||||
|
||||
it("Wände: Unterkante und Dicke für alle", () => {
|
||||
getState().loadProject(buildComplexSampleProject());
|
||||
const [a, b] = getState().project.walls;
|
||||
setState({ selection: { ...EMPTY_SELECTION, walls: [a.id, b.id] } });
|
||||
const host = hostFor("wall", a.id);
|
||||
(host.onSetWallBottom as (x: unknown) => void)({ mode: "custom", z: 0.2 });
|
||||
expect(getState().project.walls.find((w) => w.id === b.id)!.bottom).toEqual({ mode: "custom", z: 0.2 });
|
||||
const depth = getState().undoDepth;
|
||||
(host.onSetWallThickness as (x: number) => void)(0.29);
|
||||
expect(getState().undoDepth).toBe(depth + 1);
|
||||
});
|
||||
});
|
||||
@@ -7,8 +7,31 @@ import { patchItem, patchItems, removeRoofHole, setRoofEdge } from "../../core";
|
||||
import { getState } from "../appStore";
|
||||
import type { FlatHostOpts, HostPart } from "./types";
|
||||
|
||||
type MultiCollection = "walls" | "ceilings" | "roofs" | "openings";
|
||||
|
||||
/**
|
||||
* [195b] Ziele einer Änderung: bei Mehrfachauswahl gleicher Art alle gewählten Elemente (in einem Undo-Schritt
|
||||
* zu setzen), sonst nur das Objekt der Objekt-Info.
|
||||
*/
|
||||
function targetIds(collection: MultiCollection, id: string): string[] {
|
||||
const ids = getState().selection[collection];
|
||||
return ids.length > 1 && ids.includes(id) ? [...ids] : [id];
|
||||
}
|
||||
|
||||
/** Dach-Felder, die bei Mehrfachauswahl für alle gewählten Dächer gelten (Rest: nur das erste). */
|
||||
const ROOF_MULTI_KEYS: ReadonlySet<string> = new Set(["roofTypeId", "pitchDeg"]);
|
||||
|
||||
export function buildElementAttributesHost(c: FlatHostOpts) {
|
||||
const { applyChange, onOpenStampEditor, onToggleSection3dCut, openResources, patchLevel, project, section3dCutId, sectionLine, selection, setCeilingThickness, setOpeningEditorId, setWallThickness, slideOpening, updateCeiling, updateOpening, updateRoof, updateRoom, updateStair, updateWall } = c;
|
||||
const { applyChange, onOpenStampEditor, onToggleSection3dCut, openResources, patchLevel, project, section3dCutId, sectionLine, selection, patchDoorType, patchWindowType, saveOpeningStyle, setCeilingThickness, setWallThickness, slideOpening, updateCeiling, updateOpening, updateRoof, updateRoom, updateStair, updateWall } = c;
|
||||
/** Patch auf alle Ziele (s. {@link targetIds}); ein Element: wie bisher über die Einzel-Aktion. */
|
||||
function patchAll<K extends MultiCollection>(collection: K, id: string, patch: Record<string, unknown>, coalesceKey?: string): void {
|
||||
const ids = targetIds(collection, id);
|
||||
if (ids.length > 1) applyChange((p) => patchItems(p, collection, ids, (e) => ({ ...(e as object), ...patch }) as typeof e), coalesceKey);
|
||||
else if (collection === "walls") updateWall(id, patch, coalesceKey);
|
||||
else if (collection === "ceilings") updateCeiling(id, patch);
|
||||
else if (collection === "roofs") updateRoof(id, patch, coalesceKey);
|
||||
else updateOpening(id, patch);
|
||||
}
|
||||
return {
|
||||
// ── Wand-Attribute (nur bei selektierter Wand) ─────────────────────────
|
||||
onSetWallReferenceLine: (ref) => {
|
||||
@@ -47,32 +70,30 @@ export function buildElementAttributesHost(c: FlatHostOpts) {
|
||||
if (selection?.kind === "ceiling") updateCeiling(selection.id, { edgeAtOutline: edgeAtOutline || undefined });
|
||||
},
|
||||
onSetWallType: (wallTypeId) => {
|
||||
if (selection?.kind !== "wall") return;
|
||||
// [195b] Mehrfachauswahl: alle gewählten Wände bekommen den Typ (ein Undo-Schritt).
|
||||
const ids = getState().selection.walls;
|
||||
if (ids.length > 1) applyChange((p) => patchItems(p, "walls", ids, (w) => ({ ...w, wallTypeId })));
|
||||
else updateWall(selection.id, { wallTypeId });
|
||||
if (selection?.kind === "wall") patchAll("walls", selection.id, { wallTypeId });
|
||||
},
|
||||
onSetWallThickness: (thickness) => {
|
||||
if (selection?.kind === "wall")
|
||||
setWallThickness(selection.id, thickness);
|
||||
if (selection?.kind !== "wall") return;
|
||||
const ids = targetIds("walls", selection.id);
|
||||
if (ids.length === 1) setWallThickness(selection.id, thickness);
|
||||
else getState().groupChanges(() => ids.forEach((id) => setWallThickness(id, thickness)));
|
||||
},
|
||||
onSetWallBottom: (anchor) => {
|
||||
if (selection?.kind === "wall")
|
||||
updateWall(selection.id, { bottom: anchor ?? undefined });
|
||||
if (selection?.kind === "wall") patchAll("walls", selection.id, { bottom: anchor ?? undefined });
|
||||
},
|
||||
onSetWallTop: (anchor) => {
|
||||
if (selection?.kind === "wall")
|
||||
updateWall(selection.id, { top: anchor ?? undefined });
|
||||
if (selection?.kind === "wall") patchAll("walls", selection.id, { top: anchor ?? undefined });
|
||||
},
|
||||
// ── Decken-Attribute (nur bei selektierter Decke) ──────────────────────
|
||||
onSetCeilingType: (ceilingTypeId) => {
|
||||
if (selection?.kind === "ceiling")
|
||||
updateCeiling(selection.id, { ceilingTypeId, thickness: undefined });
|
||||
if (selection?.kind === "ceiling") patchAll("ceilings", selection.id, { ceilingTypeId, thickness: undefined });
|
||||
},
|
||||
onSetCeilingThickness: (thickness) => {
|
||||
if (selection?.kind === "ceiling")
|
||||
setCeilingThickness(selection.id, thickness);
|
||||
if (selection?.kind !== "ceiling") return;
|
||||
const ids = targetIds("ceilings", selection.id);
|
||||
if (ids.length === 1) setCeilingThickness(selection.id, thickness);
|
||||
else getState().groupChanges(() => ids.forEach((id) => setCeilingThickness(id, thickness)));
|
||||
},
|
||||
onRemoveCeilingOpening: (index) => {
|
||||
if (selection?.kind !== "ceiling") return;
|
||||
@@ -83,12 +104,10 @@ export function buildElementAttributesHost(c: FlatHostOpts) {
|
||||
});
|
||||
},
|
||||
onSetCeilingTop: (anchor) => {
|
||||
if (selection?.kind === "ceiling")
|
||||
updateCeiling(selection.id, { top: anchor ?? undefined });
|
||||
if (selection?.kind === "ceiling") patchAll("ceilings", selection.id, { top: anchor ?? undefined });
|
||||
},
|
||||
onSetCeilingBottom: (anchor) => {
|
||||
if (selection?.kind === "ceiling")
|
||||
updateCeiling(selection.id, { bottom: anchor ?? undefined });
|
||||
if (selection?.kind === "ceiling") patchAll("ceilings", selection.id, { bottom: anchor ?? undefined });
|
||||
},
|
||||
// ── Öffnungs-Attribute (nur bei selektierter Öffnung) ──────────────────
|
||||
onSetOpeningKind: (kind) => {
|
||||
@@ -101,16 +120,13 @@ export function buildElementAttributesHost(c: FlatHostOpts) {
|
||||
);
|
||||
},
|
||||
onSetOpeningWidth: (width) => {
|
||||
if (selection?.kind === "opening" && width > 0)
|
||||
updateOpening(selection.id, { width });
|
||||
if (selection?.kind === "opening" && width > 0) patchAll("openings", selection.id, { width });
|
||||
},
|
||||
onSetOpeningHeight: (height) => {
|
||||
if (selection?.kind === "opening" && height > 0)
|
||||
updateOpening(selection.id, { height });
|
||||
if (selection?.kind === "opening" && height > 0) patchAll("openings", selection.id, { height });
|
||||
},
|
||||
onSetOpeningSill: (sillHeight) => {
|
||||
if (selection?.kind === "opening" && sillHeight >= 0)
|
||||
updateOpening(selection.id, { sillHeight });
|
||||
if (selection?.kind === "opening" && sillHeight >= 0) patchAll("openings", selection.id, { sillHeight });
|
||||
},
|
||||
onSetOpeningPosition: (position) => {
|
||||
if (selection?.kind !== "opening" || !Number.isFinite(position)) return;
|
||||
@@ -166,16 +182,20 @@ export function buildElementAttributesHost(c: FlatHostOpts) {
|
||||
// Typ-Zuweisung (Bibliothek): Tür-/Fenstertyp per typeId; leerer String löst
|
||||
// die Zuweisung wieder (Inline-Verhalten).
|
||||
onSetOpeningType: (typeId) => {
|
||||
if (selection?.kind === "opening")
|
||||
updateOpening(selection.id, { typeId: typeId || undefined });
|
||||
if (selection?.kind === "opening") patchAll("openings", selection.id, { typeId: typeId || undefined });
|
||||
},
|
||||
onEditOpeningType: (kind) => {
|
||||
openResources(kind === "door" ? "doorStyles" : "windowStyles");
|
||||
},
|
||||
onOpenOpeningEditor: (id) => setOpeningEditorId(id),
|
||||
onPatchWindowType: patchWindowType,
|
||||
onPatchDoorType: patchDoorType,
|
||||
onSaveOpeningStyle: saveOpeningStyle,
|
||||
// ── Dach-Attribute (nur bei selektiertem Dach) ─────────────────────────
|
||||
onSetRoofPatch: (patch, coalesceKey) => {
|
||||
if (selection?.kind === "roof") updateRoof(selection.id, patch, coalesceKey);
|
||||
if (selection?.kind !== "roof") return;
|
||||
const multi = Object.keys(patch).every((k) => ROOF_MULTI_KEYS.has(k));
|
||||
if (multi) patchAll("roofs", selection.id, patch, coalesceKey);
|
||||
else updateRoof(selection.id, patch, coalesceKey);
|
||||
},
|
||||
onSetRoofEdge: (index, spec) => {
|
||||
if (selection?.kind !== "roof") return;
|
||||
|
||||
@@ -106,6 +106,9 @@ export type PanelHostOpts = {
|
||||
| "updateWall"
|
||||
| "setWallThickness"
|
||||
| "updateOpening"
|
||||
| "patchWindowType"
|
||||
| "patchDoorType"
|
||||
| "saveOpeningStyle"
|
||||
| "slideOpening"
|
||||
| "updateCeiling"
|
||||
| "setCeilingThickness"
|
||||
@@ -137,7 +140,7 @@ export type PanelHostOpts = {
|
||||
| "selectedViewSnapshotId"
|
||||
| "setSelectedViewSnapshotId"
|
||||
>;
|
||||
dialogState: Pick<ReturnType<typeof useDialogState>, "setActiveLayoutId" | "setOpeningEditorId">;
|
||||
dialogState: Pick<ReturnType<typeof useDialogState>, "setActiveLayoutId">;
|
||||
contextMenuState: Pick<ReturnType<typeof useContextMenuState>, "setMenu">;
|
||||
};
|
||||
|
||||
|
||||
@@ -1281,7 +1281,7 @@ export function createProjectSlice(
|
||||
op: "wallThickness",
|
||||
id: wallId,
|
||||
thickness,
|
||||
newId: `wt-${Date.now()}`,
|
||||
newId: uniqueId("wt"),
|
||||
newName: t("default.wallTypeSingle", { thickness: thickness.toFixed(2) }),
|
||||
}),
|
||||
|
||||
@@ -1337,7 +1337,7 @@ export function createProjectSlice(
|
||||
op: "ceilingThickness",
|
||||
id: ceilingId,
|
||||
thickness,
|
||||
newId: `ct-${Date.now()}`,
|
||||
newId: uniqueId("ct"),
|
||||
newName: t("default.ceilingTypeSingle", { thickness: thickness.toFixed(2) }),
|
||||
}),
|
||||
|
||||
@@ -1350,7 +1350,7 @@ export function createProjectSlice(
|
||||
b: from, // Griffhöhe vor dem Zug: Dach, Treppe, Gelände zählen den Zug relativ
|
||||
index, // Höhenlinie `contourLine`
|
||||
free: !!free,
|
||||
newId: `ct-${Date.now()}`,
|
||||
newId: uniqueId("ct"),
|
||||
newName: t("default.ceilingTypeSingle", { thickness: "{t}" }), // {t} setzt der Kern ein
|
||||
}),
|
||||
|
||||
|
||||
@@ -605,13 +605,16 @@ export function deriveSelection(project: Project, selection: Partial<Selection>)
|
||||
const args = {
|
||||
wallIds: sel.walls,
|
||||
drawingId: single(sel, "drawings"),
|
||||
ceilingId: single(sel, "ceilings"),
|
||||
openingId: single(sel, "openings"),
|
||||
// [195b] Decken, Öffnungen und Dächer: bei Mehrfachauswahl führt das erste Element die Anzeige; die
|
||||
// Setter des Panel-Hosts (`elementAttributesHost`) wirken auf alle gewählten, die Abschnitte kennzeichnen
|
||||
// abweichende Werte („gemischt", `mixedValues.ts`).
|
||||
ceilingId: sel.ceilings[0] ?? null,
|
||||
openingId: sel.openings[0] ?? null,
|
||||
stairId: single(sel, "stairs"),
|
||||
roomId: single(sel, "rooms"),
|
||||
extrudedSolidId: single(sel, "solids"),
|
||||
columnId: single(sel, "columns"),
|
||||
roofId: single(sel, "roofs"),
|
||||
roofId: sel.roofs[0] ?? null,
|
||||
contextObjectId: single(sel, "contextObjects"),
|
||||
};
|
||||
// Das Element sucht der Kern über den Positions-Index des Dokuments (keine lineare Suche).
|
||||
|
||||
@@ -22,9 +22,6 @@ export function useDialogState() {
|
||||
// Angeforderter Start-Tab des Ressourcen-Fensters (z. B. „doorStyles", wenn man
|
||||
// von einer gewählten Tür in den Typeditor springt).
|
||||
const [resourcesTab, setResourcesTab] = useState<ResourceTabId>("components");
|
||||
// Offener Fenster-/Tür-Einstellungsdialog (⚙ der OpeningSection) — ID der
|
||||
// editierten Öffnung, oder null wenn geschlossen.
|
||||
const [openingEditorId, setOpeningEditorId] = useState<string | null>(null);
|
||||
|
||||
// Aktives Layout-Blatt im HAUPT-Viewport (DOSSIER A3, Phase 2b): Id des offenen
|
||||
// Layouts oder null (= normale Modell-Ansicht). Transienter UI-State; das
|
||||
@@ -65,8 +62,6 @@ export function useDialogState() {
|
||||
setResourcesOpen,
|
||||
resourcesTab,
|
||||
setResourcesTab,
|
||||
openingEditorId,
|
||||
setOpeningEditorId,
|
||||
activeLayoutId,
|
||||
setActiveLayoutId,
|
||||
importState,
|
||||
|
||||
Reference in new issue
Block a user