[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:
31 files changed
+1098
-124
No files matched your search
@@ -26,6 +26,7 @@ import { Fragment } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { formatM, wallTypeLabel } from "../model/types";
|
||||
import { fmtLength, unitsForLevel } from "../tools/displayUnits";
|
||||
import { PEN_WEIGHTS } from "../model/types";
|
||||
import type { AttributeSource } from "../model/types";
|
||||
import { usePanelHost } from "./host";
|
||||
@@ -124,6 +125,8 @@ export function AttributesPanel() {
|
||||
}
|
||||
|
||||
const isDrawing = sel.kind === "drawing2d";
|
||||
const sheetUnits = unitsForLevel(host.project.drawingLevels.find((z) => z.id === sel.floorId));
|
||||
const sizeText = (m: number): string => (sheetUnits.perMeter === 1 ? formatM(m) : `${fmtLength(sheetUnits, m).replace(/mm$/, "")} mm`);
|
||||
// Strichstärke: Wand/Decke/Stütze/Drawing2D tragen einen eigenen Override
|
||||
// (`strokeWeight`/`weightMm`) + Quellen-Dropdown; andere Elementarten erben
|
||||
// stets aus der Kategorie (kein Setter im Kontrakt → nicht editierbar).
|
||||
@@ -760,9 +763,7 @@ export function AttributesPanel() {
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* ── Masse (informativ, aus der bbox) — bei einer Layout-Annotation
|
||||
in Papier-mm statt Modell-Metern geführt (`formatM` passt nicht),
|
||||
daher hier weggelassen; Grösse steht bereits im Blatt-HUD. */}
|
||||
{/* ── Masse (informativ, aus der bbox) — auf einem Layout-Blatt in Papier-mm ([93]). */}
|
||||
{/* Bauteile: die bbox ist der GRUNDRISS-Umriss (X/Y), keine Höhe — als
|
||||
„Ausdehnung X/Y" beschriften (Nutzer-Report: Fenster zeigte „Höhe
|
||||
0.34 m" = Wanddicke). Öffnungen tragen Breite/Höhe im eigenen
|
||||
@@ -771,9 +772,9 @@ export function AttributesPanel() {
|
||||
<>
|
||||
<div className="attr-section-label">{t("attr.size")}</div>
|
||||
<span className="attr-key">{t(isModelElement ? "attr.extentX" : "attr.width")}</span>
|
||||
<span className="attr-val attr-readonly">{formatM(bboxW)}</span>
|
||||
<span className="attr-val attr-readonly">{sizeText(bboxW)}</span>
|
||||
<span className="attr-key">{t(isModelElement ? "attr.extentY" : "attr.height")}</span>
|
||||
<span className="attr-val attr-readonly">{formatM(bboxH)}</span>
|
||||
<span className="attr-val attr-readonly">{sizeText(bboxH)}</span>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
// Bezeichner englisch, UI-Text/Kommentare deutsch (CONVENTIONS.md). Alle sichtbaren
|
||||
// Texte über t(...).
|
||||
|
||||
import { lengthFromDisplay, lengthToDisplay, unitsForLevel, xToDisplay, yFromDisplay, yToDisplay } from "../tools/displayUnits";
|
||||
import { solidProps } from "../engine/truckSolid";
|
||||
import type { SolidProps, SolidSpec } from "../engine/truckSolid";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
// Anzeige-Fallbacks für die Öffnungs-Linien-Übersteuerung (LineStyleRow) —
|
||||
// dieselben Werte wie POCHE_STROKE/SYMBOL_HAIRLINE_MM im Grundriss (Kern: plan/style.rs)
|
||||
// (reine UI-Default-Anzeige, kein Re-Export nötig).
|
||||
@@ -106,6 +107,11 @@ export function ObjectInfoPanel() {
|
||||
// Wert (wie bei Breite/Höhe oben).
|
||||
const px = bbox.minX + anchor.fx * width;
|
||||
const py = bbox.minY + anchor.fy * height;
|
||||
// Auf einem Layout-Blatt zeigt und liest das Panel Papier-mm mit y nach unten ([93]).
|
||||
const u = unitsForLevel(host.project.drawingLevels.find((z) => z.id === sel.floorId));
|
||||
const len = (m: number): number => lengthToDisplay(u, m);
|
||||
const unlen = (v: number): number => lengthFromDisplay(u, v);
|
||||
const lenProps = { unit: u.suffix, digits: u.digits };
|
||||
|
||||
// Rohe Drawing2D-Geometrie der Selektion (nur bei kind==="drawing2d") — für
|
||||
// die Linien-Länge/Kreis-Radius-Felder unten; die Selection-Sicht trägt
|
||||
@@ -199,15 +205,17 @@ export function ObjectInfoPanel() {
|
||||
<div className="objinfo-xyzcol">
|
||||
<DimensionField
|
||||
label={t("objinfo.x")}
|
||||
value={px}
|
||||
value={xToDisplay(u, px)}
|
||||
min={-Infinity}
|
||||
onCommit={(nx) => host.onMoveSelectionBy(nx - px, 0)}
|
||||
{...lenProps}
|
||||
onCommit={(nx) => host.onMoveSelectionBy(unlen(nx) - px, 0)}
|
||||
/>
|
||||
<DimensionField
|
||||
label={t("objinfo.y")}
|
||||
value={py}
|
||||
value={yToDisplay(u, py)}
|
||||
min={-Infinity}
|
||||
onCommit={(ny) => host.onMoveSelectionBy(0, ny - py)}
|
||||
{...lenProps}
|
||||
onCommit={(ny) => host.onMoveSelectionBy(0, yFromDisplay(u, ny) - py)}
|
||||
/>
|
||||
{/* Z ehrlich: Das Modell ist 2D pro Ebene; es gibt keine Z am Element.
|
||||
Daher „—" statt einer gefakten 0, mit kurzem Hinweis im Titel. */}
|
||||
@@ -229,13 +237,15 @@ export function ObjectInfoPanel() {
|
||||
<div className="objinfo-section-label">{t("objinfo.dimensions")}</div>
|
||||
<DimensionField
|
||||
label={t("objinfo.width")}
|
||||
value={width}
|
||||
onCommit={(w) => commitSize(w, height)}
|
||||
value={len(width)}
|
||||
{...lenProps}
|
||||
onCommit={(w) => commitSize(unlen(w), height)}
|
||||
/>
|
||||
<DimensionField
|
||||
label={t("objinfo.height")}
|
||||
value={height}
|
||||
onCommit={(h) => commitSize(width, h)}
|
||||
value={len(height)}
|
||||
{...lenProps}
|
||||
onCommit={(h) => commitSize(width, unlen(h))}
|
||||
/>
|
||||
{/* Formspezifische Zusatzfelder (nur wenn das Modell den Wert direkt
|
||||
hergibt — andere Formen bleiben ohne Zusatzfeld, s. Dateikopf). */}
|
||||
@@ -243,8 +253,9 @@ export function ObjectInfoPanel() {
|
||||
<>
|
||||
<DimensionField
|
||||
label={t("objinfo.drawing.length")}
|
||||
value={Math.hypot(width, height)}
|
||||
onCommit={(v) => host.onSetDrawingLineLength(v)}
|
||||
value={len(Math.hypot(width, height))}
|
||||
{...lenProps}
|
||||
onCommit={(v) => host.onSetDrawingLineLength(unlen(v))}
|
||||
/>
|
||||
<DimensionField
|
||||
label={t("objinfo.drawing.angle")}
|
||||
@@ -264,16 +275,18 @@ export function ObjectInfoPanel() {
|
||||
{drawingShape === "circle" && (
|
||||
<DimensionField
|
||||
label={t("objinfo.drawing.radius")}
|
||||
value={width / 2}
|
||||
onCommit={(v) => host.onSetDrawingCircleRadius(v)}
|
||||
value={len(width / 2)}
|
||||
{...lenProps}
|
||||
onCommit={(v) => host.onSetDrawingCircleRadius(unlen(v))}
|
||||
/>
|
||||
)}
|
||||
{drawingShape === "arc" && rawDrawing?.geom.shape === "arc" && (
|
||||
<>
|
||||
<DimensionField
|
||||
label={t("objinfo.drawing.radius")}
|
||||
value={rawDrawing.geom.r}
|
||||
onCommit={(v) => host.onSetDrawingArcRadius(v)}
|
||||
value={len(rawDrawing.geom.r)}
|
||||
{...lenProps}
|
||||
onCommit={(v) => host.onSetDrawingArcRadius(unlen(v))}
|
||||
/>
|
||||
<DimensionField
|
||||
label={t("objinfo.drawing.startAngle")}
|
||||
@@ -2036,6 +2049,7 @@ function DimensionField({
|
||||
min = 0,
|
||||
unit = "m",
|
||||
step = 0.01,
|
||||
digits = 3,
|
||||
}: {
|
||||
label: string;
|
||||
value: number;
|
||||
@@ -2043,16 +2057,24 @@ function DimensionField({
|
||||
min?: number;
|
||||
unit?: string;
|
||||
step?: number;
|
||||
/** Nachkommastellen der Anzeige (Papier-mm: 1). */
|
||||
digits?: number;
|
||||
}) {
|
||||
// Entwurf als String, damit Zwischenzustände (leer, „1.") tippbar sind.
|
||||
// `null` = kein aktiver Entwurf → zeige den Host-Wert.
|
||||
const [draft, setDraft] = useState<string | null>(null);
|
||||
// Enter committet und nimmt danach den Fokus — das `blur` im selben Handler sieht noch den alten
|
||||
// Entwurf (State noch nicht neu gerendert) und committete ein zweites Mal (X/Y: doppelte Verschiebung).
|
||||
const pending = useRef<string | null>(null);
|
||||
pending.current = draft;
|
||||
|
||||
const shown = draft ?? value.toFixed(3);
|
||||
const shown = draft ?? (Object.is(Number(value.toFixed(digits)), -0) ? 0 : value).toFixed(digits);
|
||||
|
||||
function commit() {
|
||||
if (draft === null) return;
|
||||
const v = Number(draft);
|
||||
const d = pending.current;
|
||||
if (d === null) return;
|
||||
pending.current = null;
|
||||
const v = Number(d);
|
||||
setDraft(null);
|
||||
if (isFinite(v) && v >= min) onCommit(v);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user