[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

+6 -22
View File
@@ -16,6 +16,7 @@ import { useMemo, useRef } from "react";
import { t } from "../i18n";
import { usePanelHost } from "./host";
import { getState, useStore } from "../state/appStore";
import { fromIdLists, toIdLists } from "../state/selection";
import { saveBinaryFile } from "../native/saveFile";
import {
BCF_STATUSES,
@@ -73,31 +74,14 @@ function uuid(): string {
function applySelection(sel: BcfSelection): void {
const s = getState();
s.clearSelection();
s.setSelectedWallIds(sel.wallIds);
s.setSelectedCeilingIds(sel.ceilingIds);
s.setSelectedOpeningIds(sel.openingIds);
s.setSelectedStairIds(sel.stairIds);
s.setSelectedRoomIds(sel.roomIds);
s.setSelectedExtrudedSolidIds(sel.extrudedSolidIds);
s.setSelectedColumnIds(sel.columnIds);
s.setSelectedRoofIds(sel.roofIds);
s.setSelectedContextObjectIds(sel.contextObjectIds);
s.setSelection(fromIdLists(sel));
}
function currentSelection(): BcfSelection {
const s = getState();
return {
...emptyBcfSelection(),
wallIds: s.selectedWallIds,
ceilingIds: s.selectedCeilingIds,
openingIds: s.selectedOpeningIds,
stairIds: s.selectedStairIds,
roomIds: s.selectedRoomIds,
extrudedSolidIds: s.selectedExtrudedSolidIds,
columnIds: s.selectedColumnIds,
roofIds: s.selectedRoofIds,
contextObjectIds: s.selectedContextObjectIds,
};
const l = toIdLists(getState().selection);
const out = emptyBcfSelection();
for (const k of Object.keys(out) as (keyof BcfSelection)[]) out[k] = l[k];
return out;
}
const f1 = (n: number) => n.toLocaleString("de-CH", { maximumFractionDigits: 1 });
+2 -4
View File
@@ -4,6 +4,7 @@
import { t } from "../i18n";
import { getState } from "../state/appStore";
import { fromIdLists } from "../state/selection";
import { clashSelection, type Clash } from "../analysis/clash";
import { focusCamera, viewportAvailable } from "../viewport/cameraBridge";
import { runClashAndStore, setClashSession, useClashSession } from "./clashSession";
@@ -13,10 +14,7 @@ export function focusClash(c: Clash, index: number): void {
const s = getState();
const sel = clashSelection(c);
s.clearSelection();
s.setSelectedWallIds(sel.wallIds);
s.setSelectedCeilingIds(sel.ceilingIds);
s.setSelectedExtrudedSolidIds(sel.extrudedSolidIds);
s.setSelectedContextObjectIds(sel.contextObjectIds);
s.setSelection(fromIdLists(sel));
setClashSession({ selected: index });
const radius = Math.hypot(c.max[0] - c.min[0], c.max[1] - c.min[1], c.max[2] - c.min[2]) / 2;
if (viewportAvailable()) focusCamera(c.center, radius);
+3 -1
View File
@@ -120,6 +120,8 @@ function ExcavationQty({ q }: { q: { cut: number; fill: number; backfill: number
export function SitePanel() {
const host = usePanelHost();
// Gewählte Kontext-Objekte schmal aus dem Store ([121], [130]).
const selectedContextObjectIds = useStore((s) => s.selection.contextObjects);
const notify = useStore((s) => s.notify);
const objects = host.contextObjects;
const contourSets = objects.filter((o) => o.type === "contourSet");
@@ -258,7 +260,7 @@ export function SitePanel() {
key={obj.id}
className={
"site-row" +
(host.selectedContextObjectIds.includes(obj.id) ? " site-row-selected" : "")
(selectedContextObjectIds.includes(obj.id) ? " site-row-selected" : "")
}
>
<span className="site-name" title={obj.name}>
+3 -5
View File
@@ -41,7 +41,7 @@ import type {
} from "../model/types";
import type { MeasurementReadout, SnapSettings, ToolId } from "../tools/types";
import type { TerrainOptions } from "../model/terrain";
import type { Selection } from "../state/selectionInfo";
import type { SelectionInfo } from "../state/selectionInfo";
import type { TextStylePreset } from "../text/richText";
import type { ScheduleKind } from "../export/exportSchedule";
import type { DetailLevel } from "../model/viewTypes";
@@ -176,7 +176,7 @@ export interface PanelHostValue {
* (oder `null`). Die Paletten lesen daraus Farbe/Strichstärke/Füllung/bbox
* und grauen nicht-anwendbare Felder per `selection.kind` aus.
*/
selection: Selection | null;
selection: SelectionInfo | null;
/**
* Live-Messwerte des Mess-Werkzeugs (Länge/Fläche/Winkel), oder `null`, wenn
* gerade nicht gemessen wird. Das Objekt-Info-Panel zeigt sie dauerhaft an,
@@ -595,8 +595,6 @@ export interface PanelHostValue {
// ── Site-/Kontext-Schicht (SitePanel) ───────────────────────────────────
/** Aktuelle Kontext-Objekte (Meshes/Konturen/Gelände) aus `project.context`. */
contextObjects: ContextObject[];
/** Im 3D-Viewport angewählte Kontext-Objekte (Umriss-Hervorhebung), s. selectionSlice. */
selectedContextObjectIds: string[];
/** Fügt mehrere Kontext-Objekte hinzu (z. B. aus einem DXF-Import). */
onAddContextObjects: (objs: ContextObject[]) => void;
/** Entfernt ein Kontext-Objekt per ID. */
@@ -822,7 +820,7 @@ export interface CreateMasterLayoutOptions {
// importieren Panels nur aus „./host" und bleiben auf einen Pfad fokussiert.
export type { DrawingLevel, LayerCategory };
export type { SnapSettings, ToolId };
export type { Selection } from "../state/selectionInfo";
export type { SelectionInfo } from "../state/selectionInfo";
export type { ScheduleKind, ScheduleRow } from "../export/exportSchedule";
// ── Hook ───────────────────────────────────────────────────────────────────