From 826685ceafb55495449b0375e004388bf062afb7 Mon Sep 17 00:00:00 2001 From: Karim Date: Fri, 10 Jul 2026 00:37:32 +0200 Subject: [PATCH] Dach: Grundriss-Masse (Breite/Tiefe) im Panel editierbar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bisher liess sich der Dach-Grundriss nach dem Platzieren nicht mehr in der Grösse ändern. RoofSection bekommt Breite/Tiefe-Felder, die das Umriss- Rechteck neu bilden (untere/linke Ecke bleibt fix). RoofInfo trägt width/depth/minX/minY. tsc + vitest grün. --- src/i18n/de.ts | 2 ++ src/i18n/en.ts | 2 ++ src/panels/ObjectInfoPanel.tsx | 25 +++++++++++++++++++++++++ src/state/selectionInfo.ts | 11 +++++++++++ 4 files changed, 40 insertions(+) diff --git a/src/i18n/de.ts b/src/i18n/de.ts index 87721bf..ee6c99b 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -300,6 +300,8 @@ export const de = { "objinfo.roof.ridgeAxis.y": "entlang Y", "objinfo.roof.pitch": "Neigung (°)", "objinfo.roof.pitchUpper": "Obere Neigung (°)", + "objinfo.roof.width": "Breite (m)", + "objinfo.roof.depth": "Tiefe (m)", "objinfo.roof.overhang": "Überstand (m)", "objinfo.roof.thickness": "Dachdicke (m)", "objinfo.roof.baseElevation": "Traufhöhe (m)", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index cf4764f..817c59c 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -299,6 +299,8 @@ export const en: Record = { "objinfo.roof.ridgeAxis.y": "along Y", "objinfo.roof.pitch": "Pitch (°)", "objinfo.roof.pitchUpper": "Upper pitch (°)", + "objinfo.roof.width": "Width (m)", + "objinfo.roof.depth": "Depth (m)", "objinfo.roof.overhang": "Overhang (m)", "objinfo.roof.thickness": "Roof thickness (m)", "objinfo.roof.baseElevation": "Eaves height (m)", diff --git a/src/panels/ObjectInfoPanel.tsx b/src/panels/ObjectInfoPanel.tsx index 65fb2c6..c5cc154 100644 --- a/src/panels/ObjectInfoPanel.tsx +++ b/src/panels/ObjectInfoPanel.tsx @@ -434,6 +434,16 @@ export function ColumnSection({ // ── Treppen-Attribut-Abschnitt ─────────────────────────────────────────────── // Grundform (gerade/L/Wendel), Laufbreite, Stufenanzahl, Steighöhe (+ abgeleitete // Steigungshöhe/Auftrittstiefe), Laufrichtung; Referenzgeschoss + UK/OK read-only. +/** Rechteck-Umriss (CCW) aus unterer/linker Ecke + Breite/Tiefe (für Dach-Resize). */ +function rectOutline(x0: number, y0: number, w: number, d: number) { + return [ + { x: x0, y: y0 }, + { x: x0 + w, y: y0 }, + { x: x0 + w, y: y0 + d }, + { x: x0, y: y0 + d }, + ]; +} + /** Dach-Abschnitt: Form, Neigung(en), Überstand, Firstrichtung, Dicke. */ export function RoofSection({ roof, @@ -514,6 +524,21 @@ export function RoofSection({ host.onSetRoofPatch({ pitchUpperDeg: Math.max(0, Math.min(85, v)) }), )} + {/* Grundriss-Masse (Breite/Tiefe): das Umriss-Rechteck neu bilden, die + untere/linke Ecke (minX/minY) bleibt fix. */} + {numField("objinfo.roof.width", roof.width, 0.1, (v) => { + const w = Math.max(0.2, v); + host.onSetRoofPatch({ + outline: rectOutline(roof.minX, roof.minY, w, roof.depth), + }); + })} + {numField("objinfo.roof.depth", roof.depth, 0.1, (v) => { + const d = Math.max(0.2, v); + host.onSetRoofPatch({ + outline: rectOutline(roof.minX, roof.minY, roof.width, d), + }); + })} + {/* Überstand + Dicke (Meter). */} {numField("objinfo.roof.overhang", roof.overhang, 0.05, (v) => host.onSetRoofPatch({ overhang: Math.max(0, v) }), diff --git a/src/state/selectionInfo.ts b/src/state/selectionInfo.ts index d6fe9fc..bccab02 100644 --- a/src/state/selectionInfo.ts +++ b/src/state/selectionInfo.ts @@ -92,6 +92,13 @@ export interface RoofInfo { ridgeHeight: number; /** Grundfläche des Umriss-Rechtecks (m², ohne Überstand). */ footprintArea: number; + /** Breite (X-Ausdehnung) des Umriss-Rechtecks (Meter). */ + width: number; + /** Tiefe (Y-Ausdehnung) des Umriss-Rechtecks (Meter). */ + depth: number; + /** Untere/linke Ecke der Bounding-Box (fix beim Breite/Tiefe-Resize). */ + minX: number; + minY: number; } /** @@ -623,6 +630,10 @@ function roofSelection(project: Project, roof: Roof): Selection { baseElevation: eavesZ, ridgeHeight: g.ridgeHeight, footprintArea, + width: Math.abs(bb.x1 - bb.x0), + depth: Math.abs(bb.y1 - bb.y0), + minX: bb.x0, + minY: bb.y0, }; return { kind: "roof",