Merge branch 'worktree-agent-a6f7a4e60c2896563' into claude/practical-noether-1hb2s1
This commit is contained in:
16 files changed
+213
-27
No files matched your search
@@ -196,6 +196,7 @@ export function FloatingPanel({
|
||||
ctx={ctx}
|
||||
displayMode={displayMode}
|
||||
onDisplayModeChange={onDisplayModeChange}
|
||||
showTitle={false}
|
||||
/>
|
||||
) : (
|
||||
<div className="panel-frame panel-frame-empty" />
|
||||
|
||||
@@ -33,6 +33,7 @@ import { SiteRulesSection } from "./SiteRulesSection";
|
||||
import { TreeSection } from "./objectInfo/TreeSection";
|
||||
import { ViewShadowsInfo, MeasurementSection } from "./objectInfo/InfoBlocks";
|
||||
import { DimensionField, RotateField } from "./objectInfo/fields";
|
||||
import { elementDimensions } from "./objectInfo/elementDims";
|
||||
import { InfoGroups, hasInfoGroups } from "./objectInfo/InfoGroups";
|
||||
|
||||
// ── Bezugspunkt-Raster ───────────────────────────────────────────────────────
|
||||
@@ -106,6 +107,7 @@ export function ObjectInfoPanel() {
|
||||
}
|
||||
|
||||
const { bbox } = sel;
|
||||
const elementDims = elementDimensions(sel);
|
||||
const width = bbox.maxX - bbox.minX;
|
||||
const height = bbox.maxY - bbox.minY;
|
||||
|
||||
@@ -244,18 +246,30 @@ export function ObjectInfoPanel() {
|
||||
|
||||
{/* Maße (editierbar) — Commit auf blur/Enter skaliert um den Anker. */}
|
||||
<div className="objinfo-section-label">{t("objinfo.dimensions")}</div>
|
||||
<DimensionField
|
||||
label={t("objinfo.width")}
|
||||
value={len(width)}
|
||||
{...lenProps}
|
||||
onCommit={(w) => commitSize(unlen(w), height)}
|
||||
/>
|
||||
<DimensionField
|
||||
label={t("objinfo.height")}
|
||||
value={len(height)}
|
||||
{...lenProps}
|
||||
onCommit={(h) => commitSize(width, unlen(h))}
|
||||
/>
|
||||
{elementDims ? (
|
||||
// [204a] Wand: Länge/Dicke/Höhe, Öffnung: Breite/Höhe/Brüstung (nur Anzeige).
|
||||
elementDims.map((d) => (
|
||||
<div className="objinfo-field" key={d.label} data-testid="objinfo-dim">
|
||||
<span className="objinfo-flabel">{t(d.label)}</span>
|
||||
<span className="objinfo-fval">{len(d.value).toFixed(u.digits)} {u.suffix}</span>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<>
|
||||
<DimensionField
|
||||
label={t("objinfo.width")}
|
||||
value={len(width)}
|
||||
{...lenProps}
|
||||
onCommit={(w) => commitSize(unlen(w), height)}
|
||||
/>
|
||||
<DimensionField
|
||||
label={t("objinfo.height")}
|
||||
value={len(height)}
|
||||
{...lenProps}
|
||||
onCommit={(h) => commitSize(width, unlen(h))}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{/* Formspezifische Zusatzfelder (nur wenn das Modell den Wert direkt
|
||||
hergibt — andere Formen bleiben ohne Zusatzfeld, s. Dateikopf). */}
|
||||
{drawingShape === "line" && rawDrawing?.geom.shape === "line" && (
|
||||
|
||||
@@ -31,6 +31,8 @@ export interface PanelFrameProps {
|
||||
* `hasDisplayMode`, zeigt die Kopfzeile das Dropdown.
|
||||
*/
|
||||
onDisplayModeChange?: (mode: DisplayMode) => void;
|
||||
/** Titel in der Kopfzeile zeigen (false im schwebenden Fenster, dessen Titelleiste ihn schon trägt). */
|
||||
showTitle?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,6 +45,7 @@ export function PanelFrame({
|
||||
ctx,
|
||||
displayMode,
|
||||
onDisplayModeChange,
|
||||
showTitle = true,
|
||||
}: PanelFrameProps) {
|
||||
// Umschalter nur, wenn das Panel ihn will UND er verdrahtet ist.
|
||||
const showMode =
|
||||
@@ -52,8 +55,9 @@ export function PanelFrame({
|
||||
|
||||
return (
|
||||
<section className="panel-frame">
|
||||
{(showTitle || def.headerActions || showMode) && (
|
||||
<header className="panel-head">
|
||||
<span className="panel-title">{t(def.title)}</span>
|
||||
{showTitle ? <span className="panel-title">{t(def.title)}</span> : <span />}
|
||||
<span className="panel-head-actions">
|
||||
{def.headerActions}
|
||||
{showMode && (
|
||||
@@ -64,6 +68,7 @@ export function PanelFrame({
|
||||
)}
|
||||
</span>
|
||||
</header>
|
||||
)}
|
||||
<div className="panel-body">{def.render(ctx ?? {})}</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
@@ -22,6 +22,7 @@ export function SectionLineSection({
|
||||
}) {
|
||||
const storeProject = useStore((st) => st.project);
|
||||
const line = level.linePoints;
|
||||
const isElev = level.kind === "elevation";
|
||||
const kindLabel =
|
||||
level.kind === "elevation"
|
||||
? t("objinfo.sectionLine.kind.elevation")
|
||||
@@ -52,7 +53,7 @@ export function SectionLineSection({
|
||||
<>
|
||||
<div className="objinfo-sep" />
|
||||
<div className="objinfo-section-label">
|
||||
{t("objinfo.sectionLine.section")} · {kindLabel}
|
||||
{t(isElev ? "objinfo.sectionLine.section.elevation" : "objinfo.sectionLine.section")} · {kindLabel}
|
||||
</div>
|
||||
|
||||
{/* Name (editierbar). */}
|
||||
@@ -106,7 +107,7 @@ export function SectionLineSection({
|
||||
|
||||
{/* Schnitt-Tiefe (leer = unbegrenzt). */}
|
||||
<div className="objinfo-field">
|
||||
<span className="objinfo-flabel">{t("objinfo.sectionLine.depth")}</span>
|
||||
<span className="objinfo-flabel">{t(isElev ? "objinfo.sectionLine.depth.elevation" : "objinfo.sectionLine.depth")}</span>
|
||||
<input
|
||||
type="number"
|
||||
className="objinfo-text"
|
||||
@@ -123,7 +124,7 @@ export function SectionLineSection({
|
||||
const v = Number(raw);
|
||||
if (Number.isFinite(v) && v > 0) host.onSetSectionLinePatch({ depth: v });
|
||||
}}
|
||||
title={t("objinfo.sectionLine.depth")}
|
||||
title={t(isElev ? "objinfo.sectionLine.depth.elevation" : "objinfo.sectionLine.depth")}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -188,7 +189,7 @@ export function SectionLineSection({
|
||||
|
||||
{/* Löschen: linePoints zurücksetzen (die Ebene bleibt bestehen). */}
|
||||
<button type="button" className="objinfo-btn" onClick={() => host.onDeleteSectionLine()}>
|
||||
{t("objinfo.sectionLine.delete")}
|
||||
{t(isElev ? "objinfo.sectionLine.delete.elevation" : "objinfo.sectionLine.delete")}
|
||||
</button>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { elementDimensions } from "./elementDims";
|
||||
import { deriveSelection } from "../../state/selectionInfo";
|
||||
import { sampleProject } from "../../model/sampleProject";
|
||||
|
||||
describe("elementDimensions [204a]", () => {
|
||||
const p = structuredClone(sampleProject);
|
||||
it("Wand: Länge, Dicke, Höhe statt Achs-Rechteck", () => {
|
||||
const w = p.walls[0];
|
||||
const d = elementDimensions(deriveSelection(p, { walls: [w.id] })!)!;
|
||||
expect(d.map((x) => x.label)).toEqual(["objinfo.wall.length", "objinfo.wall.thickness", "objinfo.wall.height"]);
|
||||
expect(d[1].value).toBeGreaterThan(0);
|
||||
expect(d[2].value).toBeGreaterThan(1);
|
||||
});
|
||||
it("Öffnung: Breite, Höhe, Brüstung (nicht die Wanddicke)", () => {
|
||||
const o = p.openings![0];
|
||||
const d = elementDimensions(deriveSelection(p, { openings: [o.id] })!)!;
|
||||
expect(d.map((x) => x.label)).toEqual(["objinfo.opening.width", "objinfo.opening.height", "objinfo.opening.sill"]);
|
||||
expect(d[0].value).toBe(o.width);
|
||||
expect(d[1].value).toBe(o.height);
|
||||
});
|
||||
it("Zeichnung: generisch", () => {
|
||||
const sel = deriveSelection(p, { drawings: p.drawings2d.slice(0, 1).map((x) => x.id) });
|
||||
if (sel) expect(elementDimensions(sel)).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
// [204a] Masse je Element-Art für den Abschnitt „Maße" der Objekt-Info. Die Bounding-Box taugt nur für
|
||||
// freie Formen: bei einer Wand ist sie das Rechteck der Achse (Breite 0 bei senkrechter Wand), bei einer
|
||||
// Öffnung die Lücke im Wandgrundriss (Höhe = Wanddicke). Darum zeigen Wand und Öffnung ihre echten
|
||||
// Masse (nur Anzeige; geändert wird in den Bauteil-Abschnitten).
|
||||
|
||||
import type { TranslationKey } from "../../i18n";
|
||||
import type { SelectionInfo } from "../../state/selectionInfo";
|
||||
|
||||
export interface ElementDim {
|
||||
label: TranslationKey;
|
||||
/** Meter. */
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** Sinnvolle Masse der Art, `null` = generische Bounding-Box-Breite/-Höhe. */
|
||||
export function elementDimensions(sel: SelectionInfo): ElementDim[] | null {
|
||||
if (sel.kind === "wall" && sel.wall) {
|
||||
const w = sel.wall;
|
||||
return [
|
||||
{ label: "objinfo.wall.length", value: w.length },
|
||||
{ label: "objinfo.wall.thickness", value: w.thickness },
|
||||
{ label: "objinfo.wall.height", value: w.zTop - w.zBottom },
|
||||
];
|
||||
}
|
||||
if (sel.kind === "opening" && sel.opening) {
|
||||
const o = sel.opening;
|
||||
return [
|
||||
{ label: "objinfo.opening.width", value: o.width },
|
||||
{ label: "objinfo.opening.height", value: o.height },
|
||||
{ label: "objinfo.opening.sill", value: o.sillHeight },
|
||||
];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
Reference in new issue
Block a user