[195b] Objekteinstellungen: Setzen für alle bei Referenzlinie, Öffnungs-Feldern und -Editor, Treppe, Raum, Stütze, Körper; gemischte Werte; Dach-Kanten/Gauben nur bei einem Dach
This commit is contained in:
16 files changed
+382
-114
No files matched your search
@@ -491,6 +491,8 @@ export interface PanelHostValue {
|
||||
onSetOpeningSashLine: (v: { color?: string; weight?: number } | undefined) => void;
|
||||
/** Übersteuert Farbe/Strichstärke der Auf-/Untersicht-Andeutung (Sims). */
|
||||
onSetOpeningSillLineStyle: (v: { color?: string; weight?: number } | undefined) => void;
|
||||
/** Öffnungs-Editor: Instanz-Felder der gewählten Öffnung(en) gleicher Art (Position nur das erste Element). */
|
||||
onPatchOpening: (patch: Partial<import("../model/types").Opening>) => void;
|
||||
/** Weist der Öffnung einen Tür-/Fenstertyp (Bibliothek) zu; "" löst die Zuweisung. */
|
||||
onSetOpeningType: (typeId: string) => void;
|
||||
/**
|
||||
|
||||
@@ -34,4 +34,19 @@ describe("Objekteinstellungen: Öffnung [195b]", () => {
|
||||
setState({ selection: { ...EMPTY_SELECTION, openings: [a.id] } });
|
||||
expect(render()).not.toContain('data-mixed="width"');
|
||||
});
|
||||
|
||||
it("zwei Treppen mit abweichender Breite: Treppen-Abschnitt mit „gemischt“; zwei Dächer ohne Gauben-/Kantenabschnitt", () => {
|
||||
const p = buildComplexSampleProject();
|
||||
const [a, b] = p.stairs!;
|
||||
getState().loadProject({ ...p, stairs: p.stairs!.map((x) => (x.id === a.id ? { ...x, width: 1 } : x.id === b.id ? { ...x, width: 1.3 } : x)) });
|
||||
setState({ selection: { ...EMPTY_SELECTION, stairs: [a.id, b.id] } });
|
||||
expect(render()).toContain('data-mixed="width"');
|
||||
const [r1, r2] = getState().project.roofs!;
|
||||
setState({ selection: { ...EMPTY_SELECTION, roofs: [r1.id] } });
|
||||
const single = render();
|
||||
setState({ selection: { ...EMPTY_SELECTION, roofs: [r1.id, r2.id] } });
|
||||
const multi = render();
|
||||
expect(multi).not.toContain("objinfo-dormer");
|
||||
expect(multi.length).toBeLessThan(single.length);
|
||||
});
|
||||
});
|
||||
@@ -45,15 +45,16 @@ type CatId =
|
||||
/** Abschnitt „Fenster-/Türeditor" der Objekt-Info: Projekt aus dem Store, Änderungen über die Host-Handler. */
|
||||
export function OpeningEditorSection({ openingId, host }: { openingId: string; host: ReturnType<typeof usePanelHost> }) {
|
||||
const project = useStore((st) => st.project);
|
||||
const updateOpening = useStore((st) => st.updateOpening);
|
||||
// [195b] Mehrfachauswahl: Instanz-Felder und Typ-Zuweisung gelten für alle gewählten Öffnungen gleicher Art
|
||||
// (Host-Handler, ein Undo-Schritt); Typ-Felder wirken ohnehin auf alle Öffnungen des Stils.
|
||||
return (
|
||||
<OpeningEditor
|
||||
openingId={openingId}
|
||||
project={project}
|
||||
onPatchWindowType={host.onPatchWindowType}
|
||||
onPatchDoorType={host.onPatchDoorType}
|
||||
onPatchOpening={(patch) => updateOpening(openingId, patch)}
|
||||
onSetOpeningType={(typeId) => updateOpening(openingId, { typeId: typeId || undefined })}
|
||||
onPatchOpening={host.onPatchOpening}
|
||||
onSetOpeningType={host.onSetOpeningType}
|
||||
onSaveAsStyle={(name) => host.onSaveOpeningStyle(openingId, name)}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -138,6 +138,7 @@ export function OpeningSection({
|
||||
min={1}
|
||||
onCommit={(v) => host.onSetOpeningWingCount(Math.max(1, Math.min(4, Math.round(v))))}
|
||||
/>
|
||||
<MixedMark on={multi?.wingCount.mixed} what="wingCount" />
|
||||
{/* Grundriss-Linien je Kategorie: Rahmen (Blendrahmen+Stulp), Fenster
|
||||
(Flügelrahmen/Sprossen), Sims (Auf-/Untersicht, nur wenn der
|
||||
Fenstertyp sie aktiviert hat — s. WindowType.sillLine). */}
|
||||
@@ -249,6 +250,7 @@ export function OpeningSection({
|
||||
title={t("objinfo.opening.hinge")}
|
||||
width={130}
|
||||
/>
|
||||
<MixedMark on={multi?.hinge.mixed} what="hinge" />
|
||||
</div>
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.opening.swing")}</span>
|
||||
@@ -262,6 +264,7 @@ export function OpeningSection({
|
||||
title={t("objinfo.opening.swing")}
|
||||
width={130}
|
||||
/>
|
||||
<MixedMark on={multi?.swing.mixed} what="swing" />
|
||||
</div>
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.opening.dir")}</span>
|
||||
@@ -275,6 +278,7 @@ export function OpeningSection({
|
||||
title={t("objinfo.opening.dir")}
|
||||
width={130}
|
||||
/>
|
||||
<MixedMark on={multi?.openingDir.mixed} what="openingDir" />
|
||||
</div>
|
||||
<DimensionField
|
||||
label={t("objinfo.opening.swingAngle")}
|
||||
|
||||
@@ -339,12 +339,14 @@ export function RoofSection({
|
||||
|
||||
{/* Kanten: Neigung je Kante (leer = Standard) und Giebel ([26]). Wirkt bei Sattel/Walm/
|
||||
Mansarde/Zelt; Flach und Pult ignorieren sie. */}
|
||||
{roof.shape !== "flach" && roof.shape !== "pult" && (
|
||||
{/* [195b] Kanten, Gauben und Innenhöfe gehören zu genau einem Dach (Indizes/Ids sind dachspezifisch): bei
|
||||
Mehrfachauswahl nicht angeboten (`multi`), die Host-Setter wirken dort ohnehin nur auf das erste Dach. */}
|
||||
{!multi && roof.shape !== "flach" && roof.shape !== "pult" && (
|
||||
<RoofEdgesSection roof={roof} host={host} />
|
||||
)}
|
||||
{/* Innenhöfe: Liste mit Entfernen, Hinzufügen über den Befehl „Dachhof“. */}
|
||||
<DormersSection roof={roof} host={host} />
|
||||
{roof.shape !== "pult" && (
|
||||
{!multi && <DormersSection roof={roof} host={host} />}
|
||||
{!multi && roof.shape !== "pult" && (
|
||||
<>
|
||||
<div className="objinfo-sep" />
|
||||
<div className="objinfo-section-label">{t("objinfo.roof.courts")}</div>
|
||||
|
||||
@@ -6,10 +6,13 @@ import { usePanelHost } from "../host";
|
||||
import { t } from "../../i18n";
|
||||
import { Dropdown } from "../../ui/Dropdown";
|
||||
import type { SiaCategory, Project, Room } from "../../model/types";
|
||||
import { SIA_CATEGORIES, siaLabelFull, patchItem, roomBook, ROOM_USAGES, usageLabel } from "../../core";
|
||||
import { SIA_CATEGORIES, siaLabelFull, patchItems, roomBook, ROOM_USAGES, usageLabel } from "../../core";
|
||||
import { formatM } from "../../model/types";
|
||||
import { useStore } from "../../state/appStore";
|
||||
import type { TranslationKey } from "../../i18n";
|
||||
import { selectionRoomValues } from "../../state/mixedValues";
|
||||
import { MixedMark } from "./fields";
|
||||
import { useMulti } from "./useMulti";
|
||||
|
||||
// ── Raum-Attribut-Abschnitt ──────────────────────────────────────────────────
|
||||
// Editierbarer Name, SIA-416-Kategorie (5 Blatt-Kategorien), abgeleitete Fläche
|
||||
@@ -24,6 +27,9 @@ export function RoomSection({
|
||||
roomId: string;
|
||||
host: ReturnType<typeof usePanelHost>;
|
||||
}) {
|
||||
// [195b] Mehrfachauswahl: SIA-Kategorie und Oberflächen gelten für alle gewählten Räume; der Name bleibt je Raum
|
||||
// eigen (Feld gesperrt).
|
||||
const multi = useMulti("rooms", selectionRoomValues);
|
||||
return (
|
||||
<>
|
||||
<div className="objinfo-sep" />
|
||||
@@ -36,6 +42,7 @@ export function RoomSection({
|
||||
type="text"
|
||||
className="objinfo-text"
|
||||
value={room.name}
|
||||
disabled={multi != null}
|
||||
onChange={(e) => host.onSetRoomName(e.target.value)}
|
||||
title={t("objinfo.room.name")}
|
||||
/>
|
||||
@@ -54,6 +61,7 @@ export function RoomSection({
|
||||
title={t("objinfo.room.sia")}
|
||||
width={170}
|
||||
/>
|
||||
<MixedMark on={multi?.siaCategory.mixed} what="sia" />
|
||||
</div>
|
||||
|
||||
{/* Fläche + Umfang (read-only, abgeleitet). */}
|
||||
@@ -96,14 +104,18 @@ type RoomFinishField = "floorFinish" | "wallFinish" | "ceilingFinish" | "floorBu
|
||||
function RoomFinishFields({ roomId }: { roomId: string }) {
|
||||
const storeProject = useStore((st) => st.project);
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
const selectedRooms = useStore((s) => s.selection.rooms);
|
||||
const project = storeProject;
|
||||
const room = (project.rooms ?? []).find((r) => r.id === roomId);
|
||||
if (!room) return null;
|
||||
const comps = project.components;
|
||||
const listId = `room-finish-materials-${roomId}`;
|
||||
const shown = (v: string | undefined) => comps.find((c) => c.id === v)?.name ?? v ?? "";
|
||||
const set = (field: RoomFinishField | "usage", value: string | undefined) =>
|
||||
applyChange((p: Project) => patchItem(p, "rooms", roomId, { [field]: value } as Partial<Room>), `room:${roomId}:${field}`);
|
||||
// [195b] Mehrfachauswahl: Nutzung und Oberflächen gelten für alle gewählten Räume (ein Undo-Schritt).
|
||||
const set = (field: RoomFinishField | "usage", value: string | undefined) => {
|
||||
const ids = selectedRooms.length > 1 && selectedRooms.includes(roomId) ? [...selectedRooms] : [roomId];
|
||||
applyChange((p: Project) => patchItems(p, "rooms", ids, (r) => ({ ...r, [field]: value }) as Room), `room:${roomId}:${field}`);
|
||||
};
|
||||
const setFinish = (field: RoomFinishField, text: string) => {
|
||||
const v = text.trim();
|
||||
if (!v) return set(field, undefined);
|
||||
|
||||
@@ -6,7 +6,9 @@ import type { ExtrudedSolidInfo, ColumnInfo, SolidProps } from "../../state/sele
|
||||
import { usePanelHost } from "../host";
|
||||
import { useStore } from "../../state/appStore";
|
||||
import { Dropdown } from "../../ui/Dropdown";
|
||||
import { DimensionField } from "./fields";
|
||||
import { selectionColumnValues, selectionSolidValues } from "../../state/mixedValues";
|
||||
import { DimensionField, MixedMark } from "./fields";
|
||||
import { useMulti } from "./useMulti";
|
||||
|
||||
/** Volumen/Oberfläche/Schwerpunkt aus dem Kern-Netz des Körpers (Manifold, dasselbe Netz wie im 3D). */
|
||||
function SolidPropsRows({ props }: { props: SolidProps | null }) {
|
||||
@@ -44,6 +46,8 @@ export function ExtrudedSolidSection({
|
||||
host: ReturnType<typeof usePanelHost>;
|
||||
}) {
|
||||
const components = useStore((st) => st.project.components);
|
||||
// [195b] Mehrfachauswahl: Höhe und die übrigen Setter gelten für alle gewählten Körper.
|
||||
const multi = useMulti("solids", selectionSolidValues);
|
||||
return (
|
||||
<>
|
||||
<div className="objinfo-sep" />
|
||||
@@ -64,6 +68,7 @@ export function ExtrudedSolidSection({
|
||||
}}
|
||||
title={t("objinfo.extrudedSolid.height")}
|
||||
/>
|
||||
<MixedMark on={multi?.height.mixed} what="height" />
|
||||
</div>
|
||||
|
||||
<SolidPropsRows props={solid.props} />
|
||||
@@ -205,6 +210,8 @@ export function ColumnSection({
|
||||
column: ColumnInfo;
|
||||
host: ReturnType<typeof usePanelHost>;
|
||||
}) {
|
||||
// [195b] Mehrfachauswahl: Profil, Masse, Höhe und Drehung gelten für alle gewählten Stützen.
|
||||
const multi = useMulti("columns", selectionColumnValues);
|
||||
return (
|
||||
<>
|
||||
<div className="objinfo-sep" />
|
||||
@@ -252,6 +259,7 @@ export function ColumnSection({
|
||||
value={column.height}
|
||||
onCommit={(v) => host.onSetColumnHeight(v)}
|
||||
/>
|
||||
<MixedMark on={multi?.height.mixed} what="height" />
|
||||
|
||||
{/* Drehung (Grad). */}
|
||||
<div className="objinfo-field">
|
||||
|
||||
@@ -8,7 +8,9 @@ import { t } from "../../i18n";
|
||||
import { Dropdown } from "../../ui/Dropdown";
|
||||
import type { StairShape } from "../../model/types";
|
||||
import { formatM } from "../../model/types";
|
||||
import { DimensionField } from "./fields";
|
||||
import { selectionStairValues } from "../../state/mixedValues";
|
||||
import { DimensionField, MixedMark } from "./fields";
|
||||
import { useMulti } from "./useMulti";
|
||||
|
||||
/**
|
||||
* [151] Läufe und Podest einer Podesttreppe (L, U, gerade mit Podest): Lauflängen, Steigungen im ersten
|
||||
@@ -135,6 +137,8 @@ export function StairSection({
|
||||
host: ReturnType<typeof usePanelHost>;
|
||||
}) {
|
||||
const storeProject = useStore((st) => st.project);
|
||||
// [195b] Mehrfachauswahl: abweichende Werte als „gemischt" kennzeichnen; Änderungen gelten für alle gewählten Treppen.
|
||||
const multi = useMulti("stairs", selectionStairValues);
|
||||
return (
|
||||
<>
|
||||
<div className="objinfo-sep" />
|
||||
@@ -156,6 +160,7 @@ export function StairSection({
|
||||
title={t("objinfo.stair.type")}
|
||||
width={130}
|
||||
/>
|
||||
<MixedMark on={multi?.typeId.mixed} what="stairType" />
|
||||
</div>
|
||||
|
||||
{/* Grundform-Dropdown. */}
|
||||
@@ -174,6 +179,7 @@ export function StairSection({
|
||||
title={t("objinfo.stair.shape")}
|
||||
width={130}
|
||||
/>
|
||||
<MixedMark on={multi?.shape.mixed} what="stairShape" />
|
||||
</div>
|
||||
|
||||
{/* Referenzpunkt der Laufbreite (links/mitte/rechts). */}
|
||||
@@ -240,6 +246,7 @@ export function StairSection({
|
||||
value={stair.width}
|
||||
onCommit={(v) => host.onSetStairWidth(v)}
|
||||
/>
|
||||
<MixedMark on={multi?.width.mixed} what="width" />
|
||||
{stair.shape === "spiral" && (
|
||||
<DimensionField
|
||||
label={t("objinfo.stair.column")}
|
||||
@@ -254,11 +261,13 @@ export function StairSection({
|
||||
value={stair.stepCount}
|
||||
onCommit={(v) => host.onSetStairSteps(v)}
|
||||
/>
|
||||
<MixedMark on={multi?.stepCount.mixed} what="stepCount" />
|
||||
<DimensionField
|
||||
label={t("objinfo.stair.rise")}
|
||||
value={stair.totalRise}
|
||||
onCommit={(v) => host.onSetStairRise(v)}
|
||||
/>
|
||||
<MixedMark on={multi?.totalRise.mixed} what="totalRise" />
|
||||
<DimensionField
|
||||
label={t("objinfo.stair.baseOffset")}
|
||||
value={stair.baseOffset ?? 0}
|
||||
|
||||
@@ -79,6 +79,7 @@ export function WallSection({
|
||||
title={t("objinfo.wall.refLine")}
|
||||
width={120}
|
||||
/>
|
||||
{mixedMark(multi?.referenceLine.mixed, "referenceLine")}
|
||||
</div>
|
||||
|
||||
{/* Terminierung am Deckenanschluss (Zuschnitt, NICHT Priorität): ob die Wand
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { Project } from "../../model/types";
|
||||
import { useStore } from "../../state/appStore";
|
||||
import type { Selection } from "../../state/selection";
|
||||
|
||||
export function useMulti<T>(kind: "walls" | "ceilings" | "roofs" | "openings", compute: (p: Project, sel: Selection) => T): T | null {
|
||||
export function useMulti<T>(kind: "walls" | "ceilings" | "roofs" | "openings" | "stairs" | "rooms" | "columns" | "solids", compute: (p: Project, sel: Selection) => T): T | null {
|
||||
const project = useStore((s) => s.project);
|
||||
const selection = useStore((s) => s.selection);
|
||||
// `compute` ist je Aufrufstelle eine Modul-Funktion (stabil).
|
||||
|
||||
Reference in new issue
Block a user