Merge branch 'worktree-agent-a1b4a8f6cf930e03d' into claude/practical-noether-1hb2s1

This commit is contained in:
Claude committed 2026-11-12 03:58:20 +00:00
commit 3e5fa10757
28 files changed
+479 -148

No files matched your search

+1 -1
View File
@@ -90,7 +90,7 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `*
- ◐ **[198]** T-Stoss: gleiche Schichten verschmelzen (12.11.). Ursache: jede Wand zeichnete ihre Umriss-/Fugenlinie einzeln, am T-Stoss blieb ein Stück Wandumriss der Durchgangswand unter dem Innenputz des Abzweigs (Putz an Putz). Jetzt streicht `plan/seams.rs` nach dem Zeichnen alle Linien/Polygonkanten, die zwei Flächen gleichen Stils (Füllung + Schraffur ohne Ursprung) VERSCHIEDENER Bauteile trennen (Probe beidseits, Linie muss auf dem Rand beider Flächen liegen); Teilstücke werden zu Linien `wall-outline`/`section-joint`. Grundriss (`walls.rs`, Bänder + schwarze Sammelfläche ab 1:100), Schnitt (`section/primitives.rs`, feine Fugen; schwere Schnittkante unberührt) — Bildschirm, Druck, SVG gleich (gleiche Primitive). Materialwechsel und Fugen eigener Schichten einer Wand bleiben. Tests `plan/wall_merge_tests.rs` (T, Ecke, Kreuzung, Gegenprobe, Materialwechsel), `section/tests.rs`; Goldens nachgeführt. Offen: Flächen werden nicht per Boolean vereinigt (Schraffur-Phase je Wand; verschieden orientierte Schraffur gilt als anderer Stil, Linie bleibt); durchlaufende, nicht verbundene Wand durch Wand (Überlappung) unberührt; Ansicht nicht angesehen; nicht in der Tauri-App/auf dem Mac. · M
- ○ **[197]** Cmd+3/4 Nachbesserung (12.11., Maintainer): (1) Kamera bleibt bei Cmd+3/Cmd+4 exakt stehen (kein Einpassen; Einpassen nur mit Cmd+Shift+F); (2) Dachfenster/Deckenöffnungen bleiben bei „nur Auswahl“ (eine Wand) sichtbar → Öffnungen nur mit sichtbarem Wirt (Wand, Dach, Decke) oder selbst gewählt (`model3d::ElementSelection`). e2e. · S
- ○ **[196]** (12.11., Maintainer, PRIO) (1) Raster-Bodenschraffur in Gebäudeform (mit Loch an der Wendeltreppe) im EG-Grundriss lässt sich weder anwählen noch löschen — Vermutung: Ansichtsschraffur der Decke des darunterliegenden Geschosses (UG-Decke von oben) bzw. Bodenbelag; klären (Musterhaus komplex EG), Pick wählt das Quell-Element (auch wenn es zu einem anderen Geschoss gehört), Entf löscht es bzw. Hinweis. (2) Zeichnungsebenen-Panel: Auge/„sichtbar“ bei einer Ansicht blendet bei den Grundrissen alle Geschosse ein → Auge schaltet nur die eigene Ebene. (3) Auge eines Geschosses aus → Geschoss fehlt auch im 3D (heute zeigt 3D immer alle Geschosse; Filter wie Klassen [180] im 3D-Cache-Ausgang). e2e für alles. · S
- ◐ **[195b]** Objekteinstellungen als ECHTES Nebenfenster (Wunsch Maintainer, 12.11.). **Stand 12.11.:** Unter Tauri öffnet T (bzw. Menü) das native Fenster `object-settings` (`native/objectSettingsWindow.ts`, Fensterseite `ObjectSettingsWindowApp.tsx`, Protokoll `objectSettingsSync.ts`); Browser/Electron behalten das schwebende Panel. Architektur (schlankste ohne Doppelspur): das Fenster lädt denselben Store als SPIEGEL (Projekt-Leseansicht als Feld-Differenz `projectDelta` + Laden ins eigene Kern-Dokument, Auswahl, aktive Ebene, Wert-Felder des Panel-Hosts, Fokus-Abschnitt von T) und rendert unverändert `ObjectSettingsPanel`; Store-Änderungen dort rechnen ihre Ops auf dem Spiegel und gehen über `state/changeSink.ts` ans Hauptfenster (`applyChange`, Undo je Änderung, `coalesceKey` bleibt), Host-Handler per Proxy (`remoteHost`) ebenso; Cmd+Z/Shift+Cmd+Z im Fenster wirken auf den Verlauf des Hauptfensters, Meldungen erscheinen dort. Auswahlwechsel und Undo im Hauptfenster kommen als Sync (30 ms gebündelt, nur bei offenem Fenster, ohne React-Abo in `App`). Mehrfachwerte: Schraffur (Attribute) und Wandtyp/Dicke („gemischt“), Wandtyp gilt für alle gewählten Wände (ein Schritt). Tests `native/objectSettingsSync.test.ts`, `objectSettingsWindow.render.test.ts`, `state/mixedValues.test.ts`, `panelHost/elementAttributesHost.test.ts`. **Offen:** NICHT auf macOS gebaut/getestet (nur vitest/tsc im Linux-Container; Capability `object-settings` ergänzt, kein Rust); jede Projektänderung lädt das Projekt im Fenster ganz ins Kern-Dokument (bei grossen Projekten ggf. Ops-Strom statt Feld-Differenz); kein Messwert (Live-Mass) im Fenster; Mehrfachwerte für weitere Felder (Decke/Dach/Öffnung, Höhen) und Setzen für alle bei weiteren Handlern; OpeningEditorDialog in den Bereich „Objekt“ übernehmen. · L
- ◐ **[195b]** Objekteinstellungen als ECHTES Nebenfenster (Wunsch Maintainer, 12.11.). **Stand 12.11.:** Unter Tauri öffnet T (bzw. Menü) das native Fenster `object-settings` (`native/objectSettingsWindow.ts`, Fensterseite `ObjectSettingsWindowApp.tsx`, Protokoll `objectSettingsSync.ts`); Browser/Electron behalten das schwebende Panel. Architektur (schlankste ohne Doppelspur): das Fenster lädt denselben Store als SPIEGEL (Projekt-Leseansicht als Feld-Differenz `projectDelta` + Laden ins eigene Kern-Dokument, Auswahl, aktive Ebene, Wert-Felder des Panel-Hosts, Fokus-Abschnitt von T) und rendert unverändert `ObjectSettingsPanel`; Store-Änderungen dort rechnen ihre Ops auf dem Spiegel und gehen über `state/changeSink.ts` ans Hauptfenster (`applyChange`, Undo je Änderung, `coalesceKey` bleibt), Host-Handler per Proxy (`remoteHost`) ebenso; Cmd+Z/Shift+Cmd+Z im Fenster wirken auf den Verlauf des Hauptfensters, Meldungen erscheinen dort. Auswahlwechsel und Undo im Hauptfenster kommen als Sync (30 ms gebündelt, nur bei offenem Fenster, ohne React-Abo in `App`). Mehrfachwerte: Schraffur (Attribute) und Wandtyp/Dicke („gemischt“), Wandtyp gilt für alle gewählten Wände (ein Schritt). **Stand 12.11. (2):** „gemischt“ auch für Decke (Typ/Dicke/UK/OK), Dach (Typ/Neigung), Öffnung (Typ/Breite/Höhe/Brüstung) und Wand-UK/OK (`mixedValues.ts`, Marke `MixedMark`); die Setter dafür (`elementAttributesHost`, `patchAll`) ändern alle gewählten Elemente gleicher Art in EINEM Undo-Schritt (Dicken per `groupChanges`; Dach nur Typ/Neigung), ein nicht angefasstes gemischtes Feld bleibt unverändert; `deriveSelection` führt bei mehreren Decken/Öffnungen/Dächern mit dem ersten Element (vorher: keine Info, also kein Abschnitt). `OpeningEditorDialog` ist weg: der Editor ist der Abschnitt „Fenster-/Türeditor“ im Bereich „Objekt“ (`panels/objectInfo/OpeningEditor.tsx`, ⚙ klappt ihn auf; Host-Handler `onPatchWindowType/DoorType/onSaveOpeningStyle`; „Als Stil speichern“ mit Eingabezeile statt `window.prompt`); `setOpeningEditorId`/Dialog-State entfernt. Tests `native/objectSettingsSync.test.ts`, `objectSettingsWindow.render.test.ts`, `state/mixedValues.test.ts`, `panelHost/elementAttributesHost.test.ts`. **Offen:** NICHT auf macOS gebaut/getestet (nur vitest/tsc im Linux-Container; Capability `object-settings` ergänzt, kein Rust); jede Projektänderung lädt das Projekt im Fenster ganz ins Kern-Dokument (bei grossen Projekten ggf. Ops-Strom statt Feld-Differenz); kein Messwert (Live-Mass) im Fenster; weitere Handler setzen bei Mehrfachauswahl noch nur das erste Element (Referenzlinie, Raum, Treppe, Öffnungs-Zusatzfelder, Dach-Kanten/Gauben). · L
- ○ **[195]** Objekt-Einstellungsfenster (12.11., Maintainer): T öffnet ein EIGENES Fenster (macOS-Nebenfenster wie Einstellungen/Ressourcen über die Sync-Brücke, Browser: verschiebbares Fenster), für ALLE Bauteile (Wand, Decke, Dach, Treppe, Stütze, Öffnung, Raum, Körper, Gelände/Baugrube, 2D, Bemassung), mit Abschnitten Objektspezifisch (Typ/Aufbau/Masse/Parameter) + Darstellung (Stift, Füllung, Schraffur, Linienstil, Modelldarstellung). Mehrfachauswahl gleicher Art, live mit Undo je Änderung; dieselben Abschnitts-Komponenten wie Objekt-Info (keine Doppelspur). Ersetzt den bisherigen Öffnungs-Dialog bei T. · L
- ◐ **[194]** Texte exakt synchron beim Zoomen (12.11., Maintainer Mac: Texte immer leicht verzögert; Nachfolger [145]).
12.11.: Die native Fläche zeichnet die Plan-Texte selbst im selben Frame wie die Linien: Raumstempel und waagrechte
+2 -2
View File
@@ -147,7 +147,7 @@ export default function App() {
// State, siehe state/useDialogState.ts.
const dialogs = useDialogState();
const {
resourcesOpen, setResourcesOpen, setResourcesTab, setOpeningEditorId, activeLayoutId, setActiveLayoutId,
resourcesOpen, setResourcesOpen, setResourcesTab, activeLayoutId, setActiveLayoutId,
setImportState, exportOpen, setExportOpen, setExportDxfOpen, setSettingsOpen, setExportSaveFormat,
setDropActive,
} = dialogs;
@@ -680,7 +680,7 @@ export default function App() {
selectedViewSnapshotId,
setSelectedViewSnapshotId,
},
dialogState: { setActiveLayoutId, setOpeningEditorId },
dialogState: { setActiveLayoutId },
contextMenuState: { setMenu },
});
+2 -1
View File
@@ -623,9 +623,10 @@ export const de = {
"objinfo.ceiling.anchorCustom": "Eigene",
// ── Öffnungs-Attribute (Object-Info-Panel) ──────────────────────────────
"objinfo.opening.section": "Öffnung",
"objinfo.openingEditor.section": "Fenster-/Türeditor",
"objinfo.opening.type": "Typ",
"objinfo.opening.editType": "Einstellungen …",
// Fenster-/Tür-Einstellungsdialog (OpeningEditorDialog).
// Fenster-/Tür-Einstellungsdialog (OpeningEditor).
"oed.title.window": "Fenster-Einstellungen",
"oed.title.door": "Tür-Einstellungen",
"oed.style": "Stil",
+2 -1
View File
@@ -622,9 +622,10 @@ export const en: Record<TranslationKey, string> = {
"objinfo.ceiling.anchorCustom": "Custom",
// ── Opening attributes (object info panel) ──────────────────────────────
"objinfo.opening.section": "Opening",
"objinfo.openingEditor.section": "Window/door editor",
"objinfo.opening.type": "Type",
"objinfo.opening.editType": "Settings …",
// Window/door settings dialog (OpeningEditorDialog).
// Window/door settings dialog (OpeningEditor).
"oed.title.window": "Window settings",
"oed.title.door": "Door settings",
"oed.style": "Style",
+5 -6
View File
@@ -498,12 +498,11 @@ export interface PanelHostValue {
* (Discoverability: von der gewählten Öffnung in den Typeditor springen).
*/
onEditOpeningType: (kind: "door" | "window") => void;
/**
* Öffnet den reichen Fenster-/Tür-Einstellungsdialog für DIESE Öffnung
* (Kategorie-Sidebar, Live-2D-Vorschau, Flügeleinteilung, „Als Stil speichern").
* Ist der Primärort für Öffnungs-Parameter; das ⚙ der OpeningSection ruft ihn.
*/
onOpenOpeningEditor: (openingId: string) => void;
/** Fenster-/Türeditor ([195b], Abschnitt der Objekt-Info): Typ-Felder des Stils ändern (wirkt auf alle Öffnungen des Stils). */
onPatchWindowType: (typeId: string, patch: Partial<import("../model/types").WindowType>) => void;
onPatchDoorType: (typeId: string, patch: Partial<import("../model/types").DoorType>) => void;
/** „Als Stil speichern": Stil der Öffnung als neuen benannten Stil ablegen und zuweisen. */
onSaveOpeningStyle: (openingId: string, name: string) => void;
/**
* Immutable Änderung von Dach-Attributen (Form/Neigung/Überstand/Firstrichtung/
* Dicke) — wirkt NUR auf das selektierte Dach.
+16 -6
View File
@@ -8,7 +8,9 @@ import { t } from "../../i18n";
import { Dropdown } from "../../ui/Dropdown";
import { UValueRow } from "../UValueRow";
import { formatM } from "../../model/types";
import { BuildingFlags, DimensionField, VerticalAnchorRow } from "./fields";
import { selectionCeilingValues } from "../../state/mixedValues";
import { BuildingFlags, DimensionField, MixedMark, VerticalAnchorRow } from "./fields";
import { useMulti } from "./useMulti";
export function CeilingSection({
ceiling,
@@ -18,6 +20,8 @@ export function CeilingSection({
host: ReturnType<typeof usePanelHost>;
}) {
const storeProject = useStore((st) => st.project);
// [195b] Mehrfachauswahl: abweichende Werte als „gemischt" kennzeichnen.
const multi = useMulti("ceilings", selectionCeilingValues);
const isSingle = ceiling.singleLayer;
const multiPresets = ceiling.ceilingTypes.filter((ct) => ct.layerCount > 1);
@@ -61,11 +65,14 @@ export function CeilingSection({
{/* Einschichtig → Dicke-Zahlfeld. Mehrschichtig → Preset-Dropdown. */}
{isSingle ? (
<DimensionField
label={t("objinfo.ceiling.thickness")}
value={ceiling.thickness}
onCommit={(v) => host.onSetCeilingThickness(v)}
/>
<>
<DimensionField
label={t("objinfo.ceiling.thickness")}
value={ceiling.thickness}
onCommit={(v) => host.onSetCeilingThickness(v)}
/>
<MixedMark on={multi?.thickness.mixed} what="thickness" />
</>
) : (
<div className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.ceiling.preset")}</span>
@@ -80,6 +87,7 @@ export function CeilingSection({
title={t("objinfo.ceiling.preset")}
width={150}
/>
<MixedMark on={multi?.typeId.mixed} what="ceilingType" />
</div>
)}
@@ -149,6 +157,7 @@ export function CeilingSection({
defaultFloorId={ceiling.floorId}
onChange={(a) => host.onSetCeilingTop(a)}
/>
<MixedMark on={multi?.top.mixed} what="top" />
{/* UK der Decke: an Geschoss gebunden ODER eigene Höhe; ohne Override
bleibt es beim heutigen Verhalten UK = OK − Dicke. */}
@@ -160,6 +169,7 @@ export function CeilingSection({
defaultFloorId={ceiling.floorId}
onChange={(a) => host.onSetCeilingBottom?.(a)}
/>
<MixedMark on={multi?.bottom.mixed} what="bottom" />
<div className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.ceiling.height")}</span>
<span className="objinfo-fval">{formatM(ceiling.zTop - ceiling.zBottom)}</span>
+2
View File
@@ -10,6 +10,7 @@ import { CeilingSection } from "./CeilingSection";
import { GridSection } from "./GridSection";
import { InfoGroup } from "./InfoGroup";
import { NewComponentSection } from "./NewComponentSection";
import { OpeningEditorSection } from "./OpeningEditor";
import { OpeningSection } from "./OpeningSections";
import { DetailRefSection, DimRefsSection, DimTextSection } from "./RefSections";
import { RoofSection } from "./RoofSections";
@@ -46,6 +47,7 @@ export function InfoGroups({ sel, drawing, host }: { sel: SelectionInfo | null;
case "roof": return sel?.roof ? <RoofSection roof={sel.roof} host={host} /> : null;
case "surfacePattern": return sel ? <SurfacePatternPlacement kind={sel.wall ? "wall" : "roof"} id={sel.id} host={host} /> : null;
case "opening": return sel?.opening ? <OpeningSection opening={sel.opening} host={host} /> : null;
case "openingEditor": return sel?.opening ? <OpeningEditorSection openingId={sel.opening.id} host={host} /> : null;
case "stair": return sel?.stair ? <StairSection stair={sel.stair} host={host} /> : null;
case "room": return sel?.room ? <RoomSection room={sel.room} roomId={sel.id} host={host} /> : null;
case "extrudedSolid": return sel?.extrudedSolid ? <ExtrudedSolidSection solid={sel.extrudedSolid} host={host} /> : null;
@@ -0,0 +1,37 @@
// [195b] Der Fenster-/Türeditor ist Abschnitt des Bereichs „Objekt" (früher modaler Dialog) und die Abschnitte
// zeigen „gemischt" bei abweichenden Werten der Mehrfachauswahl. Ohne DOM: Server-Render des Panels.
import { createElement } from "react";
import { renderToString } from "react-dom/server";
import { describe, expect, it } from "vitest";
import { buildComplexSampleProject } from "../../model/sampleProjectComplex";
import { getState, setState } from "../../state/appStore";
import { EMPTY_SELECTION } from "../../state/selection";
import { PanelHostProvider } from "../host";
import type { PanelHost } from "../types";
import { ObjectSettingsPanel } from "../objectSettings/ObjectSettingsPanel";
const host = { activeTool: "select", sectionLine: null, displayMode: { mode: "all", setMode: () => {} } } as unknown as PanelHost;
const render = () => renderToString(createElement(PanelHostProvider, { value: host }, createElement(ObjectSettingsPanel)));
describe("Objekteinstellungen: Öffnung [195b]", () => {
it("Wandöffnung gewählt: Abschnitt „Fenster-/Türeditor“ mit dem Editor im Bereich Objekt", () => {
getState().loadProject(buildComplexSampleProject());
const o = getState().project.openings!.find((x) => !x.hostRoofId && !x.hostCeilingId)!;
setState({ selection: { ...EMPTY_SELECTION, openings: [o.id] } });
const html = render();
expect(html).toContain('data-group="openingEditor"');
expect(html).toContain('data-testid="opening-editor"');
expect(html).not.toContain("imp-overlay");
});
it("zwei Öffnungen mit abweichender Breite: „gemischt“ am Breitenfeld", () => {
const p = buildComplexSampleProject();
const [a, b] = p.openings!.filter((x) => !x.hostRoofId && !x.hostCeilingId);
const q = { ...p, openings: p.openings!.map((x) => (x.id === a.id ? { ...x, width: 1 } : x.id === b.id ? { ...x, width: 1.4 } : x)) };
getState().loadProject(q);
setState({ selection: { ...EMPTY_SELECTION, openings: [a.id, b.id] } });
expect(render()).toContain('data-mixed="width"');
setState({ selection: { ...EMPTY_SELECTION, openings: [a.id] } });
expect(render()).not.toContain('data-mixed="width"');
});
});
@@ -1,5 +1,6 @@
// Reicher Fenster-/Tür-Einstellungsdialog (VW „Fenster bearbeiten"-Muster,
// Studie docs/design/window-editor-vectorworks-study.md). Drei Zonen:
// Reicher Fenster-/Tür-Editor (VW „Fenster bearbeiten"-Muster, Studie docs/design/window-editor-vectorworks-study.md),
// [195b] als Abschnitt „Fenster-/Türeditor" im Bereich „Objekt" des Objekteinstellungs-Fensters (früher modaler
// Dialog `OpeningEditorDialog`). Drei Zonen:
// 1. Kategorie-Sidebar links,
// 2. Parameter-Panel Mitte,
// 3. Live-2D-Ansicht (Elevation) rechts — direkt aus den aktuellen Werten
@@ -11,7 +12,7 @@
// (Grösse/Position dieser Öffnung). Bezeichner englisch, UI-Text deutsch.
import { useEffect, useState } from "react";
import { t } from "../i18n";
import { t } from "../../i18n";
import type {
DoorType,
FrameDetail,
@@ -22,9 +23,11 @@ import type {
Project,
SashDef,
WindowType,
} from "../model/types";
import { getDoorType, getWindowType, sashesOfWindowType, glazingPanesOf } from "../model/types";
import { CorePreview, DoorFramePanel, FrameDetailPanel, RebatePanel, RevealPanel, ScopeSwitch } from "./OpeningDetailPanels";
} from "../../model/types";
import { useStore } from "../../state/appStore";
import type { usePanelHost } from "../host";
import { getDoorType, getWindowType, sashesOfWindowType, glazingPanesOf } from "../../model/types";
import { CorePreview, DoorFramePanel, FrameDetailPanel, RebatePanel, RevealPanel, ScopeSwitch } from "../../ui/OpeningDetailPanels";
/** P0-Kategorien der Sidebar, je nach Öffnungsart. */
type CatId =
@@ -39,7 +42,24 @@ type CatId =
| "zarge"
| "schichten";
export interface OpeningEditorDialogProps {
/** 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);
return (
<OpeningEditor
openingId={openingId}
project={project}
onPatchWindowType={host.onPatchWindowType}
onPatchDoorType={host.onPatchDoorType}
onPatchOpening={(patch) => updateOpening(openingId, patch)}
onSetOpeningType={(typeId) => updateOpening(openingId, { typeId: typeId || undefined })}
onSaveAsStyle={(name) => host.onSaveOpeningStyle(openingId, name)}
/>
);
}
export interface OpeningEditorProps {
openingId: string;
project: Project;
/** Typ-Feld (aktueller Stil) ändern — wirkt auf alle Instanzen des Stils. */
@@ -51,10 +71,9 @@ export interface OpeningEditorDialogProps {
onSetOpeningType: (typeId: string) => void;
/** Aktuellen Stil als NEUEN benannten Stil ablegen und der Öffnung zuweisen. */
onSaveAsStyle: (name: string) => void;
onClose: () => void;
}
export function OpeningEditorDialog({
export function OpeningEditor({
openingId,
project,
onPatchWindowType,
@@ -62,8 +81,7 @@ export function OpeningEditorDialog({
onPatchOpening,
onSetOpeningType,
onSaveAsStyle,
onClose,
}: OpeningEditorDialogProps) {
}: OpeningEditorProps) {
const opening = (project.openings ?? []).find((o) => o.id === openingId);
const isDoor = opening?.kind === "door";
const wt = opening && !isDoor ? getWindowType(project, opening) : undefined;
@@ -94,16 +112,11 @@ export function OpeningEditorDialog({
// [105]/[106]: Detail-Panels wirken auf den Typ (alle Öffnungen) oder nur auf diese Öffnung.
const [scope, setScope] = useState<"type" | "opening">(opening?.frameDetail || opening?.layerReveals || opening?.doorFrame || opening?.doorFrameKind ? "opening" : "type");
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
if (e.key === "Escape") onClose();
};
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, [onClose]);
// Name für „Als Stil speichern" (null = Eingabe zu); `window.prompt` ist im Tauri-WKWebView stumm.
const [newStyleName, setNewStyleName] = useState<string | null>(null);
if (!opening) {
// Öffnung verschwand (Undo/Löschen während offen) → Dialog schliesst sich.
// Öffnung verschwand (Undo/Löschen während offen) → nichts zu zeigen.
return null;
}
@@ -137,23 +150,7 @@ export function OpeningEditorDialog({
);
return (
<div className="imp-overlay" onClick={onClose}>
<div
className="oed-dialog"
role="dialog"
aria-modal="true"
aria-label={t(isDoor ? "oed.title.door" : "oed.title.window")}
onClick={(e) => e.stopPropagation()}
>
<header className="imp-head">
<span className="imp-head-title">
{t(isDoor ? "oed.title.door" : "oed.title.window")}
</span>
<button className="imp-close" onClick={onClose} aria-label={t("export.close")}>
×
</button>
</header>
<div className="oed-dialog oed-embedded" role="group" aria-label={t(isDoor ? "oed.title.door" : "oed.title.window")} data-testid="opening-editor">
{/* Stil-Leiste: Stil wählen · als Stil speichern · zurücksetzen. */}
<div className="oed-stylebar">
<span className="oed-style-label">{t("oed.style")}</span>
@@ -174,17 +171,31 @@ export function OpeningEditorDialog({
type="button"
className="oed-btn"
title={t("oed.saveStyle.hint")}
onClick={() => {
const name = window.prompt(
t("oed.saveStyle.prompt"),
`${styleName} ${t("oed.saveStyle.copySuffix")}`,
);
if (name && name.trim()) onSaveAsStyle(name.trim());
}}
onClick={() => setNewStyleName(newStyleName === null ? `${styleName} ${t("oed.saveStyle.copySuffix")}` : null)}
>
{t("oed.saveStyle")}
</button>
</div>
{newStyleName !== null && (
<form
className="oed-stylebar"
onSubmit={(e) => {
e.preventDefault();
if (newStyleName.trim()) onSaveAsStyle(newStyleName.trim());
setNewStyleName(null);
}}
>
<input
className="oed-input"
aria-label={t("oed.saveStyle.prompt")}
placeholder={t("oed.saveStyle.prompt")}
value={newStyleName}
autoFocus
onChange={(e) => setNewStyleName(e.target.value)}
/>
<button type="submit" className="oed-btn">{t("oed.saveStyle")}</button>
</form>
)}
<div className="oed-main">
{/* 1. Kategorie-Sidebar. */}
@@ -244,13 +255,6 @@ export function OpeningEditorDialog({
<CorePreview project={project} openingId={opening.id} />
</div>
</div>
<footer className="imp-foot">
<button className="imp-btn primary" onClick={onClose}>
{t("export.close")}
</button>
</footer>
</div>
</div>
);
}
+19 -3
View File
@@ -10,7 +10,17 @@ import type { DetailLevel } from "../../model/viewTypes";
import { formatM } from "../../model/types";
import { surfaceOpeningInfo } from "../../core";
import { ColorHexField } from "../../ui/ColorHexField";
import { DimensionField } from "./fields";
import { selectionOpeningValues } from "../../state/mixedValues";
import { DimensionField, MixedMark } from "./fields";
import { useMulti } from "./useMulti";
import { expandAndFocusInfoGroup } from "./infoGroupState";
import { setSettingsArea } from "../objectSettings/areaState";
/** ⚙: den Abschnitt „Fenster-/Türeditor" im Bereich „Objekt" aufklappen und fokussieren. */
function openEditor(): void {
setSettingsArea("object");
expandAndFocusInfoGroup("openingEditor");
}
// Anzeige-Fallbacks für die Öffnungs-Linien-Übersteuerung (LineStyleRow) —
// dieselben Werte wie POCHE_STROKE/SYMBOL_HAIRLINE_MM im Grundriss (Kern: plan/style.rs)
@@ -31,6 +41,8 @@ export function OpeningSection({
host: ReturnType<typeof usePanelHost>;
}) {
const storeProject = useStore((st) => st.project);
// [195b] Mehrfachauswahl: abweichende Werte als „gemischt" kennzeichnen.
const multi = useMulti("openings", selectionOpeningValues);
const isDoor = opening.kind === "door";
if (opening.hostRoofId || opening.hostCeilingId) {
return <SurfaceOpeningSection opening={opening} host={host} />;
@@ -57,12 +69,13 @@ export function OpeningSection({
title={t("objinfo.opening.type")}
width={106}
/>
<MixedMark on={multi?.typeId.mixed} what="openingType" />
<button
type="button"
className="objinfo-typebtn"
title={t("objinfo.opening.editType")}
aria-label={t("objinfo.opening.editType")}
onClick={() => host.onOpenOpeningEditor(opening.id)}
onClick={openEditor}
>
⚙
</button>
@@ -103,11 +116,13 @@ export function OpeningSection({
value={opening.width}
onCommit={(v) => host.onSetOpeningWidth(v)}
/>
<MixedMark on={multi?.width.mixed} what="width" />
<DimensionField
label={t("objinfo.opening.height")}
value={opening.height}
onCommit={(v) => host.onSetOpeningHeight(v)}
/>
<MixedMark on={multi?.height.mixed} what="height" />
{!isDoor && (
<>
<DimensionField
@@ -115,6 +130,7 @@ export function OpeningSection({
value={opening.sillHeight}
onCommit={(v) => host.onSetOpeningSill(v)}
/>
<MixedMark on={multi?.sillHeight.mixed} what="sill" />
{/* Fenster-spezifisch: Flügelanzahl (1–4). */}
<DimensionField
label={t("objinfo.opening.wingCount")}
@@ -342,7 +358,7 @@ function SurfaceOpeningSection({
className="objinfo-typebtn"
title={t("objinfo.opening.editType")}
aria-label={t("objinfo.opening.editType")}
onClick={() => host.onOpenOpeningEditor(opening.id)}
onClick={openEditor}
>
⚙
</button>
+7
View File
@@ -13,6 +13,9 @@ import { Dropdown } from "../../ui/Dropdown";
import { UValueRow } from "../UValueRow";
import { formatM } from "../../model/types";
import type { RoofEdge, EdgeSpec } from "../../core";
import { selectionRoofValues } from "../../state/mixedValues";
import { MixedMark } from "./fields";
import { useMulti } from "./useMulti";
// ── Treppen-Attribut-Abschnitt ───────────────────────────────────────────────
// Grundform (gerade/L/Wendel), Laufbreite, Stufenanzahl, Steighöhe (+ abgeleitete
@@ -146,6 +149,8 @@ export function RoofSection({
host: ReturnType<typeof usePanelHost>;
}) {
const storeProject = useStore((st) => st.project);
// [195b] Mehrfachauswahl: abweichender Typ/abweichende Neigung als „gemischt" kennzeichnen.
const multi = useMulti("roofs", selectionRoofValues);
const numField = (
labelKey: TranslationKey,
value: number,
@@ -204,6 +209,7 @@ export function RoofSection({
title={t("objinfo.roof.type")}
width={130}
/>
<MixedMark on={multi?.roofTypeId.mixed} what="roofType" />
</div>
<UValueRow project={storeProject} kind="roof" typeId={roof.roofTypeId} />
@@ -229,6 +235,7 @@ export function RoofSection({
numField("objinfo.roof.pitch", roof.pitchDeg, 1, (v) =>
host.onSetRoofPatch({ pitchDeg: Math.max(0, Math.min(85, v)) }),
)}
{roof.shape !== "flach" && <MixedMark on={multi?.pitchDeg.mixed} what="pitch" />}
{roof.shape === "mansarde" &&
numField("objinfo.roof.pitchUpper", roof.pitchUpperDeg ?? roof.pitchDeg / 2, 1, (v) =>
host.onSetRoofPatch({ pitchUpperDeg: Math.max(0, Math.min(85, v)) }),
+9 -11
View File
@@ -1,9 +1,8 @@
// Abschnitt „Wand" der Attribute ([165] aus `ObjectInfoPanel.tsx`): Referenzlinie, Aufbau, Geschoss, Unter-
// und Oberkante. Gerufen von `AttributesPanel`.
import { useMemo } from "react";
import { useStore } from "../../state/appStore";
import { selectionWallValues } from "../../state/mixedValues";
import { selectionWallHeights, selectionWallValues } from "../../state/mixedValues";
import type { WallInfo } from "../../state/selectionInfo";
import { usePanelHost } from "../host";
import { t } from "../../i18n";
@@ -11,7 +10,8 @@ import { Dropdown } from "../../ui/Dropdown";
import type { WallReferenceLine, SliceTermination } from "../../model/types";
import { UValueRow } from "../UValueRow";
import { formatM } from "../../model/types";
import { BuildingFlags, DimensionField, VerticalAnchorRow } from "./fields";
import { BuildingFlags, DimensionField, MixedMark, VerticalAnchorRow } from "./fields";
import { useMulti } from "./useMulti";
// ── Wand-Attribut-Abschnitt ──────────────────────────────────────────────────
// Aufbau-Typ (einschichtig/mehrschichtig), Dicke/Preset, Referenzgeschoss +
@@ -24,14 +24,10 @@ export function WallSection({
host: ReturnType<typeof usePanelHost>;
}) {
const storeProject = useStore((st) => st.project);
const selection = useStore((st) => st.selection);
// [195b] Mehrfachauswahl: abweichender Typ/abweichende Dicke als „gemischt" kennzeichnen.
const multi = useMemo(
() => (selection.walls.length > 1 ? selectionWallValues(storeProject, selection) : null),
[storeProject, selection],
);
const mixedMark = (on: boolean | undefined, what: string) =>
on ? <span className="attr-mixed" data-mixed={what}>{t("objsettings.mixed")}</span> : null;
// [195b] Mehrfachauswahl: abweichender Typ/Dicke/Höhe als „gemischt" kennzeichnen.
const multi = useMulti("walls", selectionWallValues);
const heights = useMulti("walls", selectionWallHeights);
const mixedMark = (on: boolean | undefined, what: string) => <MixedMark on={on} what={what} />;
// Aufbau-Typ-Segment: einschichtig vs. mehrschichtig. Aus dem Modell
// abgeleitet (singleLayer); der Umschalter auf „mehrschichtig" wählt einen
// mehrschichtigen Wandtyp-Preset (erster mit >1 Schicht), auf „einschichtig"
@@ -232,6 +228,7 @@ export function WallSection({
defaultFloorId={wall.floorAbove?.id ?? wall.floorId}
onChange={(a) => host.onSetWallTop(a)}
/>
{mixedMark(heights?.top.mixed, "top")}
<VerticalAnchorRow
label={t("objinfo.wall.bottom")}
anchor={wall.bottom}
@@ -240,6 +237,7 @@ export function WallSection({
defaultFloorId={wall.floorId}
onChange={(a) => host.onSetWallBottom(a)}
/>
{mixedMark(heights?.bottom.mixed, "bottom")}
{/* Höhe = OK − UK (abgeleitet, read-only). */}
<div className="objinfo-field">
+5
View File
@@ -8,6 +8,11 @@ import type { VerticalAnchor } from "../../model/types";
import { Dropdown } from "../../ui/Dropdown";
import { useState, useRef } from "react";
/** [195b] Kennzeichnung „gemischt": Die gewählten Elemente haben für dieses Feld verschiedene Werte. */
export function MixedMark({ on, what }: { on: boolean | undefined; what: string }) {
return on ? <span className="attr-mixed" data-mixed={what}>{t("objsettings.mixed")}</span> : null;
}
// ── Decken-Attribut-Abschnitt ────────────────────────────────────────────────
// Aufbau-Typ (einschichtig/mehrschichtig), Dicke/Preset, Referenzgeschoss +
// OK-Bindung, Fläche. Alle Werte/Setter über den Host.
+2 -2
View File
@@ -19,7 +19,7 @@ describe("Panel-Zuordnung [189]", () => {
it("Fenster/Tür: nur die Objekt-Info trägt den Öffnungs-Abschnitt", () => {
const sel = deriveSelection(p, { openings: [p.openings![0].id] });
expect(infoGroups({ sel, ...ctx })).toEqual(["opening"]);
expect(infoGroups({ sel, ...ctx })).toEqual(["opening", "openingEditor"]);
});
it("Decke, Raum, Treppe, Dach: je ein eigener Abschnitt der Objekt-Info", () => {
@@ -50,7 +50,7 @@ describe("Panel-Zuordnung [189]", () => {
});
it("jede Gruppe hat einen Titel", () => {
const all: InfoGroupId[] = ["newComponent", "sectionLine", "wall", "ceiling", "roof", "surfacePattern", "opening", "stair", "room", "extrudedSolid", "column", "detailRef", "dimRefs", "dimText", "grid"];
const all: InfoGroupId[] = ["newComponent", "sectionLine", "wall", "ceiling", "roof", "surfacePattern", "opening", "openingEditor", "stair", "room", "extrudedSolid", "column", "detailRef", "dimRefs", "dimText", "grid"];
for (const g of all) expect(INFO_GROUP_TITLE[g]).toBeTruthy();
});
});
+3 -1
View File
@@ -15,6 +15,7 @@ export type InfoGroupId =
| "roof"
| "surfacePattern"
| "opening"
| "openingEditor"
| "stair"
| "room"
| "extrudedSolid"
@@ -32,6 +33,7 @@ export const INFO_GROUP_TITLE: Record<InfoGroupId, TranslationKey> = {
roof: "objinfo.roof.section",
surfacePattern: "objinfo.surfacePattern",
opening: "objinfo.opening.section",
openingEditor: "objinfo.openingEditor.section",
stair: "objinfo.stair.section",
room: "objinfo.room.section",
extrudedSolid: "objinfo.extrudedSolid.section",
@@ -65,7 +67,7 @@ export function infoGroups(c: InfoGroupContext): InfoGroupId[] {
if (sel.ceiling) out.push("ceiling");
if (sel.roof) out.push("roof");
if (sel.wall || sel.roof) out.push("surfacePattern");
if (sel.opening) out.push("opening");
if (sel.opening) out.push("opening", "openingEditor");
if (sel.stair) out.push("stair");
if (sel.room) out.push("room");
if (sel.extrudedSolid) out.push("extrudedSolid");
+14
View File
@@ -0,0 +1,14 @@
// [195b] Gemeinsame Werte bei Mehrfachauswahl gleicher Art für die Abschnitte der Objekt-Info: `null` bei einem
// einzelnen Element, sonst das Ergebnis der Abfrage aus `state/mixedValues.ts` (je Wert gleich oder „gemischt").
import { useMemo } from "react";
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 {
const project = useStore((s) => s.project);
const selection = useStore((s) => s.selection);
// `compute` ist je Aufrufstelle eine Modul-Funktion (stabil).
return useMemo(() => (selection[kind].length > 1 ? compute(project, selection) : null), [project, selection, kind, compute]);
}
+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);
});
});
+88
View File
@@ -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);
});
});
+49 -29
View File
@@ -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;
+4 -1
View File
@@ -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">;
};
+3 -3
View File
@@ -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
}),
+6 -3
View File
@@ -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).
-5
View File
@@ -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,
+25 -1
View File
@@ -5800,7 +5800,7 @@ body {
border-color: var(--ctx-danger);
}
/* ── Fenster-/Tür-Einstellungsdialog (OpeningEditorDialog) ──────────────────
/* ── Fenster-/Tür-Einstellungsdialog (OpeningEditor, Abschnitt der Objekt-Info) ──────────────────
Drei Zonen (Sidebar · Panel · Ansicht) unter einer Stil-Leiste. Nutzt sonst
die imp-*-Klassen (Overlay/Head/Foot). */
.oed-dialog {
@@ -5814,6 +5814,30 @@ body {
box-shadow: var(--shadow-3);
overflow: hidden;
}
/* Eingebettet im Objekteinstellungs-Fenster: schmal, Sidebar als Reihe über dem Parameter-Panel. */
.oed-dialog.oed-embedded {
width: auto;
max-height: none;
border: 0;
border-radius: 0;
box-shadow: none;
background: transparent;
}
.oed-embedded .oed-main {
grid-template-columns: 1fr;
min-height: 0;
overflow: visible;
}
.oed-embedded .oed-sidebar {
flex-direction: row;
flex-wrap: wrap;
width: auto;
border-right: 0;
}
.oed-embedded .oed-stylebar {
padding: 6px 0;
flex-wrap: wrap;
}
.oed-stylebar {
display: flex;
align-items: center;
+2 -19
View File
@@ -28,7 +28,6 @@ import { ExportSaveDialog } from "./ExportSaveDialog";
import { IfcImportDialog, IfcImportReportDialog } from "./IfcImportDialog";
import { ImportDialog } from "./ImportDialog";
import { LockConflictDialog } from "./LockConflictDialog";
import { OpeningEditorDialog } from "./OpeningEditorDialog";
import { PresentationDialogHost } from "./PresentationDialog";
import { PromptDialog } from "./PromptDialog";
import { RecoverAutosaveDialog } from "./RecoverAutosaveDialog";
@@ -96,8 +95,6 @@ export function AppDialogs(props: {
resourcesOpen,
setResourcesOpen,
resourcesTab,
openingEditorId,
setOpeningEditorId,
setActiveLayoutId,
importState,
setImportState,
@@ -131,10 +128,10 @@ export function AppDialogs(props: {
const { pendingIfc, setPendingIfc, ifcReport, setIfcReport, runIfcImport } = props.modelImport;
const { themeMode, setThemeMode, offline, onOfflineChange, aiAccess, setScaleLineWeights, setLineEnds } = props.settings;
const { exportContentMeters, onExportPdf, onExportSvg, onExportDxf } = props.planExport;
const { patchWindowType, patchDoorType, updateOpening, saveOpeningStyle, setRoomStamp, setRoomStampDoc } = props.pa;
const { setRoomStamp, setRoomStampDoc } = props.pa;
// Das Projekt nur abonnieren, solange ein Dialog offen ist, der es zeigt ([121]): sonst rendert eine Op
// am Modell hier nichts. `App` reicht es nicht mehr durch.
const needsProject = resourcesOpen || openingEditorId != null || !!importState || settingsOpen;
const needsProject = resourcesOpen || !!importState || settingsOpen;
const subscribed = useStore((s) => (needsProject ? s.project : null));
const project = subscribed ?? getState().project;
return (
@@ -153,20 +150,6 @@ export function AppDialogs(props: {
/>
)}
{/* Reicher Fenster-/Tür-Einstellungsdialog (⚙ der OpeningSection). */}
{openingEditorId != null && (
<OpeningEditorDialog
openingId={openingEditorId}
project={project}
onPatchWindowType={patchWindowType}
onPatchDoorType={patchDoorType}
onPatchOpening={(patch) => updateOpening(openingEditorId, patch)}
onSetOpeningType={(typeId) => updateOpening(openingEditorId, { typeId: typeId || undefined })}
onSaveAsStyle={(name) => saveOpeningStyle(openingEditorId, name)}
onClose={() => setOpeningEditorId(null)}
/>
)}
<BusyOverlay />
<AiActivityPanel />
+1 -1
View File
@@ -1,7 +1,7 @@
// Frontal-Ansicht (Elevation, SVG) eines Fensters/einer Tür: Rahmen, Flügel/
// Pfosten (mit Öffnungslinien je Flügel), Verglasungshinweis und Rollladen-
// kasten. Rein aus den Modellwerten gezeichnet — kein Renderer-Roundtrip,
// deterministisch. Ursprünglich Teil von {@link OpeningEditorDialog} (dort
// deterministisch. Ursprünglich Teil von `OpeningEditor` (dort
// mit einer echten Öffnungs-Instanz gefüttert); hierher extrahiert, damit
// auch die Typ-Bibliothek (ResourceManager, ohne konkrete Instanz — s.
// `WindowStylesTab`/`DoorStylesTab`) dieselbe Vorschau zeigen kann. Braucht
+1 -1
View File
@@ -39,7 +39,7 @@ liegen in `src/panels`, Befehle in `src/commands`.
|---|---|
| `LayoutSheet.tsx`, `layoutSheetMath.ts`, `LayoutCreateDialogs.tsx`, `SheetTableHud.tsx` | Layout-Blatt im Haupt-Viewport, Treffer- und Resize-Rechnung der Viewports, Erstell-Dialoge, Eigenschaften einer Blatt-Tabelle |
| `TextEditorDialog.tsx`, `RoomStampEditorHost.tsx` | Rich-Text-Editor, Stempel-Editor eines Raums |
| `OpeningEditorDialog.tsx`, `OpeningDetailPanels.tsx`, `ElevationPreview.tsx` | Fenster-/Tür-Dialog, Detail-Panels, Ansichtsvorschau |
| `OpeningDetailPanels.tsx`, `ElevationPreview.tsx` | Detail-Panels des Fenster-/Türeditors (der Editor selbst: `panels/objectInfo/OpeningEditor.tsx`), Ansichtsvorschau |
## Unterordner