Merge branch 'worktree-agent-a56cf9cc6c67c09b4' into claude/practical-noether-1hb2s1
This commit is contained in:
37 files changed
+301
-81
No files matched your search
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { defaultViewFor, MIN_FIT_EXTENT_M, PAD, PX_PER_M, type ModelRect } from "./geometry";
|
||||
import { defaultViewFor, HOUSE_FIT_EXTENT_M, MIN_FIT_EXTENT_M, PAD, PX_PER_M, type ModelRect } from "./geometry";
|
||||
import type { Primitive } from "../generatePlan";
|
||||
import { PlanPickIndex } from "./planPick";
|
||||
|
||||
@@ -120,6 +120,11 @@ describe("defaultViewFor [147]", () => {
|
||||
expect(v.x + v.w / 2).toBeCloseTo(0.5 * PX_PER_M);
|
||||
expect(v.y + v.h / 2).toBeCloseTo(-0.5 * PX_PER_M);
|
||||
});
|
||||
it("[263] kleines Haus (5 × 4 m): Mindestausschnitt 8 m statt 30 m, das Haus füllt über die Hälfte", () => {
|
||||
const v = defaultViewFor({ minX: 0, minY: 0, maxX: 5, maxY: 4 }, PAD, HOUSE_FIT_EXTENT_M);
|
||||
expect(v.w).toBeCloseTo(HOUSE_FIT_EXTENT_M * PX_PER_M + 2 * PAD);
|
||||
expect(5 * PX_PER_M / v.w).toBeGreaterThan(0.5);
|
||||
});
|
||||
it("ungültige Grenzen (NaN/Infinity) → endlicher Standardausschnitt", () => {
|
||||
const v = defaultViewFor({ minX: NaN, minY: 0, maxX: Infinity, maxY: 1 });
|
||||
expect([v.x, v.y, v.w, v.h].every(Number.isFinite)).toBe(true);
|
||||
|
||||
@@ -16,6 +16,8 @@ export const PX_PER_M = 90; // viewBox-Einheiten je Meter (Modell → SVG-Benutz
|
||||
export const PAD = 60; // Rand in viewBox-Einheiten
|
||||
/** Kleinste Kantenlänge (m) des Einpass-Bereichs: leeres/winziges Modell öffnet bei ca. 1:100 statt extrem nah ([147]). */
|
||||
export const MIN_FIT_EXTENT_M = 30;
|
||||
/** [263] Kleinster Einpass-Bereich (m), sobald Bauteile da sind: ein Haus von 5 m soll den Bildschirm füllen, nicht 1/6 davon. */
|
||||
export const HOUSE_FIT_EXTENT_M = 8;
|
||||
|
||||
/**
|
||||
* Modell-Meter → SVG-Benutzerraum (viewBox-Einheiten) mit FIXEM Welt-Ursprung
|
||||
|
||||
Reference in new issue
Block a user