[93] Layout-Blatt: Papier-mm in Linealen/Objekt-Info/HUD, Symbole in Papiergrösse, Fang auf Viewport-Inhalt, DXF-Papierbereich mit Blatt-Zeichnung, PDF-Raumfüllung

- Anzeige-Einheiten (tools/displayUnits.ts): auf der Blatt-Ebene Papier-mm mit y nach unten in Linealen,
  Statusleiste, Objekt-Info, Attribute-Massen, Cursor-HUD und Befehlszeile; getippte Koordinaten/Längen in mm
- Kote, Detailverweis, Punktmarke: feste Grössen auf dem Blatt mit Faktor 1/100 (Papiermass wie bei 1:100)
- Kern-Fang (sheet_viewports.rs, snap_model.rs): Kanten der Viewport-Pläne, abgebildet und geklippt, je Dokument-Stand
- DXF/DWG --layout: je Projekt-Layout ein Papierbereich mit Blatt-Zeichnung (Block) und Ansichtsfenstern (CLI + App)
- Druck-SVG: #rrggbbaa als fill-opacity (svg2pdf füllte Räume deckend dunkel); Geo-Verschieben lässt Blatt-Zeichnungen;
  Objekt-Info: Enter committete doppelt
- Tests: Rust (Kern, fileio), vitest, e2e (mm-Anzeige, Fang auf Viewport-Inhalt)
This commit is contained in:
Claude committed 2026-10-29 22:18:00 +00:00
1 parent d45f318f1e
commit ecacb1e676
31 files changed
+1098 -124

No files matched your search

+6
View File
@@ -43,6 +43,7 @@ import {
import { DraftOverlay } from "./planView/overlays";
import { visibleGripIndices } from "./planView/gripCull";
import { localViewBoxAttr, makeToLocal, pickOverlayOrigin } from "./planView/overlayOrigin";
import type { DisplayUnits } from "../../tools/displayUnits";
import { PlanRulers } from "./planView/PlanRulers";
import { PlanGrid } from "./planView/PlanGrid";
import { expandRegion, indexedInRegion, regionContains, type Bounds } from "../../core";
@@ -587,6 +588,8 @@ export interface PlanViewProps {
* (wie bei Luftbildern), damit er sichtbar bleibt.
*/
backdrop?: (origin: Vec2, pxPerMeter: number) => ReactNode;
/** Anzeige-Einheiten von Linealen und HUD (Layout-Blatt: Papier-mm, y nach unten, [93]). */
units?: DisplayUnits;
/** Einpass-Bereich (Modell-Meter) statt der Plan-Grenzen — z. B. das Blatt. */
fitBounds?: { minX: number; minY: number; maxX: number; maxY: number };
}
@@ -715,6 +718,7 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
hoverDivideDelayMs = 300,
hoverDivideCount = 2,
backdrop,
units,
fitBounds,
},
ref,
@@ -3535,6 +3539,7 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
vbPerPx={1 / meet}
snapColor={snapColor}
hudFields={hudFields ?? null}
units={units}
/>
)}
</LiveMeet>
@@ -3698,6 +3703,7 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
vbPerPx={1 / scale}
pxPerMeter={scale * PX_PER_M}
store={rulerCursor}
units={units}
/>
</svg>
);
+7 -3
View File
@@ -2,6 +2,7 @@
import type { Vec2 } from "../../../model/types";
import { PX_PER_M } from "../../../core";
import { MODEL_UNITS, rulerLabel, type DisplayUnits } from "../../../tools/displayUnits";
/**
* Schrittweite (Meter) fürs Lineal: 1/2/5·10^n, sodass Major-Ticks ≥ ~64 px
@@ -30,6 +31,7 @@ export function PlanRulers({
vbPerPx,
pxPerMeter,
cursor,
units = MODEL_UNITS,
}: {
/** Sichtbarer Ausschnitt in (absoluten) viewBox-Einheiten. */
vb: { x0: number; y0: number; w: number; h: number };
@@ -41,13 +43,15 @@ export function PlanRulers({
vbPerPx: number;
pxPerMeter: number;
cursor: Vec2 | null;
/** Beschriftung: Meter (Modell) oder Papier-mm mit y nach unten (Layout-Blatt, [93]). */
units?: DisplayUnits;
}) {
const TH = 20 * vbPerPx; // Leisten-Dicke (screen-px → viewBox)
const step = rulerStep(pxPerMeter);
const minor = step / 5;
const font = 9 * vbPerPx;
// Negative Null vermeiden („−0.000m" bei Startwerten knapp unter 0).
const label = (v: number): string => `${(Math.abs(v) < 1e-9 ? 0 : v).toFixed(3)}m`;
const label = (axis: "x" | "y", v: number): string => rulerLabel(units, axis, v);
// Sichtbarer Modellbereich (Plan-Y nach oben: vbY = −y·PX_PER_M).
const mx0 = vb.x0 / PX_PER_M;
@@ -91,7 +95,7 @@ export function PlanRulers({
/>
{t.major && (
<text className="plan-ruler-text" x={t.vbX + 3 * vbPerPx} y={y0 + TH * 0.42} fontSize={font}>
{label(t.model)}
{label("x", t.model)}
</text>
)}
</g>
@@ -116,7 +120,7 @@ export function PlanRulers({
fontSize={font}
transform={`rotate(-90 ${x0 + TH * 0.42} ${t.vbY - 3 * vbPerPx})`}
>
{label(t.model)}
{label("y", t.model)}
</text>
)}
</g>
+9 -3
View File
@@ -5,6 +5,7 @@
import type { Vec2 } from "../../../model/types";
import type { SnapResult, ToolDraft } from "../../../tools/types";
import { hudSegments, type HudFieldsState } from "../../../tools/hudFormat";
import { MODEL_UNITS, type DisplayUnits } from "../../../tools/displayUnits";
/**
* Zeichnet die Werkzeug-Vorschau: Vorschau-Formen (gestrichelte Akzentlinien /
@@ -22,12 +23,15 @@ export function DraftOverlay({
vbPerPx,
snapColor,
hudFields = null,
units = MODEL_UNITS,
}: {
draft: ToolDraft;
toScreen: (v: Vec2) => Vec2;
vbPerPx: number;
snapColor: string;
hudFields?: HudFieldsState | null;
/** Anzeige-Einheiten des HUDs (Layout-Blatt: Papier-mm). */
units?: DisplayUnits;
}) {
const vertSize = 4.5 * vbPerPx; // halbe Kantenlänge eines Stützpunkt-Quadrats (klein + einheitlich)
const markSize = 4.75 * vbPerPx; // halbe Kantenlänge des Snap-Markers (klein + fein)
@@ -84,7 +88,7 @@ export function DraftOverlay({
<SnapMarker snap={draft.snap} toScreen={toScreen} size={markSize} color={snapColor} />
)}
{/* Maß-/Winkel-HUD am Cursor (VW-Stil `L: … W: …`, oder einfacher Text). */}
{draft.hud && <DraftHud hud={draft.hud} toScreen={toScreen} vbPerPx={vbPerPx} hudFields={hudFields} />}
{draft.hud && <DraftHud hud={draft.hud} toScreen={toScreen} vbPerPx={vbPerPx} hudFields={hudFields} units={units} />}
</g>
);
}
@@ -101,15 +105,17 @@ function DraftHud({
toScreen,
vbPerPx,
hudFields = null,
units,
}: {
hud: NonNullable<ToolDraft["hud"]>;
toScreen: (v: Vec2) => Vec2;
vbPerPx: number;
hudFields?: HudFieldsState | null;
units: DisplayUnits;
}) {
// Segmente: gemeinsame Formatierung mit dem 3D-Pendant (Wasm3DViewport.tsx),
// s. `tools/hudFormat.ts`.
const segs = hudSegments(hud, hudFields);
const segs = hudSegments(hud, hudFields, units);
if (segs.length === 0) return null;
const p = toScreen(hud.at);
@@ -276,7 +282,7 @@ function SnapMarker({
const helperStyle = { stroke: color };
const fillStyle = { stroke: color, fill: color };
return (
<g className="snap-marker">
<g className="snap-marker" data-snap-kind={snap.kind}>
{(snap.kind === "ortho" || snap.kind === "extension") && snap.refA && (
<line
className="snap-helper-line"
+2
View File
@@ -33,6 +33,7 @@ import type { SectionOutput } from "../core";
import { generateElevationPlan } from "../core";
import { crossKindOverlayAllowed, planUnderlayPrimitives } from "../core";
import { levelMarkerPrimitives, levelMarksEnabled } from "../core";
import { unitsForLevel } from "../tools/displayUnits";
import { setSheetOwnerOutlines, setSheetSnapSegments, snapSegmentsFromPrimitives } from "../tools/sheetSnapGeometry";
import { pushNativeScene, pushNativeWalls } from "./plan/nativeSync";
import { selectionHighlightLines } from "../core";
@@ -952,6 +953,7 @@ function LevelPlanView({
selectedDrawingIds={selectedDrawingIds}
gripHandlers={gripHandlers}
backdrop={backdrop}
units={unitsForLevel(level)}
fitBounds={fitBounds}
/>
{/* NACH PlanView gerendert (nicht als box-shadow auf .pane), damit der