[130] Merge: Auswahl als ein Selection-Objekt statt 12 Felder (−728 Zeilen)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
Claude committed 2026-11-04 18:20:11 +00:00
commit ddf10e9f7f
29 files changed
+741 -1469

No files matched your search

+20 -66
View File
@@ -18,7 +18,9 @@ import type { ViewType } from "../model/viewTypes";
import type { TransformSelection } from "../tools/transform";
import type { PlanViewHandle } from "../views/plan/PlanView";
import type { PanelHostValue } from "../panels/host";
import type { Selection } from "./selectionInfo";
import type { SelectionInfo } from "./selectionInfo";
import { clearKinds } from "./selection";
import type { SelectionKind } from "./selection";
import type { EngineView } from "../commands/engine";
import type { ScheduleKind } from "../export/exportSchedule";
import type { TabId as ResourceTabId } from "../ui/ResourceManager";
@@ -128,7 +130,7 @@ export function usePanelHostBase(opts: {
openResources: (tab?: ResourceTabId) => void;
dxfInputRef: RefObject<HTMLInputElement | null>;
planViewRef: RefObject<PlanViewHandle | null>;
selection: Selection | null;
selection: SelectionInfo | null;
projectActions: Pick<
ReturnType<typeof useProjectActions>,
| "toggleLevelVisible"
@@ -192,19 +194,8 @@ export function usePanelHostBase(opts: {
selectionState: Pick<
ReturnType<typeof useSelectionState>,
| "updateRoof"
| "setSelectedWallIds"
| "setSelectedDrawingId"
| "selectedContextObjectIds"
| "setSelectedCeilingIds"
| "setSelectedOpeningIds"
| "setSelectedStairIds"
| "setSelectedRoomIds"
| "setSelectedExtrudedSolidIds"
| "setSelectedColumnIds"
| "setSelectedRoofIds"
| "setSelectedContextObjectIds"
| "setSelection"
| "selectedSectionLineId"
| "setSelectedSectionLineIds"
| "section3dCutId"
>;
toolState: Pick<
@@ -316,19 +307,8 @@ export function usePanelHostBase(opts: {
} = projectActions;
const {
updateRoof,
setSelectedWallIds,
setSelectedDrawingId,
selectedContextObjectIds,
setSelectedCeilingIds,
setSelectedOpeningIds,
setSelectedStairIds,
setSelectedRoomIds,
setSelectedExtrudedSolidIds,
setSelectedColumnIds,
setSelectedRoofIds,
setSelectedContextObjectIds,
setSelection,
selectedSectionLineId,
setSelectedSectionLineIds,
section3dCutId,
} = selectionState;
const { activeTool, activeWallTypeId, setActiveWallTypeId, activeCategoryCode, setActiveCategoryCode, snap, setSnap } =
@@ -1115,7 +1095,6 @@ export function usePanelHostBase(opts: {
},
// ── Site-/Kontext-Schicht ──────────────────────────────────────────────
contextObjects: project.context ?? [],
selectedContextObjectIds,
onAddContextObjects: addContextObjectsAndFit,
onRemoveContextObject: removeContextObject,
onRemoveContextObjects: removeContextObjects,
@@ -1135,44 +1114,20 @@ export function usePanelHostBase(opts: {
opts?: { zoom?: boolean },
) => {
const applySelection = () => {
setSelectedWallIds([]);
setSelectedDrawingId(null);
setSelectedCeilingIds([]);
setSelectedOpeningIds([]);
setSelectedStairIds([]);
setSelectedRoomIds([]);
setSelectedExtrudedSolidIds([]);
setSelectedColumnIds([]);
setSelectedRoofIds([]);
setSelectedContextObjectIds([]);
setSelectedSectionLineIds([]);
switch (kind) {
case "Wand":
setSelectedWallIds([id]);
break;
case "Decke":
setSelectedCeilingIds([id]);
break;
case "Fenster":
case "Öffnung":
setSelectedOpeningIds([id]);
break;
case "Treppe":
setSelectedStairIds([id]);
break;
case "Extrusion":
setSelectedExtrudedSolidIds([id]);
break;
case "Dach":
setSelectedRoofIds([id]);
break;
case "Stütze":
setSelectedColumnIds([id]);
break;
default:
// z. B. Legacy-„Tür"-Datensätze (project.doors) — kein Auswahl-Kanal.
return;
}
const kindOf: Partial<Record<ScheduleKind, SelectionKind>> = {
Wand: "walls",
Decke: "ceilings",
Fenster: "openings",
Öffnung: "openings",
Treppe: "stairs",
Extrusion: "solids",
Dach: "roofs",
Stütze: "columns",
};
const k = kindOf[kind];
setSelection({ ...clearKinds(), ...(k ? { [k]: [id] } : {}) });
// z. B. Legacy-„Tür"-Datensätze (project.doors) — kein Auswahl-Kanal.
if (!k) return;
if (opts?.zoom) requestAnimationFrame(() => planViewRef.current?.fit());
};
if (floorId && floorId !== activeLevelId) {
@@ -1534,7 +1489,6 @@ export function usePanelHostBase(opts: {
section3dCutId,
onToggleSection3dCut,
selectedViewSnapshotId,
selectedContextObjectIds,
]);
return baseHost;