[137] Achsraster im Schnitt/in der Ansicht anwählbar, Schlagschatten der Ansicht wählbar (Schalter in der Objekt-Info), Schriftfeld auf dem Blatt bearbeitbar, Nordpfeil/Massstabsbalken des Präsentationsplans als Gruppen
This commit is contained in:
13 files changed
+160
-11
No files matched your search
@@ -1406,7 +1406,12 @@ pub fn elevation_primitives(p: &Project, level: &LevelSpec, shadows: bool, mono:
|
||||
})
|
||||
.collect();
|
||||
i += 2 * count;
|
||||
items.push(Item { depth: depth - EPS * 10.0, seq, rank: None, prim: polygon(pts, SHADOW_FILL, "none", 0.0, no_hatch()) });
|
||||
let mut prim = polygon(pts, SHADOW_FILL, "none", 0.0, no_hatch());
|
||||
// [137] Klick auf den Schlagschatten wählt die Schatten-Einstellung der Ansicht (keine Element-Id).
|
||||
if let Primitive::Polygon { context_object_id, .. } = &mut prim {
|
||||
*context_object_id = Some(crate::plan::extras::SITE_PICK_VIEW_SHADOWS.into());
|
||||
}
|
||||
items.push(Item { depth: depth - EPS * 10.0, seq, rank: None, prim });
|
||||
seq += 1;
|
||||
}
|
||||
}
|
||||
@@ -1801,6 +1806,9 @@ mod tests {
|
||||
let json = serde_json::to_string(&prims).unwrap();
|
||||
assert!(json.contains("\"wallId\":\"W1\"") && json.contains("\"openingId\":\"O1\"") && json.contains("elevation-ground"), "{json}");
|
||||
assert!(json.contains("#8f959e"), "Schlagschatten fehlt");
|
||||
// [137] Schlagschatten anwählbar: Pick-Id der Ansichts-Schatten (Objekt-Info schaltet sie)
|
||||
let shadow: Vec<_> = prims.iter().filter(|q| matches!(q, Primitive::Polygon { fill, .. } if fill == SHADOW_FILL)).collect();
|
||||
assert!(!shadow.is_empty() && shadow.iter().all(|q| matches!(q, Primitive::Polygon { context_object_id: Some(id), .. } if id == crate::plan::extras::SITE_PICK_VIEW_SHADOWS)));
|
||||
assert!(b[2] > b[0]);
|
||||
// Painter: die Bodenlinie zuletzt
|
||||
assert!(matches!(prims.last(), Some(Primitive::Line { cls, .. }) if cls == "elevation-ground"));
|
||||
|
||||
@@ -15,6 +15,8 @@ use std::collections::HashMap;
|
||||
/// beginnt so): Schattenflächen wählen den Sonnenstand, die Baurechtslinien (unsichtbare Bänder) das Baurecht.
|
||||
pub const SITE_PICK_SUN: &str = "@sunStudy";
|
||||
pub const SITE_PICK_RULES: &str = "@siteRules";
|
||||
/// [137] Schlagschatten der Ansicht (Ebenen-Schalter `shadows`).
|
||||
pub const SITE_PICK_VIEW_SHADOWS: &str = "@viewShadows";
|
||||
|
||||
/// Füllfarbe der Schattenflächen.
|
||||
pub const SUN_SHADOW_FILL: &str = "#3a4a66";
|
||||
|
||||
@@ -25,7 +25,15 @@ pub fn grid_prims(p: &Project, level: &LevelSpec, bounds: [f64; 4], scale: f64)
|
||||
for d in &p.drawings2d {
|
||||
let Drawing2DGeom::Grid { bubble_mm, bubbles, .. } = &d.geom else { continue };
|
||||
let Some(spec) = Spec::of(&d.geom) else { continue };
|
||||
out.extend(one(&spec, &plane, level, bounds, scale, bubble_diameter(*bubble_mm, scale), bubbles.unwrap_or(GridBubbles::Both)));
|
||||
// [137] Achsen, Blasen und Beschriftung tragen die Raster-Id: im Schnitt/in der Ansicht anwählbar.
|
||||
let id = Some(d.id.clone());
|
||||
out.extend(one(&spec, &plane, level, bounds, scale, bubble_diameter(*bubble_mm, scale), bubbles.unwrap_or(GridBubbles::Both)).into_iter().map(|mut q| {
|
||||
match &mut q {
|
||||
Primitive::Line { drawing_id, .. } | Primitive::DrawingCircle { drawing_id, .. } | Primitive::DrawingText { drawing_id, .. } => *drawing_id = id.clone(),
|
||||
_ => {}
|
||||
}
|
||||
q
|
||||
}));
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -147,6 +155,8 @@ mod tests {
|
||||
assert!((lines[0].0 - 1.0).abs() < 1e-9 && (lines[1].0 - 5.0).abs() < 1e-9);
|
||||
assert!(lines[0].1 < 0.0 && lines[0].2 > 6.0);
|
||||
assert_eq!(texts(&prims), ["1", "2"]);
|
||||
// [137] alles mit der Raster-Id (anwählbar)
|
||||
assert!(prims.iter().all(|q| matches!(q, Primitive::Line { drawing_id: Some(i), .. } | Primitive::DrawingCircle { drawing_id: Some(i), .. } | Primitive::DrawingText { drawing_id: Some(i), .. } if i == "G")), "{prims:?}");
|
||||
// Schnitt längs der Achsen 1/2: nur die waagrechten Achsen A, B queren.
|
||||
let level = LevelSpec { kind: "section".into(), line: Some([v2(2.0, -1.0), v2(2.0, 9.0)]), ..Default::default() };
|
||||
let prims = grid_prims(&p, &level, [0.0, 0.0, 9.0, 6.0], 100.0);
|
||||
|
||||
@@ -460,6 +460,7 @@ export const de = {
|
||||
"objinfo.kind.contextObject": "Kontext-Objekt",
|
||||
"objinfo.kind.sunStudy": "Schatten (Sonnenstand)",
|
||||
"objinfo.kind.siteRules": "Baurecht",
|
||||
"objinfo.kind.viewShadows": "Schlagschatten (Ansicht)",
|
||||
"objinfo.sunStudy.hint": "Schatten werden aus dem Modell abgeleitet — Datum und Uhrzeit hier ändern.",
|
||||
"objinfo.siteRules.hint": "Parzellengrenze und zulässige Fläche kommen aus dem Baurecht — hier bearbeiten.",
|
||||
// ── Kontext-Objekt-Attribute (Object-Info-Panel) ────────────────────────
|
||||
@@ -2189,6 +2190,7 @@ export const de = {
|
||||
"pick.kind.site": "Lage",
|
||||
"pick.site.sunStudy": "Schatten (Sonnenstand)",
|
||||
"pick.site.siteRules": "Baurecht",
|
||||
"pick.site.viewShadows": "Schlagschatten (Ansicht)",
|
||||
"pick.cycle.hint": "{i}/{n} Treffer — erneut klicken zum Wechseln",
|
||||
"pick.shape.line": "Linie",
|
||||
"pick.shape.polyline": "Polylinie",
|
||||
@@ -2913,6 +2915,9 @@ export const de = {
|
||||
"layouts.tb.date": "Datum",
|
||||
"layouts.tb.author": "Bearbeiter",
|
||||
"layouts.tb.autoPlaceholder": "(automatisch)",
|
||||
"layouts.tb.title": "Schriftfeld",
|
||||
"layouts.tb.planNumber": "Plan-Nr.",
|
||||
"layouts.tb.revision": "Index",
|
||||
// Editor
|
||||
"layouts.editorTitle": "Layout-Editor",
|
||||
"layouts.fit": "Einpassen",
|
||||
@@ -3309,6 +3314,8 @@ export const de = {
|
||||
"presentation.sheetName": "Präsentationsplan",
|
||||
"presentation.masterName": "Planrahmen {format}",
|
||||
"presentation.north": "N",
|
||||
"presentation.northGroup": "Nordpfeil",
|
||||
"presentation.scaleBarGroup": "Massstabsbalken",
|
||||
"presentation.done": "Präsentationsplan 1:{scale} mit {n} Ansichten erstellt",
|
||||
"presentation.tooBig": "Präsentationsplan: passt auch 1:{scale} nicht ganz aufs Blatt – grösseres Format wählen",
|
||||
"presentation.empty": "Präsentationsplan: keine Ansicht mit Inhalt gewählt",
|
||||
|
||||
@@ -458,6 +458,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"objinfo.kind.contextObject": "Context object",
|
||||
"objinfo.kind.sunStudy": "Shadow (sun position)",
|
||||
"objinfo.kind.siteRules": "Building regulations",
|
||||
"objinfo.kind.viewShadows": "Cast shadow (elevation)",
|
||||
"objinfo.sunStudy.hint": "Shadows are derived from the model — change date and time here.",
|
||||
"objinfo.siteRules.hint": "Parcel boundary and buildable area come from the building regulations — edit them here.",
|
||||
// ── Context object attributes (object info panel) ───────────────────────
|
||||
@@ -2177,6 +2178,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"pick.kind.site": "Site",
|
||||
"pick.site.sunStudy": "Shadow (sun position)",
|
||||
"pick.site.siteRules": "Building regulations",
|
||||
"pick.site.viewShadows": "Cast shadow (elevation)",
|
||||
"pick.cycle.hint": "{i}/{n} hits — click again to cycle",
|
||||
"pick.shape.line": "Line",
|
||||
"pick.shape.polyline": "Polyline",
|
||||
@@ -2900,6 +2902,9 @@ export const en: Record<TranslationKey, string> = {
|
||||
"layouts.tb.date": "Date",
|
||||
"layouts.tb.author": "Author",
|
||||
"layouts.tb.autoPlaceholder": "(automatic)",
|
||||
"layouts.tb.title": "Title block",
|
||||
"layouts.tb.planNumber": "Sheet no.",
|
||||
"layouts.tb.revision": "Revision",
|
||||
// Editor
|
||||
"layouts.editorTitle": "Layout editor",
|
||||
"layouts.fit": "Fit",
|
||||
@@ -3295,6 +3300,8 @@ export const en: Record<TranslationKey, string> = {
|
||||
"presentation.sheetName": "Presentation sheet",
|
||||
"presentation.masterName": "Sheet frame {format}",
|
||||
"presentation.north": "N",
|
||||
"presentation.northGroup": "North arrow",
|
||||
"presentation.scaleBarGroup": "Scale bar",
|
||||
"presentation.done": "Presentation sheet 1:{scale} with {n} views created",
|
||||
"presentation.tooBig": "Presentation sheet: does not fully fit even at 1:{scale} – choose a larger format",
|
||||
"presentation.empty": "Presentation sheet: no view with content chosen",
|
||||
|
||||
@@ -60,6 +60,7 @@ import type {
|
||||
} from "../state/selectionInfo";
|
||||
import type { MeasurementReadout } from "../tools/types";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { patchItem } from "../core";
|
||||
import { excavationQuantities } from "../core";
|
||||
import { ContextObjectProps } from "./ContextObjectProps";
|
||||
import { SunStudySection } from "./SunStudySection";
|
||||
@@ -105,6 +106,7 @@ export function ObjectInfoPanel() {
|
||||
);
|
||||
|
||||
// ── Leerzustand ───────────────────────────────────────────────────────────
|
||||
if (sel === null && site[0] === "viewShadows") return <ViewShadowsInfo />;
|
||||
if (sel === null && site.length > 0) {
|
||||
const sun = site[0] === "sunStudy";
|
||||
return (
|
||||
@@ -2547,3 +2549,28 @@ function MeasurementSection({ m }: { m: MeasurementReadout }) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** [137] Schlagschatten der Ansicht angeklickt: Schalter der aktiven Ansicht (DrawingLevel.shadows, Undo). */
|
||||
function ViewShadowsInfo() {
|
||||
const level = useStore((s) => s.project.drawingLevels.find((l) => l.id === s.activeLevelId));
|
||||
const applyChange = useStore((s) => s.applyChange);
|
||||
return (
|
||||
<div className="objinfo-panel">
|
||||
<div className="objinfo-head">
|
||||
<span className="objinfo-kind">{t("objinfo.kind.viewShadows")}</span>
|
||||
</div>
|
||||
<div className="objinfo-muted objinfo-site-hint">{t("elevation.shadows.hint")}</div>
|
||||
{level && (
|
||||
<label className="objinfo-row" style={{ display: "flex", gap: 6, alignItems: "center" }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
data-testid="view-shadows"
|
||||
checked={!!level.shadows}
|
||||
onChange={(e) => applyChange((p) => patchItem(p, "drawingLevels", level.id, { shadows: e.target.checked }))}
|
||||
/>
|
||||
{t("elevation.shadows")}
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import { sheetSizeMm } from "../model/layoutModel";
|
||||
import { PRESENTATION_TEMPLATE_ID, presentationDefaults, presentationSheetOps } from "./presentationSheet";
|
||||
import type { Project } from "../model/types";
|
||||
|
||||
const LABELS = { sheetName: "Präsentationsplan", masterName: "Planrahmen", north: "N" };
|
||||
const LABELS = { sheetName: "Präsentationsplan", masterName: "Planrahmen", north: "N", northGroup: "Nordpfeil", scaleBarGroup: "Massstabsbalken" };
|
||||
const st = () => getState();
|
||||
|
||||
function overlaps(a: { xMm: number; yMm: number; widthMm: number; heightMm: number }, b: typeof a): boolean {
|
||||
@@ -62,6 +62,10 @@ describe("[66] Präsentationsplan", () => {
|
||||
const texts = onSheet.filter((d) => d.geom.shape === "text");
|
||||
expect(texts.length).toBe(lay.viewports.length + 1 + 2);
|
||||
expect(onSheet.filter((d) => /-s\d$/.test(d.id) && d.geom.shape === "polyline").length).toBe(5);
|
||||
// [137] Nordpfeil und Massstabsbalken sind je eine Gruppe (Klick wählt, verschiebt und löscht sie als Ganzes).
|
||||
const groups = (p.groups ?? []).filter((g) => g.drawingIds.some((id) => onSheet.some((d) => d.id === id)));
|
||||
expect(groups.map((g) => g.drawingIds.length).sort()).toEqual([4, 7]);
|
||||
expect(groups.every((g) => g.name && g.drawingIds.every((id) => onSheet.some((d) => d.id === id)))).toBe(true);
|
||||
// Titel und Balken liegen auf dem Blatt.
|
||||
for (const d of onSheet) if (d.geom.shape === "text") {
|
||||
expect(d.geom.at.x * 1000).toBeGreaterThan(0);
|
||||
|
||||
@@ -9,6 +9,7 @@ import type {
|
||||
Drawing2D,
|
||||
Drawing2DGeom,
|
||||
DrawingLevel,
|
||||
Group,
|
||||
LayerCategory,
|
||||
Layout,
|
||||
LayoutOrientation,
|
||||
@@ -65,6 +66,9 @@ export interface PresentationLabels {
|
||||
/** Name eines neu angelegten Masters, z. B. „Planrahmen A1 quer". */
|
||||
masterName: string;
|
||||
north: string;
|
||||
/** [137] Gruppen-Namen von Nordpfeil und Massstabsbalken (Objekt-Info). */
|
||||
northGroup?: string;
|
||||
scaleBarGroup?: string;
|
||||
}
|
||||
|
||||
const isFloor = (l: DrawingLevel) => l.kind === "floor" && !l.layoutId;
|
||||
@@ -267,6 +271,10 @@ export function presentationSheetOps(
|
||||
const snaps: ViewSnapshot[] = [];
|
||||
const vps: LayoutViewport[] = [];
|
||||
const drawings: Drawing2D[] = [];
|
||||
// [137] Nordpfeil und Massstabsbalken als je eine Gruppe: ein Klick wählt, verschiebt und löscht sie als Ganzes.
|
||||
const groups: Group[] = [];
|
||||
const group = (id: string, name: string | undefined, members: Drawing2D[]) =>
|
||||
groups.push({ id, name, wallIds: [], drawingIds: members.map((d) => d.id), ceilingIds: [], roomIds: [], stairIds: [], columnIds: [], roofIds: [], openingIds: [], groupIds: [] });
|
||||
plan.items.forEach((it, i) => {
|
||||
const level = byId.get(it.levelId)!;
|
||||
const snapId = `vs-pres-${stamp}-${i}`;
|
||||
@@ -294,16 +302,22 @@ export function presentationSheetOps(
|
||||
if (firstFloor) {
|
||||
const cx = firstFloor.xMm + firstFloor.widthMm - 8;
|
||||
const cy = firstFloor.yMm + firstFloor.heightMm + 4.8;
|
||||
drawings.push(...northArrow(stamp, sheetLevel.id, cat, cx, cy, 3.6, labels.north));
|
||||
const north = northArrow(stamp, sheetLevel.id, cat, cx, cy, 3.6, labels.north);
|
||||
drawings.push(...north);
|
||||
group(`grp-pres-${stamp}-n`, labels.northGroup, north);
|
||||
// Massstabsbalken links vom Nordpfeil, sofern er den Titel nicht berührt (Breite grob 0.65 × Schrifthöhe je Zeichen).
|
||||
const bar = scaleBar(stamp, sheetLevel.id, cat, cx - 3.6 - 10, cy - 1, plan.scale);
|
||||
const title = byId.get(firstFloor.levelId)!.name;
|
||||
const titleEnd = firstFloor.xMm + FRAME_PAD_MM + (title.length + 8) * 4 * 0.65;
|
||||
const barLeft = Math.min(...bar.flatMap((d) => (d.geom.shape === "polyline" ? d.geom.pts.map((p) => p.x * 1000) : [])));
|
||||
if (barLeft - 6 > titleEnd) drawings.push(...bar);
|
||||
if (barLeft - 6 > titleEnd) {
|
||||
drawings.push(...bar);
|
||||
group(`grp-pres-${stamp}-s`, labels.scaleBarGroup, bar);
|
||||
}
|
||||
}
|
||||
ops.push(...addItems("layouts", [{ ...layout, viewports: vps }]), ...addItems("drawingLevels", [sheetLevel]));
|
||||
ops.push(...addItems("viewSnapshots", snaps), ...addItems("drawings2d", drawings));
|
||||
if (groups.length > 0) ops.push(...addItems("groups", groups));
|
||||
// Schatten (Vorlage) für Ansichten/Schnitt, Skizze nach Wahl für alle gezeigten Ebenen.
|
||||
for (const it of plan.items) {
|
||||
const level = byId.get(it.levelId)!;
|
||||
|
||||
@@ -12,7 +12,7 @@ export function createPresentationSheet(o: PresentationOptions): string | null {
|
||||
const res = presentationSheetOps(
|
||||
st.project,
|
||||
o,
|
||||
{ sheetName: t("presentation.sheetName"), masterName: t("presentation.masterName", { format }), north: t("presentation.north") },
|
||||
{ sheetName: t("presentation.sheetName"), masterName: t("presentation.masterName", { format }), north: t("presentation.north"), northGroup: t("presentation.northGroup"), scaleBarGroup: t("presentation.scaleBarGroup") },
|
||||
String(Date.now()),
|
||||
);
|
||||
if (!res) {
|
||||
|
||||
@@ -186,7 +186,11 @@ export function useGripEditing(opts: {
|
||||
const gripOwnerRange: [number, number][] = [];
|
||||
|
||||
// Die Einzel-ID leitet sich aus der Menge ab ([130]) — die Menge genügt.
|
||||
const effectiveDrawingIds = selectedDrawingIds;
|
||||
// [137] Im Schnitt/in der Ansicht nur die 2D-Elemente der Blatt-Ebene: ein dort angewähltes Achsraster
|
||||
// (Grundriss-Element, im Blatt projiziert) hat keine Griffe/kein Verschieben in Blatt-Koordinaten.
|
||||
const effectiveDrawingIds = modelEditable
|
||||
? selectedDrawingIds
|
||||
: selectedDrawingIds.filter((id) => project.drawings2d.find((x) => x.id === id)?.levelId === levelId);
|
||||
|
||||
// Griff-Grenzen (s. gripLimits.ts): grosse Mehrfachauswahlen ohne Griffe, ein einzeln gewähltes
|
||||
// Element immer mit Griffen (Kataster-Parzellen mit tausenden Stützpunkten).
|
||||
@@ -1039,6 +1043,7 @@ export function useGripEditing(opts: {
|
||||
? { x: prev.total.x + delta.x, y: prev.total.y + delta.y }
|
||||
: delta;
|
||||
if (!deferrableDrawing(target.drawingId)) return;
|
||||
if (project.drawings2d.find((x) => x.id === target.drawingId)?.levelId !== sh.levelId) return; // [137] Achsraster
|
||||
pendingBodyRef.current = { drawingId: target.drawingId, total };
|
||||
setDraft({ preview: bodyPreviewShapes(), vertices: [], snap: null });
|
||||
return;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// Bezeichner englisch, Kommentare deutsch (CONVENTIONS.md).
|
||||
|
||||
import { useEffect, useMemo, useRef } from "react";
|
||||
import type { Layout, LayoutLegend, LayoutTable, LayoutViewport, Project } from "../model/types";
|
||||
import type { Layout, LayoutLegend, LayoutTable, LayoutTitleBlock, LayoutViewport, Project } from "../model/types";
|
||||
import { addItems, patchItem } from "../core";
|
||||
import type { ProjectSlice } from "./projectSlice";
|
||||
import {
|
||||
@@ -104,6 +104,19 @@ export function useSheetPane(opts: {
|
||||
onPatchLegend: (legendId: string, patch: Partial<Omit<LayoutLegend, "id">>) =>
|
||||
patchOpenLayout(openId(), (l) => patchLegend(l, legendId, patch), `legend-${legendId}`),
|
||||
onRemoveLegend: (legendId: string) => patchOpenLayout(openId(), (l) => removeLegend(l, legendId)),
|
||||
// [137] Schriftfeld: Blatt-Felder am Layout, gemeinsame am Master (Tippen = ein Undo-Schritt je Feld).
|
||||
onPatchTitleBlock: (layoutPatch: Partial<Pick<Layout, "name" | "planNumber" | "revision">>, masterPatch?: Partial<LayoutTitleBlock>) => {
|
||||
const id = openId();
|
||||
const key = `titleBlock:${id}:${Object.keys(layoutPatch).join()}${Object.keys(masterPatch ?? {}).join()}`;
|
||||
if (Object.keys(layoutPatch).length > 0) patchOpenLayout(id, (l) => ({ ...l, ...layoutPatch }), key);
|
||||
if (masterPatch) {
|
||||
applyChange((p) => {
|
||||
const lay = (p.layouts ?? []).find((l) => l.id === id);
|
||||
const m = (p.masterLayouts ?? []).find((x) => x.id === lay?.masterId);
|
||||
return m ? patchItem(p, "masterLayouts", m.id, { titleBlock: { ...m.titleBlock, ...masterPatch } }) : [];
|
||||
}, key);
|
||||
}
|
||||
},
|
||||
});
|
||||
const open = !!activeLayout && !!sheetLevel && activeLevelId === sheetLevel.id;
|
||||
return useMemo(
|
||||
|
||||
+51
-1
@@ -16,6 +16,7 @@ import type { PointerEvent as ReactPointerEvent, ReactNode, RefObject } from "re
|
||||
import type {
|
||||
Layout,
|
||||
LayoutLegend,
|
||||
LayoutTitleBlock,
|
||||
LayoutOrientation,
|
||||
LayoutPaperFormat,
|
||||
LayoutTable,
|
||||
@@ -230,6 +231,16 @@ export interface LayoutSheetHandlers {
|
||||
/** Ändert eine Tabelle (Teil-Patch; gleiche `coalesceKey` fassen sich zu einem Undo-Schritt zusammen). */
|
||||
onPatchTable: (tableId: string, patch: Partial<Omit<LayoutTable, "id">>, coalesceKey?: string) => void;
|
||||
onRemoveTable: (tableId: string) => void;
|
||||
/**
|
||||
* [137] Schriftfeld bearbeiten: Blattname/Plan-Nr./Index am Blatt, Projekt/Bearbeiter/Datum am Master
|
||||
* (gleiche `coalesceKey` = ein Undo-Schritt beim Tippen).
|
||||
*/
|
||||
onPatchTitleBlock?: (layoutPatch: Partial<Pick<Layout, "name" | "planNumber" | "revision">>, masterPatch?: Partial<LayoutTitleBlock>) => void;
|
||||
}
|
||||
|
||||
/** [137] Lage des Schriftfelds auf dem Blatt (mm, unten rechts; wie `TitleBlockSvg`). */
|
||||
export function titleBlockBox(sheet: { w: number; h: number }): { xMm: number; yMm: number; widthMm: number; heightMm: number } {
|
||||
return { xMm: sheet.w - 76, yMm: sheet.h - 36, widthMm: 70, heightMm: 30 };
|
||||
}
|
||||
|
||||
/** Was die Plan-Ansicht der Blatt-Ebene vom Blatt bekommt. */
|
||||
@@ -302,6 +313,8 @@ export function LayoutSheetPane({
|
||||
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||
const [selectedLegendId, setSelectedLegendId] = useState<string | null>(null);
|
||||
const [selectedTableId, setSelectedTableId] = useState<string | null>(null);
|
||||
// [137] Schriftfeld angeklickt → Felder bearbeiten.
|
||||
const [titleBlockSelected, setTitleBlockSelected] = useState(false);
|
||||
// Tabellen-Verschiebung läuft (Versatz in mm), sonst null.
|
||||
const [tableDrag, setTableDrag] = useState<{ id: string; dx: number; dy: number } | null>(null);
|
||||
// „Viewport aufziehen" armiert; danach folgt ggf. die Ausschnitt-Bindung.
|
||||
@@ -330,6 +343,7 @@ export function LayoutSheetPane({
|
||||
setSelectedId(null);
|
||||
setSelectedLegendId(null);
|
||||
setSelectedTableId(null);
|
||||
setTitleBlockSelected(false);
|
||||
setPlacing(false);
|
||||
setPendingRect(null);
|
||||
}, [layout.id]);
|
||||
@@ -472,6 +486,9 @@ export function LayoutSheetPane({
|
||||
{master && (
|
||||
<g pointerEvents="none">
|
||||
<TitleBlockSvg sheet={sheet} tb={titleBlock} paper={layout.paper} orientation={layout.orientation} />
|
||||
{titleBlockSelected && (
|
||||
<rect {...rectAttrs(titleBlockBox(sheet))} fill="none" stroke={ACCENT} strokeWidth={hair * 1.5} data-titleblock-selected />
|
||||
)}
|
||||
</g>
|
||||
)}
|
||||
{layout.viewports.map((vp) => {
|
||||
@@ -645,12 +662,18 @@ export function LayoutSheetPane({
|
||||
return mm.xMm >= b.xMm && mm.xMm <= b.xMm + b.widthMm && mm.yMm >= b.yMm && mm.yMm <= b.yMm + b.heightMm;
|
||||
});
|
||||
setSelectedLegendId(lg ? lg.id : null);
|
||||
const hit = tableHit || lg ? null : pickViewport(layout.viewports, mm.xMm, mm.yMm, 0);
|
||||
// Schriftfeld (liegt über den Viewports, nur mit Master gezeichnet).
|
||||
const tbb = titleBlockBox(sheet);
|
||||
const onTitle = !tableHit && !lg && !!master && !!handlers.onPatchTitleBlock &&
|
||||
mm.xMm >= tbb.xMm && mm.xMm <= tbb.xMm + tbb.widthMm && mm.yMm >= tbb.yMm && mm.yMm <= tbb.yMm + tbb.heightMm;
|
||||
setTitleBlockSelected(onTitle);
|
||||
const hit = tableHit || lg || onTitle ? null : pickViewport(layout.viewports, mm.xMm, mm.yMm, 0);
|
||||
setSelectedId(hit ? hit.id : null);
|
||||
} else {
|
||||
setSelectedId(null);
|
||||
setSelectedTableId(null);
|
||||
setSelectedLegendId(null);
|
||||
setTitleBlockSelected(false);
|
||||
}
|
||||
onPlanSelect(sel);
|
||||
};
|
||||
@@ -773,6 +796,33 @@ export function LayoutSheetPane({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* [137] Schriftfeld: Felder direkt bearbeiten. */}
|
||||
{titleBlockSelected && master && handlers.onPatchTitleBlock && (
|
||||
<div className="layout-sheet-hud" data-sheet-ui data-testid="titleblock-hud">
|
||||
<div className="layout-sheet-hud-title">{t("layouts.tb.title")}</div>
|
||||
{([
|
||||
["sheetName", layout.name, (v: string) => handlers.onPatchTitleBlock!({ name: v })],
|
||||
["planNumber", layout.planNumber ?? "", (v: string) => handlers.onPatchTitleBlock!({ planNumber: v || undefined })],
|
||||
["revision", layout.revision ?? "", (v: string) => handlers.onPatchTitleBlock!({ revision: v || undefined })],
|
||||
["projectName", master.titleBlock.projectName ?? "", (v: string) => handlers.onPatchTitleBlock!({}, { projectName: v })],
|
||||
["author", master.titleBlock.author ?? "", (v: string) => handlers.onPatchTitleBlock!({}, { author: v })],
|
||||
["date", master.titleBlock.date ?? "", (v: string) => handlers.onPatchTitleBlock!({}, { date: v })],
|
||||
] as const).map(([key, value, set]) => (
|
||||
<label key={key} className="layout-sheet-hud-row">
|
||||
<span>{t(`layouts.tb.${key}`)}</span>
|
||||
<input
|
||||
type="text"
|
||||
className="res-input"
|
||||
data-tb-field={key}
|
||||
value={value}
|
||||
placeholder={t("layouts.tb.autoPlaceholder")}
|
||||
onChange={(e) => set(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Eigenschaften der gewählten Legende ([82]). */}
|
||||
{selectedLegend && (
|
||||
<LegendHud
|
||||
|
||||
@@ -1438,7 +1438,9 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
|
||||
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;
|
||||
// Lage-Darstellung (`@…`: Schlagschatten der Ansicht, Schatten, Baurecht) verdeckt nie — sie liegt auf den
|
||||
// Bauteilen und wird erst nach ihnen gewählt (bzw. per erneutem Klick, [137] Klick-Zyklus).
|
||||
if (((p.contextObjectId && !p.contextObjectId.startsWith("@")) || p.sectionLineId) && p.fill !== "none") return i;
|
||||
if (p.contextObjectId && !p.contextObjectId.startsWith("@")) underBand = true;
|
||||
}
|
||||
return null;
|
||||
@@ -2300,7 +2302,7 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
|
||||
const key = `${kind}:${id}`;
|
||||
if (seen.has(key)) return;
|
||||
seen.add(key);
|
||||
const base = kind === "drawing" ? drawingLabel(id) : kind === "site" ? t(id === "siteRules" ? "pick.site.siteRules" : "pick.site.sunStudy") : t(`pick.kind.${kind}`);
|
||||
const base = kind === "drawing" ? drawingLabel(id) : kind === "site" ? t(id === "siteRules" ? "pick.site.siteRules" : id === "viewShadows" ? "pick.site.viewShadows" : "pick.site.sunStudy") : t(`pick.kind.${kind}`);
|
||||
const cat = describePick?.(kind, id);
|
||||
out.push({ kind, id, hitIndex, label: cat ? `${base} · ${cat}` : base });
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user