[137] Merge: Klick-Wechsel im Plan, Achsraster im Schnitt, Schlagschatten, Plankopf, Nordpfeil/Massstabsbalken als Gruppe

This commit is contained in:
Claude committed 2026-11-05 17:14:59 +00:00
commit 0d0e5a1dfe
21 files changed
+554 -23

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
// [137] Statusleisten-Hinweis zum Klick-Zyklus („2/3 Treffer — erneut klicken zum Wechseln"). Ausserhalb von
// React-State, weil der Setzer (PlanView) und der Leser (StatusBar in App) in verschiedenen Teilbäumen sitzen.
import { useSyncExternalStore } from "react";
let current: string | null = null;
const listeners = new Set<() => void>();
export function setPickHint(hint: string | null): void {
if (hint === current) return;
current = hint;
for (const l of listeners) l();
}
export function usePickHint(): string | null {
return useSyncExternalStore(
(l) => (listeners.add(l), () => listeners.delete(l)),
() => current,
);
}
+1 -1
View File
@@ -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) {
+7
View File
@@ -18,6 +18,10 @@ declare global {
counts: () => { walls: number; openings: number; drawingLevels: number; coreJson: number };
/** Endpunkte aller 2D-Linien des Projekts ([123] Transformations-Test). */
lines: () => { a: { x: number; y: number }; b: { x: number; y: number } }[];
/** [137] Polylinien-Punkte der 2D-Elemente mit Id-Präfix (Präsentations-Massstabsbalken). */
polylines: (prefix: string) => { id: string; pts: { x: number; y: number }[] }[];
/** [137] Gewählte 2D-Elemente und Gruppen. */
selected: () => { drawings: string[]; groups: string[]; all: string };
};
}
}
@@ -40,5 +44,8 @@ export function installTestHooks(): void {
},
lines: () =>
getState().project.drawings2d.flatMap((d) => (d.geom.shape === "line" ? [{ a: d.geom.a, b: d.geom.b }] : [])),
polylines: (prefix) =>
getState().project.drawings2d.flatMap((d) => (d.id.startsWith(prefix) && d.geom.shape === "polyline" ? [{ id: d.id, pts: d.geom.pts }] : [])),
selected: () => ({ drawings: [...getState().selection.drawings], groups: [...getState().selection.groups], all: JSON.stringify(getState().selection) }),
};
}
+9 -2
View File
@@ -186,11 +186,17 @@ 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).
const gripDrawingIds = gripDrawingIdsFor(effectiveDrawingIds, (id) => {
// [137] Gewählte Gruppe: keine Mitglieds-Griffe (Vectorworks: erst die Gruppe betreten) — ein Ziehen am
// Körper verschiebt die Gruppe als Ganzes, statt einen der dicht liegenden Griffe zu erwischen.
const gripDrawingIds = gripDrawingIdsFor(selection.groups.length > 0 ? [] : effectiveDrawingIds, (id) => {
const d = project.drawings2d.find((x) => x.id === id);
return d ? drawingVertices(d, scaleDenominator).length : 0;
});
@@ -1039,6 +1045,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;
+14 -1
View File
@@ -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(