[137] e2e: Gelände und Schatten im Musterhaus komplex anwählen und bearbeiten; leere 2D-Kontur unter Gelände-Band

This commit is contained in:
Claude committed 2026-11-05 12:16:24 +00:00
1 parent b2e4051e8a
commit 056043c421
2 files changed
+76 -1

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
// [137] Alles Sichtbare anwählbar (Mac-Befund: „Schatten und gewachsenes Terrain lassen sich nicht anwählen
// und bearbeiten"): im Musterhaus komplex das Gelände (Situation 1:500) und einen Schatten (EG 1:100) per
// Klick in den Plan wählen; die Objekt-Info zeigt ihre Einstellungen, je eine wird geändert und rückgängig
// gemacht. Gepickt wird im Kern auf dem Plan-Puffer (headless ok); Bildschirm-Punkte aus der viewBox-
// Abbildung des SVG-Overlays wie in `kataster.spec.ts`.
import type { Page } from "@playwright/test";
import { blurFocus, discardIfAsked, expect, fileMenu, openTab, showSnapshot, startNewProject, test } from "./app";
async function clickModel(page: Page, x: number, y: number): Promise<void> {
const p = await page.locator("svg.plan-svg").first().evaluate(
(el, [x, y]) => {
const [vx, vy, vw, vh] = el.getAttribute("viewBox")!.split(/\s+/).map(Number);
const ox = Number(el.getAttribute("data-origin-x") ?? 0);
const oy = Number(el.getAttribute("data-origin-y") ?? 0);
const r = el.getBoundingClientRect();
const s = Math.min(r.width / vw, r.height / vh);
return { x: r.left + (r.width - vw * s) / 2 + (x * 90 - ox - vx) * s, y: r.top + (r.height - vh * s) / 2 + (-y * 90 - oy - vy) * s };
},
[x, y],
);
await page.mouse.click(p.x, p.y);
}
const objInfo = (page: Page) => page.locator(".objinfo-panel").first();
test("Musterhaus komplex: Gelände und Schatten anwählen und bearbeiten (mit Undo)", async ({ page }) => {
test.setTimeout(120_000);
await startNewProject(page);
await fileMenu(page, /Musterhaus \(komplex\)/);
await discardIfAsked(page);
await expect(page.locator(".project-name")).toHaveText("Musterhaus komplex", { timeout: 30_000 });
await openTab(page, "Objekt-Info");
// Gelände: Situation 1:500, Klick in den Garten (Südwest, innerhalb der Parzelle, weg von Linien).
await showSnapshot(page, "Situation 1:500");
await expect(page.locator("svg.plan-svg").first()).toBeVisible({ timeout: 30_000 });
const smooth = objInfo(page).getByTestId("terrain-smooth");
await expect(async () => {
await page.keyboard.press("Escape");
await clickModel(page, -12, -10);
await expect(smooth).toBeVisible({ timeout: 1000 });
}).toPass({ timeout: 30_000 });
await expect(objInfo(page)).toContainText("Gelände");
await expect(objInfo(page).getByTestId("terrain-visible")).toBeChecked();
await expect(smooth).toHaveValue("2");
await smooth.selectOption("0");
await expect(smooth).toHaveValue("0");
await blurFocus(page);
await page.keyboard.press("ControlOrMeta+z");
await expect(smooth).toHaveValue("2");
// Schatten: EG 1:100, Klick nördlich des Eingangs (Schlagschatten am 21. Juni, 10 Uhr).
await showSnapshot(page, "EG 1:100");
await openTab(page, "Objekt-Info");
const time = objInfo(page).locator(".sun-time");
await expect(async () => {
await page.keyboard.press("Escape");
await clickModel(page, 0, 15);
await expect(time).toBeVisible({ timeout: 1000 });
}).toPass({ timeout: 30_000 });
await expect(objInfo(page)).toContainText("Schatten (Sonnenstand)");
await expect(time).toHaveText("10:00");
await objInfo(page).getByRole("slider", { name: "Uhrzeit" }).fill("840");
await expect(time).toHaveText("14:00");
await blurFocus(page);
await page.keyboard.press("ControlOrMeta+z");
await expect(time).toHaveText("10:00");
});
+8 -1
View File
@@ -1420,12 +1420,19 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
// (Gelände in der Ansicht) verdeckt dagegen wie bisher.
const hitTest = (clientX: number, clientY: number): number | null => {
const v = clientToView(clientX, clientY, view);
// Unter einem Gelände-/Baugruben-Band zählt die leere Innenfläche einer 2D-Kontur (z. B. Parzelle) nicht:
// dort meint der Klick das Gelände (die Kontur bleibt über ihre Linie wählbar) — wie vor [137].
const pick = getPick();
let underBand = false;
for (const i of pick.polygonsAt(viewToModel(v.x, v.y))) {
const p = pick.prim(i);
if (p?.kind !== "polygon") continue;
if (p.wallId || p.drawingId || p.ceilingId || p.openingId || p.stairId || p.roomId || p.extrudedSolidId || p.columnId || p.roofId) return i;
if (p.wallId || p.drawingId || p.ceilingId || p.openingId || p.stairId || p.roomId || p.extrudedSolidId || p.columnId || p.roofId) {
const emptyArea = p.drawingId && p.fill === "none" && (!p.hatch || p.hatch.pattern === "none");
return underBand && emptyArea ? null : i;
}
if ((p.contextObjectId || p.sectionLineId) && p.fill !== "none") return i;
if (p.contextObjectId && !p.contextObjectId.startsWith("@")) underBand = true;
}
return null;
};