[131] Geschoss-Editor: OK fertig Boden direkt eintippen (Geschosshöhe darunter bzw. eigene passt sich an)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
Claude committed 2026-11-04 12:07:58 +00:00
1 parent 8e2c57fb63
commit 76bae648ba
6 files changed
+80 -4

No files matched your search

+1 -1
View File
@@ -2199,7 +2199,7 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]).
Dach-Triangulierung; Grundrisse: Schatten/Baurecht jetzt im EG als Geschoss nächst ±0.00). Tests: cargo
(`levels`, Format 5, Koten), vitest `layers.test.ts`, `sampleProjectComplex.test.ts`, e2e `levelZero.spec.ts`
(Bezug wählen → EG −2.60, Höhe ändern, Undo), `sectionViews.spec.ts`. Geprüft: Screenshot Schnitt A-A im Browser
(Linux). Offen: Höhe eines Geschosses direkt eintippen (heute nur über Bezug + Geschosshöhen), Umordnen der Ebenen
(Linux). 4.11.: Höhe direkt eintippen (Geschoss-Editor; über ±0.00 passt sich die Geschosshöhe darunter an, darunter die eigene; `elevationFix`, vitest + e2e). Umordnen der Ebenen
ändert die Höhen nicht mehr (Stapel nach bisheriger Höhe, 4.11.), nicht in der Tauri-App geprüft. · S
- ◐ **[132] Ansichten/Schnitte aus [114].** (4.11.) Flachdächer zeigen in Ansicht und Schnitt ihre Stirn als Band
(`elevation::fascia_quads`, Aufbaudicke); Stützen erscheinen in Ansichten als Prismen (`collect_column_faces`, runde
+10 -2
View File
@@ -25,15 +25,23 @@ test("Geschoss als ±0.00 wählen: Erdgeschoss liegt danach negativ", async ({ p
await page.keyboard.press("Escape");
await page.locator(".nav-row", { hasText: "Erdgeschoss" }).first().click({ button: "right" });
await page.getByText("Einstellungen…", { exact: true }).click();
const h = page.locator(".editor-num input[type=number]").first();
const h = page.locator(".editor-num input[type=number]:not([data-testid])").first();
await h.fill("2.8");
await expect(egElev).toHaveText("−2.80");
await expect(ogElev).toHaveText("±0.00");
// Höhe direkt eintippen: unter ±0.00 passt sich die eigene Geschosshöhe an.
const z = page.getByTestId("level-elevation-input");
await z.fill("-3");
await z.press("Enter");
await expect(egElev).toHaveText("−3.00");
await expect(ogElev).toHaveText("±0.00");
await page.keyboard.press("Escape");
// Undo: Höhe zurück, dann Bezug zurück (ein Schritt) → EG wieder ±0.00.
// Undo: eingetippte Höhe zurück, Geschosshöhe zurück, dann Bezug zurück (ein Schritt) → EG wieder ±0.00.
await blurFocus(page);
await page.keyboard.press("ControlOrMeta+z");
await expect(egElev).toHaveText("−2.80");
await page.keyboard.press("ControlOrMeta+z");
await expect(egElev).toHaveText("−2.60");
await page.keyboard.press("ControlOrMeta+z");
await expect(egElev).toHaveText("±0.00");
+1
View File
@@ -1014,6 +1014,7 @@ export const de = {
"editor.floorHeight": "Geschosshöhe",
"editor.cutHeight": "Schnitthöhe",
"editor.levelElevation": "OK fertig Boden",
"editor.levelElevation.hint": "Höhe relativ zu ±0.00 eintippen; die Geschosshöhe darunter (unter ±0.00: die eigene) passt sich an",
"editor.zeroLevel": "Bezug ±0.00",
"editor.zeroLevel.hint": "Dieses Geschoss liegt auf ±0.00; Geschosse darunter erhalten negative Höhen.",
"editor.viewTop": "Oberkante Sicht",
+1
View File
@@ -1008,6 +1008,7 @@ export const en: Record<TranslationKey, string> = {
"editor.floorHeight": "Floor height",
"editor.cutHeight": "Cut height",
"editor.levelElevation": "Finished floor level",
"editor.levelElevation.hint": "Type the level relative to ±0.00; the storey height below (below ±0.00: its own) adapts",
"editor.zeroLevel": "Datum ±0.00",
"editor.zeroLevel.hint": "This storey is at ±0.00; storeys below get negative elevations.",
"editor.viewTop": "View top",
+22
View File
@@ -0,0 +1,22 @@
import { describe, expect, it } from "vitest";
import type { DrawingLevel } from "../model/types";
import { elevationFix } from "./InlineEditors";
const lv = (id: string, base: number, h: number, zero = false) =>
({ id, name: id, kind: "floor", visible: true, locked: false, baseElevation: base, floorHeight: h, ...(zero ? { zeroLevel: true } : {}) }) as unknown as DrawingLevel;
const levels = [lv("ug", -2.7, 2.7), lv("eg", 0, 2.9, true), lv("og", 2.9, 2.8)];
describe("[131] Geschosshöhe direkt setzen", () => {
it("über ±0.00: Geschosshöhe darunter passt sich an", () => {
expect(elevationFix(levels, "og", 3.1)).toEqual({ id: "eg", floorHeight: 3.1 });
});
it("unter ±0.00: eigene Geschosshöhe passt sich an", () => {
expect(elevationFix(levels, "ug", -3)).toEqual({ id: "ug", floorHeight: 3 });
});
it("Bezugsgeschoss, gleiche Höhe und Unsinn: nichts", () => {
expect(elevationFix(levels, "eg", 1)).toBeNull();
expect(elevationFix(levels, "og", 2.9)).toBeNull();
expect(elevationFix(levels, "og", -1)).toBeNull();
expect(elevationFix(levels, "og", Number.NaN)).toBeNull();
});
});
+45 -1
View File
@@ -116,6 +116,29 @@ function isZeroLevel(levels: readonly DrawingLevel[], id: string): boolean {
return (floors.find((z) => z.zeroLevel) ?? floors[0])?.id === id;
}
/**
* [131] Höhe eines Geschosses direkt setzen: Über ±0.00 wird die Geschosshöhe des Geschosses darunter angepasst,
* unter ±0.00 die eigene (Abstand zum Geschoss darüber). Liefert die Änderung oder `null` bei Unsinn
* (gleiche Höhe, nicht positiv, Bezugsgeschoss).
*/
export function elevationFix(levels: readonly DrawingLevel[], id: string, z: number): { id: string; floorHeight: number } | null {
if (!Number.isFinite(z)) return null;
const floors = levels.filter((l) => l.kind === "floor").slice().sort((a, b) => (a.baseElevation ?? 0) - (b.baseElevation ?? 0));
const i = floors.findIndex((l) => l.id === id);
if (i < 0 || isZeroLevel(levels, id)) return null;
const cur = floors[i].baseElevation ?? 0;
if (Math.abs(z - cur) < 1e-9) return null;
const round = (v: number) => Math.round(v * 1e6) / 1e6;
if (cur > 0) {
const below = floors[i - 1];
const h = round(z - (below?.baseElevation ?? 0));
return below && h > 0 ? { id: below.id, floorHeight: h } : null;
}
const above = floors[i + 1];
const h = round((above?.baseElevation ?? 0) - z);
return above && h > 0 ? { id, floorHeight: h } : null;
}
export function LevelInlineEditor({
editor,
onClose,
@@ -149,7 +172,28 @@ export function LevelInlineEditor({
{/* [131] OK fertig Boden relativ zu ±0.00 (aus dem Stapel); ein Geschoss ist der Bezug. */}
<EditorField label={t("editor.levelElevation")}>
<span className="editor-num">
<span data-testid="level-elevation">{formatElevation(level.baseElevation ?? 0)}</span>
{isZeroLevel(project.drawingLevels, level.id) ? (
<span data-testid="level-elevation">{formatElevation(level.baseElevation ?? 0)}</span>
) : (
<input
key={`${level.id}:${level.baseElevation ?? 0}`}
type="number"
step={0.05}
data-testid="level-elevation-input"
title={t("editor.levelElevation.hint")}
defaultValue={Math.round((level.baseElevation ?? 0) * 1000) / 1000}
onKeyDown={(e) => {
if (e.key !== "Enter") return;
e.stopPropagation();
const fix = elevationFix(project.drawingLevels, level.id, Number((e.target as HTMLInputElement).value));
if (fix) patchLevel(fix.id, { floorHeight: fix.floorHeight });
}}
onBlur={(e) => {
const fix = elevationFix(project.drawingLevels, level.id, Number(e.target.value));
if (fix) patchLevel(fix.id, { floorHeight: fix.floorHeight });
}}
/>
)}
<span className="editor-unit">{t("editor.unit.m")}</span>
</span>
</EditorField>