diff --git a/src/plan/PlanView.tsx b/src/plan/PlanView.tsx index 513a3c5..a4986f4 100644 --- a/src/plan/PlanView.tsx +++ b/src/plan/PlanView.tsx @@ -612,6 +612,8 @@ export interface BodyTarget { openingId?: string; /** Nur im Schnitt/in der Ansicht (`sheetBodies`). */ ceilingId?: string; + /** Nur im Schnitt/in der Ansicht (`sheetBodies`). */ + stairId?: string; } export interface GripHandlers { @@ -1777,6 +1779,9 @@ export const PlanView = forwardRef( if (p && p.kind === "polygon" && p.ceilingId && selectedCeilingIds?.includes(p.ceilingId)) { return { ceilingId: p.ceilingId }; } + if (p && p.kind === "polygon" && p.stairId && selectedStairIds?.includes(p.stairId)) { + return { stairId: p.stairId }; + } } const selWalls = new Set(selectedWallIds ?? []); if (selWalls.size) { diff --git a/src/plan/generatePlan.ts b/src/plan/generatePlan.ts index ce66b9b..908be1e 100644 --- a/src/plan/generatePlan.ts +++ b/src/plan/generatePlan.ts @@ -922,8 +922,9 @@ export function generateSectionPlan( strokeWidthMm: SECTION_CUT_OUTLINE_MM, hatch: mono ? monoHatch : hatch, wallId: kind === "wall" ? sourceId : undefined, - ceilingId: kind === "slab" ? sourceId : undefined, + ceilingId: kind === "slab" && !cp.stairId ? sourceId : undefined, roofId: kind === "roof" ? sourceId : undefined, + stairId: cp.stairId, greyed: cp.categoryCode !== undefined && catDisplay(cp.categoryCode).greyed, }); } diff --git a/src/plan/toSection.ts b/src/plan/toSection.ts index 30cc530..755a9c1 100644 --- a/src/plan/toSection.ts +++ b/src/plan/toSection.ts @@ -95,6 +95,12 @@ export interface SectionCutPolygon { * Grundriss. Fehlt (unauflösbares Bauteil), bleibt das Band immer sichtbar. */ categoryCode?: string; + /** + * Quell-Treppe (Tritt-/Podest-Prisma einer Treppe, s. `emitStairs` — + * `RSlab.ceilingId` trägt dort die Treppen-ID). Macht die geschnittene Treppe + * im Schnitt anwählbar. + */ + stairId?: string; } /** Ein projiziertes Liniensegment in (u, v)-Metern. */ @@ -1213,6 +1219,16 @@ export async function computeSection( // Monolithische Bauteile aus mehreren Prismen (Treppen-Tritte): ihre Schnitt- // Rechtecke zu EINEM Umriss vereinen — sonst je Tritt ein eigenes, // überlappendes Schraffur-Rechteck mit Kontur ("gestapelte Kistchen"). + // Treppen-Prismen: Herkunft + Kategorie nachtragen (attachCutStyles kennt + // nur Decken), damit die geschnittene Treppe anwählbar/filterbar ist. + const stairsById = new Map((project.stairs ?? []).map((st) => [st.id, st])); + for (const cp of output.cutPolygons) { + if (cp.component.kind !== "slab") continue; + const st = stairsById.get(model.slabs[cp.component.index]?.ceilingId ?? ""); + if (!st) continue; + cp.stairId = st.id; + cp.categoryCode = st.categoryCode; + } output.cutPolygons = mergeMonolithCuts(output.cutPolygons, (i) => model.slabs[i]?.monolith); // Schnitt-Tiefe: Kanten weiter als `level.depth` hinter der Ebene ausblenden. if (level.depth !== undefined) filterByDepth(output, project, plane, level.depth); diff --git a/src/state/useGripEditing.ts b/src/state/useGripEditing.ts index 0dc8472..4242722 100644 --- a/src/state/useGripEditing.ts +++ b/src/state/useGripEditing.ts @@ -1124,8 +1124,9 @@ export function useGripEditing(opts: { } const wallId = target ? target.wallId ?? null : selectedWallId; const ceilingId = target ? target.ceilingId ?? null : !wallId ? selectedCeilingId : null; - const kind = wallId ? "wall" : ceilingId ? "ceiling" : null; - const id = wallId ?? ceilingId; + const stairId = target ? target.stairId ?? null : !wallId && !ceilingId ? selectedStairId : null; + const kind = wallId ? "wall" : ceilingId ? "ceiling" : stairId ? "stair" : null; + const id = wallId ?? ceilingId ?? stairId; if (!kind || !id) return; if (kind === "wall" && project.walls.find((w) => w.id === id)?.locked) return; const prevDu = sheetDuRef.current && sheetDuRef.current.id === id ? sheetDuRef.current.du : 0; @@ -1136,7 +1137,7 @@ export function useGripEditing(opts: { if (moveCoincidentRef.current === null) moveCoincidentRef.current = findMoveCoincident2D(null, id); pendingWallMoveRef.current = { wallId: id, total }; } else { - pendingAreaMoveRef.current = { kind: "ceiling", id, total }; + pendingAreaMoveRef.current = { kind, id, total }; } const preview: DraftShape[] = sheetOwnerOutlines(sh.levelId, kind, id).map((pts) => ({ kind: "poly", diff --git a/src/tools/sheetSnapGeometry.ts b/src/tools/sheetSnapGeometry.ts index fc58b53..9a2cf28 100644 --- a/src/tools/sheetSnapGeometry.ts +++ b/src/tools/sheetSnapGeometry.ts @@ -60,7 +60,7 @@ export function snapSegmentsFromPrimitives(prims: readonly Primitive[]): SnapSeg } /** Bauteil-Art, deren Schnittflächen im Blatt gezogen werden können. */ -export type SheetOwnerKind = "wall" | "ceiling" | "opening"; +export type SheetOwnerKind = "wall" | "ceiling" | "opening" | "stair"; /** * Schnittflächen der Ebene `levelId` je Quell-Bauteil ablegen (aus den Plan- @@ -80,6 +80,7 @@ export function setSheetOwnerOutlines(levelId: string, prims: readonly Primitive for (const p of prims) { if (p.kind !== "polygon") continue; if (p.openingId) add(`opening:${p.openingId}`, p.pts); + else if (p.stairId) add(`stair:${p.stairId}`, p.pts); else if (p.wallId) add(`wall:${p.wallId}`, p.pts); else if (p.ceilingId) add(`ceiling:${p.ceilingId}`, p.pts); }