Merge branch 'worktree-agent-a9472965c2e002097' into claude/practical-noether-1hb2s1
This commit is contained in:
19 files changed
+513
-78
No files matched your search
@@ -88,6 +88,8 @@ export interface CommandSelection {
|
||||
openingIds?: string[];
|
||||
/** [149] Gewählte Bäume (Verschieben/Kopieren/Spiegeln/Drehen: Stammmitte). */
|
||||
treeIds?: string[];
|
||||
/** [193] Gewählte Gelände-/Umgebungs-Elemente (`Project.context`: Gelände, Höhenlinien, Baugrube, Netze, Bilder). */
|
||||
contextIds?: string[];
|
||||
}
|
||||
|
||||
/** Live-Kontext, den ein Befehl bei jedem Schritt erhält (analog ToolContext). */
|
||||
|
||||
@@ -2415,6 +2415,10 @@ export const de = {
|
||||
"site.contourIndexEvery": "Zähllinie jede",
|
||||
"site.smoothShading": "Glatt schattieren",
|
||||
"site.creaseAngle": "Knickwinkel °",
|
||||
"site.heightOffset": "Höhenversatz [m]",
|
||||
"site.heightOffset.hint": "Alle Höhen des Elements um diesen Wert verschieben (Eingabe mit Enter bestätigen; negativ = tiefer).",
|
||||
"site.contours": "Höhenlinien ({n}) — Höhe [m]",
|
||||
"site.contour.points": "{n} Punkte",
|
||||
"site.excavation.bottom": "Sohle [m]",
|
||||
"site.excavation.slope": "Böschung [°]",
|
||||
"site.excavation.fillSlope": "Schüttung [°]",
|
||||
|
||||
@@ -2403,6 +2403,10 @@ export const en: Record<TranslationKey, string> = {
|
||||
"site.contourIndexEvery": "Index contour every",
|
||||
"site.smoothShading": "Smooth shading",
|
||||
"site.creaseAngle": "Crease angle °",
|
||||
"site.heightOffset": "Height offset [m]",
|
||||
"site.heightOffset.hint": "Shift all heights of this element by this value (confirm with Enter; negative = lower).",
|
||||
"site.contours": "Contours ({n}) — height [m]",
|
||||
"site.contour.points": "{n} points",
|
||||
"site.excavation.bottom": "Bottom [m]",
|
||||
"site.excavation.slope": "Slope [°]",
|
||||
"site.excavation.fillSlope": "Fill slope [°]",
|
||||
|
||||
@@ -11,7 +11,8 @@ import { useStore } from "../state/appStore";
|
||||
import type { ContextObject } from "../model/types";
|
||||
import { flattenCategories } from "../model/types";
|
||||
import { resmoothGridTerrain } from "../model/terrain";
|
||||
import { useMemo } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import { contourHeightPatch, heightOffsetPatch } from "../state/contextHeight";
|
||||
import type { ExcavationQuantity } from "../core";
|
||||
|
||||
/** Zahl-Eingabe für ein Feld eines Kontext-Objekts (leer = Standard, ungültig = keine Änderung). */
|
||||
@@ -64,8 +65,70 @@ const SMOOTH_LEVELS = [0, 1, 2, 3] as const;
|
||||
/** [137] Zusätzliche Glättungs-Durchgänge für Raster-Gelände. */
|
||||
const RESMOOTH_PASSES = [1, 2, 4] as const;
|
||||
|
||||
|
||||
/** [193] Höhenversatz (alle Höhen um dz) und, bei Höhenlinien, die Höhe je Linie. */
|
||||
function HeightFields({ obj }: { obj: ContextObject }) {
|
||||
const host = usePanelHost();
|
||||
const [dz, setDz] = useState("");
|
||||
if (obj.type === "image") return null;
|
||||
const apply = () => {
|
||||
const patch = dz.trim() === "" ? null : heightOffsetPatch(obj, Number(dz.replace(",", ".")));
|
||||
if (patch) host.onPatchContextObject(obj.id, patch);
|
||||
setDz("");
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<label className="site-prop" title={t("site.heightOffset.hint")}>
|
||||
<span>{t("site.heightOffset")}</span>
|
||||
<input
|
||||
type="text"
|
||||
inputMode="decimal"
|
||||
data-testid="context-height-offset"
|
||||
placeholder="0.00"
|
||||
value={dz}
|
||||
onChange={(e) => setDz(e.target.value)}
|
||||
onKeyDown={(e) => e.key === "Enter" && apply()}
|
||||
onBlur={apply}
|
||||
/>
|
||||
</label>
|
||||
{obj.type === "contourSet" && (
|
||||
<div className="site-prop" data-testid="contour-heights" style={{ display: "block", maxHeight: 180, overflowY: "auto" }}>
|
||||
<span>{t("site.contours", { n: obj.contours.length })}</span>
|
||||
{obj.contours.map((c, i) => (
|
||||
<label key={i} style={{ display: "flex", gap: 6, alignItems: "center" }}>
|
||||
<span style={{ flex: 1 }}>{`${i + 1} · ${t("site.contour.points", { n: c.pts.length })}`}</span>
|
||||
<input
|
||||
type="number"
|
||||
step={0.5}
|
||||
style={{ width: 90 }}
|
||||
data-testid={`contour-z-${i}`}
|
||||
value={c.z}
|
||||
onChange={(e) => {
|
||||
const patch = e.target.value.trim() === "" ? null : contourHeightPatch(obj, i, Number(e.target.value));
|
||||
if (patch) host.onPatchContextObject(obj.id, patch, `site-${obj.id}-contourZ-${i}`);
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** Felder eines Kontext-Objekts; `null` für Arten ohne eigene Einstellungen (Höhenlinien, Luftbild). */
|
||||
export function ContextObjectProps({ obj, quantities }: { obj: ContextObject; quantities: readonly ExcavationQuantity[] }) {
|
||||
return (
|
||||
<>
|
||||
<KindFields obj={obj} quantities={quantities} />
|
||||
<div className="site-props">
|
||||
<HeightFields obj={obj} />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function KindFields({ obj, quantities }: { obj: ContextObject; quantities: readonly ExcavationQuantity[] }) {
|
||||
const host = usePanelHost();
|
||||
const project = useStore((s) => s.project);
|
||||
const notify = useStore((s) => s.notify);
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ in `ProjectSync`.
|
||||
| `view3dFilter.ts` | 3D-Element-Filter ([185], rein UI): „Auswahl in 3D zeigen" (Cmd/Ctrl+3) und temporär ausgeblendete Elemente (Cmd/Ctrl+4); Geschoss-Kürzel Cmd/Ctrl+5/6 in `tabNavigation.ts` |
|
||||
| `selectionActions.ts` | Ablage für Aktionen mit mehreren Eingängen ([190]): Duplizieren, Sperren, Verbinden, Ebenen aus-/einblenden, Einpassen — Tastenkürzel und natives Menü rufen dieselben Funktionen (`runSelectionAction`) |
|
||||
| `groupActions.ts` | Gruppen erzeugen, auflösen, betreten |
|
||||
| `exportScope.ts`, `objectLock.ts` | Export „nur Auswahl"; Objekt-Sperre |
|
||||
| `exportScope.ts`, `objectLock.ts`, `selectAll.ts`, `contextHeight.ts` | Export „nur Auswahl"; Objekt-Sperre; Cmd+A-Auswahl (reine Funktion); Höhenversatz von Gelände-Elementen |
|
||||
| `autosave.ts`, `projectStore.ts`, `recentProjects.ts`, `startupGuard.ts` | Autosave und Wiederherstellen, IndexedDB, zuletzt geöffnet, Start-Protokoll |
|
||||
| `aiAccess.ts` | KI-Zugriff auf das offene Projekt (`[9]`) |
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { contourHeightPatch, heightOffsetPatch } from "./contextHeight";
|
||||
import type { ContextObject } from "../model/types";
|
||||
|
||||
const base = { id: "a", name: "A", categoryCode: "02" };
|
||||
const set = { ...base, type: "contourSet", contours: [{ z: 500, pts: [], closed: false }, { z: 501, pts: [], closed: false }] } as ContextObject;
|
||||
|
||||
describe("Höhe von Gelände-Elementen", () => {
|
||||
it("Netz: nur z wird versetzt", () => {
|
||||
const o = { ...base, type: "terrainMesh", positions: [0, 0, 5, 1, 0, 6, 0, 1, 7], indices: [0, 1, 2] } as ContextObject;
|
||||
expect(heightOffsetPatch(o, -1.5)).toEqual({ positions: [0, 0, 3.5, 1, 0, 4.5, 0, 1, 5.5] });
|
||||
});
|
||||
it("Höhenlinien und Baugrube", () => {
|
||||
expect(heightOffsetPatch(set, 2)).toEqual({ contours: [{ z: 502, pts: [], closed: false }, { z: 503, pts: [], closed: false }] });
|
||||
expect(heightOffsetPatch({ ...base, type: "excavation", outline: [], bottom: -3 } as ContextObject, 0.5)).toEqual({ bottom: -2.5 });
|
||||
});
|
||||
it("keine Änderung bei 0/NaN; Höhe einer Linie", () => {
|
||||
expect(heightOffsetPatch(set, 0)).toBeNull();
|
||||
expect(heightOffsetPatch(set, NaN)).toBeNull();
|
||||
expect(contourHeightPatch(set, 1, 510)).toEqual({ contours: [{ z: 500, pts: [], closed: false }, { z: 510, pts: [], closed: false }] });
|
||||
expect(contourHeightPatch(set, 1, 501)).toBeNull();
|
||||
expect(contourHeightPatch(set, 7, 1)).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
// [193] Höhe von Gelände-/Umgebungs-Elementen ändern: Höhenversatz (alle z um dz) und die Höhe einer einzelnen
|
||||
// Höhenlinie. Liefert Feld-Patches für `patchContextObject`; `null` = Art ohne Höhe (Luftbild) oder keine Änderung.
|
||||
|
||||
import type { ContextObject, Contour } from "../model/types";
|
||||
|
||||
/** Alle Höhen des Elements um `dz` Meter versetzen: Netz-z, Höhenlinien-z, Baugruben-Sohle. */
|
||||
export function heightOffsetPatch(obj: ContextObject, dz: number): Record<string, unknown> | null {
|
||||
if (!Number.isFinite(dz) || dz === 0) return null;
|
||||
switch (obj.type) {
|
||||
case "terrainMesh":
|
||||
case "importedMesh": {
|
||||
const pos = obj.positions.slice();
|
||||
for (let i = 2; i < pos.length; i += 3) pos[i] += dz;
|
||||
return { positions: pos };
|
||||
}
|
||||
case "contourSet":
|
||||
return { contours: obj.contours.map((c): Contour => ({ ...c, z: c.z + dz })) };
|
||||
case "excavation":
|
||||
return { bottom: obj.bottom + dz };
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Höhe der Höhenlinie `index` eines Höhenlinien-Satzes setzen. */
|
||||
export function contourHeightPatch(obj: ContextObject, index: number, z: number): Record<string, unknown> | null {
|
||||
if (obj.type !== "contourSet" || !Number.isFinite(z) || !obj.contours[index] || obj.contours[index].z === z) return null;
|
||||
return { contours: obj.contours.map((c, i): Contour => (i === index ? { ...c, z } : c)) };
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// [193] Cmd+A: Kontext-Elemente (Gelände, Höhenlinien, Baugrube, Netze, Bilder) gehören dazu — sichtbare, nicht gesperrte Klasse.
|
||||
import { beforeAll, describe, expect, it } from "vitest";
|
||||
import { buildComplexSampleProject } from "../model/sampleProjectComplex";
|
||||
import { setCategoriesVisible, patchCategoryByCode } from "../model/layers";
|
||||
import { selectAllIds, selectAllHasAny } from "./selectAll";
|
||||
import type { Project } from "../model/types";
|
||||
|
||||
let p: Project;
|
||||
beforeAll(() => {
|
||||
p = buildComplexSampleProject();
|
||||
});
|
||||
|
||||
describe("selectAllIds", () => {
|
||||
it("nimmt Gelände, Höhenlinien und Baugrube mit", () => {
|
||||
const ids = selectAllIds(p, "eg");
|
||||
const all = new Set(ids.contextObjects);
|
||||
for (const type of ["terrainMesh", "contourSet", "excavation"] as const) {
|
||||
const c = (p.context ?? []).filter((o) => o.type === type);
|
||||
expect(c.length, type).toBeGreaterThan(0);
|
||||
for (const o of c) expect(all.has(o.id), `${type} ${o.id}`).toBe(true);
|
||||
}
|
||||
expect(ids.walls!.length).toBeGreaterThan(0);
|
||||
expect(selectAllHasAny(ids)).toBe(true);
|
||||
});
|
||||
|
||||
it("wählt die Schattenfläche der Sonnenstudie (Entf blendet sie aus), nur im Geschoss-Grundriss", () => {
|
||||
expect(p.sunStudy?.show).toBe(true);
|
||||
expect(selectAllIds(p, "eg").site).toEqual(["sunStudy"]);
|
||||
expect(selectAllIds(p, "schnitt-a").site).toEqual([]);
|
||||
const q = { ...p, sunStudy: { ...p.sunStudy!, show: false } };
|
||||
expect(selectAllIds(q, "eg").site).toEqual([]);
|
||||
});
|
||||
|
||||
it("lässt Kontext mit ausgeblendeter Klasse aus", () => {
|
||||
const ctx = p.context![0];
|
||||
const q = { ...p, layers: setCategoriesVisible(p.layers, new Set([ctx.categoryCode]), false) };
|
||||
expect(selectAllIds(q, "eg").contextObjects).not.toContain(ctx.id);
|
||||
expect(selectAllIds(q, "eg").contextObjects!.length).toBeLessThan(selectAllIds(p, "eg").contextObjects!.length);
|
||||
});
|
||||
|
||||
it("lässt Kontext mit gesperrter Klasse aus", () => {
|
||||
const ctx = p.context![0];
|
||||
const q = { ...p, layers: patchCategoryByCode(p.layers, ctx.categoryCode, { locked: true }) };
|
||||
expect(selectAllIds(q, "eg").contextObjects).not.toContain(ctx.id);
|
||||
});
|
||||
|
||||
it("andere Geschosse bleiben aussen vor", () => {
|
||||
const ids = selectAllIds(p, "eg");
|
||||
const ogWall = p.walls.find((w) => w.floorId === "og")!;
|
||||
expect(ids.walls).not.toContain(ogWall.id);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,59 @@
|
||||
// „Alles auswählen" (Cmd/Ctrl+A) als reine Funktion: Id-Listen des Projekts für das aktive Geschoss.
|
||||
// Geschossbezogene Elemente nach floorId/levelId; Schnittlinien-Symbole und Kontext-Elemente
|
||||
// (Gelände, Höhenlinien, Baugrube, Netze, Bilder) sind projektweit — Kontext nur, wenn seine Klasse
|
||||
// sichtbar und nicht gesperrt ist ([193], seit [181] normale Elemente mit Klasse).
|
||||
|
||||
import type { Project } from "../model/types";
|
||||
import { collectVisibleCodes, flattenCategories } from "../model/layers";
|
||||
import type { Selection } from "./selection";
|
||||
|
||||
export function selectAllIds(project: Project, levelId: string): Partial<Selection> {
|
||||
const wallIds = project.walls.filter((w) => w.floorId === levelId).map((w) => w.id);
|
||||
const wallIdSet = new Set(wallIds);
|
||||
const drawingIds = project.drawings2d.filter((d) => d.levelId === levelId).map((d) => d.id);
|
||||
const ceilingIds = (project.ceilings ?? []).filter((c) => c.floorId === levelId).map((c) => c.id);
|
||||
const ceilingIdSet = new Set(ceilingIds);
|
||||
const roofIds = (project.roofs ?? []).filter((r) => r.floorId === levelId).map((r) => r.id);
|
||||
const roofIdSet = new Set(roofIds);
|
||||
// Öffnungen haben kein eigenes floorId (Geschoss über die Wirtswand); Dachfenster/Deckenöffnungen
|
||||
// ([103]) über das Dach bzw. die Decke des Geschosses.
|
||||
const openingIds = (project.openings ?? [])
|
||||
.filter((o) => wallIdSet.has(o.hostWallId) || (!!o.hostRoofId && roofIdSet.has(o.hostRoofId)) || (!!o.hostCeilingId && ceilingIdSet.has(o.hostCeilingId)))
|
||||
.map((o) => o.id);
|
||||
const stairIds = (project.stairs ?? []).filter((s) => s.floorId === levelId).map((s) => s.id);
|
||||
const roomIds = (project.rooms ?? []).filter((r) => r.floorId === levelId).map((r) => r.id);
|
||||
const solids = (project.extrudedSolids ?? []).filter((s) => s.levelId === levelId).map((s) => s.id);
|
||||
const columnIds = (project.columns ?? []).filter((c) => c.floorId === levelId).map((c) => c.id);
|
||||
// Schnittführungs-Symbole sind projektweit (kein floorId; plan/context.rs, plan_section_lines).
|
||||
const sectionLines = project.drawingLevels
|
||||
.filter((l) => (l.kind === "section" || l.kind === "elevation") && l.linePoints)
|
||||
.map((l) => l.id);
|
||||
// Kontext-Elemente: projektweit, nur sichtbare und nicht gesperrte Klasse.
|
||||
const ctx = project.context ?? [];
|
||||
let contextObjects: string[] = [];
|
||||
if (ctx.length) {
|
||||
const visible = collectVisibleCodes(project.layers);
|
||||
const locked = new Set(flattenCategories(project.layers).filter((c) => c.locked).map((c) => c.code));
|
||||
contextObjects = ctx.filter((c) => visible.has(c.categoryCode) && !locked.has(c.categoryCode)).map((c) => c.id);
|
||||
}
|
||||
// Schattenfläche der Sonnenstudie: abgeleitet, aber angeklickt wählbar ([137]) — also auch hier; Entf blendet sie aus.
|
||||
const level = project.drawingLevels.find((l) => l.id === levelId);
|
||||
const site = project.sunStudy?.show && level?.kind === "floor" ? ["sunStudy"] : [];
|
||||
return {
|
||||
site,
|
||||
walls: wallIds,
|
||||
drawings: drawingIds,
|
||||
ceilings: ceilingIds,
|
||||
openings: openingIds,
|
||||
stairs: stairIds,
|
||||
rooms: roomIds,
|
||||
solids,
|
||||
columns: columnIds,
|
||||
roofs: roofIds,
|
||||
contextObjects,
|
||||
sectionLines,
|
||||
};
|
||||
}
|
||||
|
||||
/** Hat „Alles auswählen" überhaupt etwas gewählt? */
|
||||
export const selectAllHasAny = (sel: Partial<Selection>): boolean => Object.values(sel).some((l) => (l?.length ?? 0) > 0);
|
||||
@@ -86,6 +86,7 @@ describe("Selection", () => {
|
||||
roomIds: [],
|
||||
openingIds: [],
|
||||
treeIds: [],
|
||||
contextIds: [],
|
||||
});
|
||||
expect(toTransformSelection(s)).toEqual(c);
|
||||
});
|
||||
|
||||
@@ -142,6 +142,7 @@ export function toCommandSelection(sel: Selection): CommandSelection {
|
||||
roomIds: sel.rooms,
|
||||
openingIds: sel.openings,
|
||||
treeIds: sel.trees,
|
||||
contextIds: sel.contextObjects,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -162,7 +163,8 @@ export function hasTransformable(sel: Selection): boolean {
|
||||
sel.stairs.length > 0 ||
|
||||
sel.rooms.length > 0 ||
|
||||
sel.openings.length > 0 ||
|
||||
sel.trees.length > 0
|
||||
sel.trees.length > 0 ||
|
||||
sel.contextObjects.length > 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,12 @@ declare global {
|
||||
modelView: () => string | undefined;
|
||||
/** [173] Schnitt der aktiven Ebene (1:50, Detailgrad der Anzeige): Zahl der Wand-Schnittflächen und ihre Fläche (m²). */
|
||||
sectionWalls: () => Promise<{ n: number; area: number }>;
|
||||
/** [193] Gelände-/Umgebungs-Elemente (Art, Id, bei der Baugrube die erste Umrissecke). */
|
||||
context: () => { id: string; type: string; first?: { x: number; y: number } }[];
|
||||
/** [193] Gefüllte Flächen (Füllfarbe gesetzt) im Grundriss der aktiven Ebene (alle Kategorien, 1:100); bei 0 ist nichts Gefülltes mehr zu sehen. */
|
||||
planFills: () => number;
|
||||
/** [193] Höhe (z) des ersten Gelände-Netz-Punkts. */
|
||||
terrainZ: () => number;
|
||||
/** [185] Darstellungszustand der Plan-Ansicht: aktive Ebene, Bildmitte (Modell-m), Zoom (px/m), Massstab. */
|
||||
viewCamera: () => { levelId: string; center: { x: number; y: number } | null; pxPerMeter: number | null; scale: number };
|
||||
/** [192] Sichtbare Ebenen-Codes und Zahl der Plan-Primitive (gesamt / mit Wand-Bezug) der aktiven Ebene. */
|
||||
@@ -88,6 +94,24 @@ export function installTestHooks(): void {
|
||||
walk(s.project.layers);
|
||||
return generatePlan(s.project, s.activeLevelId, codes, undefined, s.detail, false, false, true, 50).primitives.filter((q) => q.kind === "line" && q.cls === cls).length;
|
||||
},
|
||||
context: () =>
|
||||
(getState().project.context ?? []).map((c) => ({ id: c.id, type: c.type, first: c.type === "excavation" ? c.outline[0] : undefined })),
|
||||
planFills: () => {
|
||||
const s = getState();
|
||||
const codes = new Set<string>();
|
||||
const walk = (cs: { code: string; children?: unknown[] }[]): void => {
|
||||
for (const c of cs) {
|
||||
codes.add(c.code);
|
||||
walk((c.children ?? []) as { code: string; children?: unknown[] }[]);
|
||||
}
|
||||
};
|
||||
walk(s.project.layers);
|
||||
return generatePlan(s.project, s.activeLevelId, codes, undefined, s.detail, false, false, true, 100).primitives.filter((q) => q.kind === "polygon" && q.fill && q.fill !== "none").length;
|
||||
},
|
||||
terrainZ: () => {
|
||||
const t = (getState().project.context ?? []).find((c) => c.type === "terrainMesh");
|
||||
return t && t.type === "terrainMesh" ? t.positions[2] : NaN;
|
||||
},
|
||||
modelView: () => getState().project.drawingLevels.find((l) => l.id === getState().activeLevelId)?.modelViewOptionId,
|
||||
sectionWalls: async () => {
|
||||
const s = getState();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
//
|
||||
// Extrahiert aus App.tsx. Bezeichner englisch, Kommentare deutsch (CONVENTIONS.md).
|
||||
|
||||
import { selectAllIds, selectAllHasAny } from "./selectAll";
|
||||
import { useEffect, useRef } from "react";
|
||||
import type { RefObject } from "react";
|
||||
import type { ToolId } from "../tools/types";
|
||||
@@ -289,74 +290,9 @@ export function useSelectAllAndDeleteShortcut(opts: {
|
||||
if (matchesShortcut(e, "selectAll", shortcutOverrides)) {
|
||||
// Projekt beim Tastendruck aus dem Store ([121]: App abonniert es nicht mehr).
|
||||
const project = getState().project;
|
||||
const wallIds = project.walls
|
||||
.filter((w) => w.floorId === activeLevelId)
|
||||
.map((w) => w.id);
|
||||
const wallIdSet = new Set(wallIds);
|
||||
const drawingIds = project.drawings2d
|
||||
.filter((d) => d.levelId === activeLevelId)
|
||||
.map((d) => d.id);
|
||||
const ceilingIds = (project.ceilings ?? [])
|
||||
.filter((c) => c.floorId === activeLevelId)
|
||||
.map((c) => c.id);
|
||||
// Öffnungen haben kein eigenes floorId (das Geschoss ergibt sich aus
|
||||
// der Wirtswand) — über die bereits geschossgefilterten Wand-Ids.
|
||||
// Dachfenster/Deckenöffnungen ([103]): über das Dach bzw. die Decke des Geschosses.
|
||||
const roofIdSet = new Set((project.roofs ?? []).filter((r) => r.floorId === activeLevelId).map((r) => r.id));
|
||||
const ceilingIdSet = new Set(ceilingIds);
|
||||
const openingIds = (project.openings ?? [])
|
||||
.filter((o) => wallIdSet.has(o.hostWallId) || (!!o.hostRoofId && roofIdSet.has(o.hostRoofId)) || (!!o.hostCeilingId && ceilingIdSet.has(o.hostCeilingId)))
|
||||
.map((o) => o.id);
|
||||
const stairIds = (project.stairs ?? [])
|
||||
.filter((s) => s.floorId === activeLevelId)
|
||||
.map((s) => s.id);
|
||||
const roomIds = (project.rooms ?? [])
|
||||
.filter((r) => r.floorId === activeLevelId)
|
||||
.map((r) => r.id);
|
||||
const extrudedSolidIds = (project.extrudedSolids ?? [])
|
||||
.filter((s) => s.levelId === activeLevelId)
|
||||
.map((s) => s.id);
|
||||
const columnIds = (project.columns ?? [])
|
||||
.filter((c) => c.floorId === activeLevelId)
|
||||
.map((c) => c.id);
|
||||
const roofIds = (project.roofs ?? [])
|
||||
.filter((r) => r.floorId === activeLevelId)
|
||||
.map((r) => r.id);
|
||||
// Schnittführungs-Symbole sind projektweit (kein floorId-Bezug — sie
|
||||
// werden auf JEDEM Grundriss gezeichnet, s. plan/context.rs im Kern,
|
||||
// plan_section_lines), anders als die übrigen, geschossgefilterten Kanäle.
|
||||
const sectionLineIds = project.drawingLevels
|
||||
.filter((l) => (l.kind === "section" || l.kind === "elevation") && l.linePoints)
|
||||
.map((l) => l.id);
|
||||
// Kontext-Objekte (importierte Gebäude/Terrain) sind ebenfalls
|
||||
// projektweit, aber bewusst NICHT Teil von „Alles auswählen" — anders
|
||||
// als Schnittlinien sind sie Hintergrund-/Referenzgeometrie, kein
|
||||
// Geschossinhalt; ein versehentliches Löschen wäre riskanter als
|
||||
// hilfreich. Bleibt daher unverändert (kein Clear, kein Select).
|
||||
if (
|
||||
wallIds.length ||
|
||||
drawingIds.length ||
|
||||
ceilingIds.length ||
|
||||
openingIds.length ||
|
||||
stairIds.length ||
|
||||
roomIds.length ||
|
||||
extrudedSolidIds.length ||
|
||||
columnIds.length ||
|
||||
roofIds.length ||
|
||||
sectionLineIds.length
|
||||
) {
|
||||
setSelection({
|
||||
walls: wallIds,
|
||||
drawings: drawingIds,
|
||||
ceilings: ceilingIds,
|
||||
openings: openingIds,
|
||||
stairs: stairIds,
|
||||
rooms: roomIds,
|
||||
solids: extrudedSolidIds,
|
||||
columns: columnIds,
|
||||
roofs: roofIds,
|
||||
sectionLines: sectionLineIds,
|
||||
});
|
||||
const ids = selectAllIds(project, activeLevelId);
|
||||
if (selectAllHasAny(ids)) {
|
||||
setSelection(ids);
|
||||
e.preventDefault();
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -150,8 +150,14 @@ export function useSelectionCommands(opts: {
|
||||
const ctxids = new Set(selection.contextObjects);
|
||||
// [149] Bäume (gesperrte bleiben).
|
||||
const treeids = new Set(selection.trees.filter((id) => !(project.trees ?? []).find((t) => t.id === id)?.locked));
|
||||
// [193] Abgeleitete Lage-Darstellung (Schatten, Baurecht) ist kein Element: Entf blendet sie aus
|
||||
// (`show: false`; über die Lage-Panels wieder einschaltbar).
|
||||
const siteHide: ReturnType<typeof fieldOps> = [];
|
||||
if (selection.site.includes("sunStudy") && project.sunStudy?.show) siteHide.push(...fieldOps(project, "sunStudy", { ...project.sunStudy, show: false }));
|
||||
if (selection.site.includes("siteRules") && project.siteRules && project.siteRules.show !== false) siteHide.push(...fieldOps(project, "siteRules", { ...project.siteRules, show: false }));
|
||||
setProject(
|
||||
opsMutation((p) => [
|
||||
...siteHide,
|
||||
...removeItems(p, "drawings2d", dids),
|
||||
...removeItems(p, "walls", wids),
|
||||
...removeItems(p, "ceilings", cids),
|
||||
|
||||
@@ -55,6 +55,8 @@ export interface TransformSelection {
|
||||
openingIds?: string[];
|
||||
/** [149] Gewählte Bäume (Stammmitte wird transformiert). */
|
||||
treeIds?: string[];
|
||||
/** [193] Gewählte Gelände-/Umgebungs-Elemente (alle Punkte x/y werden abgebildet). */
|
||||
contextIds?: string[];
|
||||
}
|
||||
|
||||
/** Auswahl (Befehlskontext) → TransformSelection (gleiche Form, alle Elementarten). */
|
||||
@@ -71,6 +73,7 @@ export function toTransformSel(sel: CommandSelection): TransformSelection {
|
||||
roomIds: sel.roomIds,
|
||||
openingIds: sel.openingIds,
|
||||
treeIds: sel.treeIds,
|
||||
contextIds: sel.contextIds,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -91,7 +94,8 @@ export function hasTransformSelection(sel: CommandSelection, op?: string): boole
|
||||
(sel.roofIds?.length ?? 0) > 0 ||
|
||||
(sel.stairIds?.length ?? 0) > 0 ||
|
||||
(sel.roomIds?.length ?? 0) > 0 ||
|
||||
(sel.treeIds?.length ?? 0) > 0
|
||||
(sel.treeIds?.length ?? 0) > 0 ||
|
||||
(sel.contextIds?.length ?? 0) > 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -255,9 +255,12 @@ export function usePlanPicking(inp: UsePlanPickingArgs) {
|
||||
|
||||
// [137] Getroffene Lage-Darstellung: Quelle `"sunStudy"`/`"siteRules"` (Baurechtslinie vor Schatten) oder null.
|
||||
const pickSiteAt = (clientX: number, clientY: number): string | null => {
|
||||
const ids = contextIdsAt(clientX, clientY).filter((id) => id.startsWith("@") && !id.startsWith(TREE_PICK));
|
||||
const id = ids.find((x) => x === "@siteRules") ?? ids[0];
|
||||
return id ? id.slice(1) : null;
|
||||
const all = contextIdsAt(clientX, clientY).filter((id) => !id.startsWith(TREE_PICK));
|
||||
// [193] Liegt ein Kontext-Element (Baugrube, Netz) über der Schattenfläche, gehört der Klick ihm — sonst wäre
|
||||
// die Baugrube unter dem Schatten des Hauses nicht anzuwählen. Die Baurechtslinie (unsichtbares Band) gewinnt immer.
|
||||
if (all.includes("@siteRules")) return "siteRules";
|
||||
const top = all[0];
|
||||
return top && top.startsWith("@") ? top.slice(1) : null;
|
||||
};
|
||||
|
||||
// [149] Getroffener Baum (oberste Kronenfläche) oder null.
|
||||
|
||||
Reference in new issue
Block a user