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

This commit is contained in:
Claude committed 2026-11-12 16:56:40 +00:00
commit 062f1d002a
16 files changed
+213 -27

No files matched your search

+11
View File
@@ -90,3 +90,14 @@ describe("deriveSelection (Kern)", () => {
expect(edges(roof({})).every((e) => !e.defaultGable)).toBe(true);
});
});
describe("Führende Art bei Wand samt Öffnungen [204f]", () => {
it("Öffnung deren Wirtswand mit gewählt ist, verdrängt die Wand nicht", () => {
const p = base();
const o = p.openings!.find((x) => x.hostWallId)!;
expect(deriveSelection(p, { walls: [o.hostWallId!], openings: [o.id] })!.kind).toBe("wall");
expect(deriveSelection(p, { openings: [o.id] })!.kind).toBe("opening");
const other = p.walls.find((w) => w.id !== o.hostWallId)!;
expect(deriveSelection(p, { walls: [other.id], openings: [o.id] })!.kind).toBe("opening");
});
});
+17 -1
View File
@@ -600,6 +600,21 @@ const THROWN = /^Unbekannte[rs]? /;
* Bauteil wirft wie bisher; ein Element, das das Kern-Modell nicht lesen kann,
* ergibt `null` (mit Warnung).
*/
/**
* Öffnung, die die Objekt-Info führt: die erste gewählte, deren Wirtswand NICHT mit gewählt ist.
* Sind alle gewählten Öffnungen Teil gewählter Wände, ist es `null` (die Wand führt).
*/
export function leadingOpeningId(project: Project, sel: Selection): string | null {
if (sel.openings.length === 0) return null;
if (sel.walls.length === 0) return sel.openings[0];
const walls = new Set(sel.walls);
const byId = new Map((project.openings ?? []).map((o) => [o.id, o]));
return sel.openings.find((id) => {
const host = byId.get(id)?.hostWallId;
return !(host && walls.has(host));
}) ?? null;
}
export function deriveSelection(project: Project, selection: Partial<Selection>): SelectionInfo | null {
const sel = mergeSelection(EMPTY_SELECTION, selection);
const args = {
@@ -609,7 +624,8 @@ export function deriveSelection(project: Project, selection: Partial<Selection>)
// 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,
// [204f] Wand samt ihrer Öffnungen gewählt (Cmd+V, Rahmenauswahl): die Wand führt, nicht die Öffnung.
openingId: leadingOpeningId(project, sel),
// Ebenso Treppen, Räume, Körper und Stützen.
stairId: sel.stairs[0] ?? null,
roomId: sel.rooms[0] ?? null,
+21
View File
@@ -647,6 +647,27 @@ export function useObjectSettingsShortcut(
}, [overrides, engineRef]);
}
/**
* [204c] Esc schliesst die schwebende Objekteinstellungen-Palette (Browser-Rückfall). Capture-Phase und
* `preventDefault`, damit Esc nicht zugleich die Auswahl aufhebt; nicht bei laufendem Werkzeug/Befehl
* (dort bricht Esc diese ab), in Eingabefeldern und bei offenem modalem Dialog.
*/
export function useCloseObjectSettingsOnEscape(blocked: boolean): void {
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
if (e.key !== "Escape" || e.ctrlKey || e.metaKey || e.altKey || e.defaultPrevented) return;
if (blocked || isEditableTarget(e) || (e.target as HTMLElement | null)?.tagName === "SELECT") return;
if (document.querySelector('[aria-modal="true"]')) return;
const st = getState();
if (!st.layout.floating.some((f) => f.panelId === "object-settings")) return;
st.closeFloat("object-settings");
e.preventDefault();
};
window.addEventListener("keydown", onKey, true);
return () => window.removeEventListener("keydown", onKey, true);
}, [blocked]);
}
/**
* [190] Auswahl-Aktionen mit Archicad-Kürzeln: Cmd/Ctrl+D = Duplizieren (Kopie mit Versatz), Cmd/Ctrl+L =
* Sperren/Entsperren, Cmd/Ctrl+Shift+H = Ebenen der Auswahl ausblenden, Cmd/Ctrl+Shift+A = alle Ebenen