// Abschnitt „Schnitt-/Ansichtslinie" der Attribute ([165] aus `ObjectInfoPanel.tsx`): Name, Art, Tiefe, // Umkehren, Höhenmarken, Plan-Unterlage. Gerufen von `AttributesPanel`. import type { DrawingLevel, Vec2 } from "../../model/types"; import { usePanelHost } from "../host"; import { t } from "../../i18n"; import type { TranslationKey } from "../../i18n"; import { Dropdown } from "../../ui/Dropdown"; // ── Schnitt-/Ansichtslinien-Abschnitt (Object-Info; nur die gewählte Linie) ── // Name (editierbar), Blickrichtung umkehren (directionSign-Flip), Endpunkt- // Koordinaten (editierbar) + Schnitt-Tiefe; Löschen setzt linePoints zurück // (die Ebene bleibt bestehen). Eine Schnittlinie ist KEIN Projekt-Bauteil, // darum kommt sie über `host.sectionLine` (nicht über `selection`). export function SectionLineSection({ level, host, }: { level: DrawingLevel; host: ReturnType; }) { const line = level.linePoints; const kindLabel = level.kind === "elevation" ? t("objinfo.sectionLine.kind.elevation") : t("objinfo.sectionLine.kind.section"); const patchPoint = (which: 0 | 1, axis: "x" | "y", value: number) => { if (!line) return; const next: [Vec2, Vec2] = [{ ...line[0] }, { ...line[1] }]; next[which] = { ...next[which], [axis]: value }; host.onSetSectionLinePatch({ linePoints: next }); }; const coordField = (labelKey: TranslationKey, value: number, on: (v: number) => void) => (
{t(labelKey)} { const v = Number(e.target.value); if (Number.isFinite(v)) on(v); }} title={t(labelKey)} />
); return ( <>
{t("objinfo.sectionLine.section")} · {kindLabel}
{/* Name (editierbar). */}
{t("objinfo.sectionLine.name")} host.onSetSectionLinePatch({ name: e.target.value })} title={t("objinfo.sectionLine.name")} />
{/* Blickrichtung umkehren (directionSign-Flip). */} {/* 3D-Live-Schnitt an diese Linie binden (nur mit gesetzter Linie sinnvoll): der Viewport clippt dann vertikal entlang dieser Ebene. */} {line && (
{t("objinfo.sectionLine.cut3d")} host.onToggleSection3dCut(level.id)} title={t("objinfo.sectionLine.cut3d")} />
)} {/* Endpunkt-Koordinaten (nur wenn eine Linie gesetzt ist). */} {line && ( <> {coordField("objinfo.sectionLine.startX", line[0].x, (v) => patchPoint(0, "x", v))} {coordField("objinfo.sectionLine.startY", line[0].y, (v) => patchPoint(0, "y", v))} {coordField("objinfo.sectionLine.endX", line[1].x, (v) => patchPoint(1, "x", v))} {coordField("objinfo.sectionLine.endY", line[1].y, (v) => patchPoint(1, "y", v))} )} {/* Schnitt-Tiefe (leer = unbegrenzt). */}
{t("objinfo.sectionLine.depth")} { const raw = e.target.value.trim(); if (raw === "") { host.onSetSectionLinePatch({ depth: undefined }); return; } const v = Number(raw); if (Number.isFinite(v) && v > 0) host.onSetSectionLinePatch({ depth: v }); }} title={t("objinfo.sectionLine.depth")} />
{/* Verdeckte Kanten (gestrichelt) — Default aus (blasses Liniengewirr). */}
{t("objinfo.sectionLine.hiddenLines")} host.onSetSectionLinePatch({ hiddenLines: e.target.checked })} title={t("objinfo.sectionLine.hiddenLines")} />
{/* Automatische Höhenkoten (Geschosse + oberste Kante). */}
{t("objinfo.sectionLine.levelMarks")} host.onSetSectionLinePatch({ levelMarks: e.target.checked ? undefined : false })} title={t("objinfo.sectionLine.levelMarks")} />
{/* Grundriss-Unterlage: ein Geschoss ausgerichtet unter dem Schnitt/der Ansicht. */} {line && (
{t("objinfo.sectionLine.planUnderlay")} host.onSetSectionLinePatch({ planUnderlayId: v || undefined })} options={[ { value: "", label: t("objinfo.sectionLine.planUnderlay.none") }, ...host.project.drawingLevels .filter((l) => l.kind === "floor") .map((l) => ({ value: l.id, label: l.name })), ]} title={t("objinfo.sectionLine.planUnderlay")} width={150} />
)} {/* Löschen: linePoints zurücksetzen (die Ebene bleibt bestehen). */} ); }