Schnitt/Ansicht: Fenster/Tueren waagrecht ziehen (Position entlang der Wirtswand), Decken im Blatt greifbar; Objekt-Info: Bauteil-Masse als Ausdehnung X/Y statt Breite/Hoehe, bei Oeffnungen keine bbox

This commit is contained in:
karim committed 2026-10-21 21:15:22 +02:00
1 parent 7410bb5f66
commit e4641357fd
7 files changed
+89 -11

No files matched your search

+2
View File
@@ -406,6 +406,8 @@ export const de = {
"attr.size": "Maße",
"attr.width": "Breite",
"attr.height": "Höhe",
"attr.extentX": "Ausdehnung X",
"attr.extentY": "Ausdehnung Y",
// Objekt-Info-Palette (ObjectInfoPanel)
"objinfo.title": "Objekt-Info",
+2
View File
@@ -404,6 +404,8 @@ export const en: Record<TranslationKey, string> = {
"attr.size": "Size",
"attr.width": "Width",
"attr.height": "Height",
"attr.extentX": "Extent X",
"attr.extentY": "Extent Y",
// Objekt-Info-Palette (ObjectInfoPanel)
"objinfo.title": "Object Info",
+8 -3
View File
@@ -269,6 +269,7 @@ export function AttributesPanel() {
const bboxW = sel.bbox.maxX - sel.bbox.minX;
const bboxH = sel.bbox.maxY - sel.bbox.minY;
const isModelElement = !!(sel.wall || sel.ceiling || sel.roof || sel.stair || sel.room);
return (
<div className="attr-panel">
@@ -793,12 +794,16 @@ 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. */}
{!isAnnotation && (
{/* 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
Abschnitt, dort entfällt die bbox ganz. */}
{!isAnnotation && !sel.opening && (
<>
<div className="attr-section-label">{t("attr.size")}</div>
<span className="attr-key">{t("attr.width")}</span>
<span className="attr-key">{t(isModelElement ? "attr.extentX" : "attr.width")}</span>
<span className="attr-val attr-readonly">{formatM(bboxW)}</span>
<span className="attr-key">{t("attr.height")}</span>
<span className="attr-key">{t(isModelElement ? "attr.extentY" : "attr.height")}</span>
<span className="attr-val attr-readonly">{formatM(bboxH)}</span>
</>
)}
+32 -3
View File
@@ -572,6 +572,12 @@ export interface PlanViewProps {
selectedDrawingIds?: string[];
/** Griff-Zieh-Treiber: Live-Bewegung (gesnappt) + Abschluss. */
gripHandlers?: GripHandlers;
/**
* Schnitt-/Ansichts-Blatt: zusätzlich gewählte Öffnungen und Decken per
* Körper-Zug greifbar (die App überträgt das Blatt-Delta entlang der
* Schnittlinie, s. useGripEditing `sheet`). Im Grundriss aus.
*/
sheetBodies?: boolean;
/**
* Farbe des Auswahlrahmens (Marquee-Ziehauswahl). Einstellbar im
* Einstellungs-Fenster (State in ViewSlice); Default = Akzent „Yuyake".
@@ -598,6 +604,16 @@ export interface PlanViewProps {
}
/** Treiber für das Ziehen von Editier-Griffen (von App bereitgestellt). */
/** Gegriffener Körper beim Parallel-Verschieben. */
export interface BodyTarget {
wallId?: string;
drawingId?: string;
/** Nur im Schnitt/in der Ansicht (`sheetBodies`). */
openingId?: string;
/** Nur im Schnitt/in der Ansicht (`sheetBodies`). */
ceilingId?: string;
}
export interface GripHandlers {
onGripMove(index: number, raw: Vec2, pxPerMeter: number, mods: ToolMods): void;
/**
@@ -609,7 +625,7 @@ export interface GripHandlers {
*/
onMoveBody(
delta: Vec2,
target?: { wallId?: string; drawingId?: string },
target?: BodyTarget,
mods?: ToolMods,
): void;
/**
@@ -672,6 +688,7 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
selectedWallIds,
selectedCeilingIds,
selectedOpeningIds,
sheetBodies = false,
selectedStairIds,
selectedRoomIds,
selectedRoofIds,
@@ -1251,7 +1268,7 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
const moveDrag = useRef<{
pointerId: number;
last: Vec2;
target: { wallId?: string; drawingId?: string };
target: BodyTarget;
} | null>(null);
// Transiente Stempel-Griff-Zieh-Daten: letzter Modellpunkt, gegen den das
// inkrementelle Delta gebildet wird (verschiebt NUR den Raum-Stempel-Anker).
@@ -1748,7 +1765,19 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
const grabbedBody = (
clientX: number,
clientY: number,
): { wallId?: string; drawingId?: string } | null => {
): BodyTarget | null => {
// Schnitt/Ansicht: gewählte Öffnung bzw. Decke unter dem Cursor (Vorrang vor
// der Wirtswand, die im Blatt dahinter liegt).
if (sheetBodies) {
const hi = hitTest(clientX, clientY);
const p = hi !== null ? plan.primitives[hi] : null;
if (p && "openingId" in p && p.openingId && selectedOpeningIds?.includes(p.openingId)) {
return { openingId: p.openingId };
}
if (p && p.kind === "polygon" && p.ceilingId && selectedCeilingIds?.includes(p.ceilingId)) {
return { ceilingId: p.ceilingId };
}
}
const selWalls = new Set(selectedWallIds ?? []);
if (selWalls.size) {
const hi = hitTest(clientX, clientY);
+41 -3
View File
@@ -16,6 +16,7 @@ import type { DraftShape, SnapResult, SnapSettings, ToolDraft, ToolMods } from "
import { applyAngleConstraint, computeSnap } from "../tools/snapping";
import { useCommandTabShortcut } from "./useKeyboardShortcuts";
import { sheetOwnerOutlines } from "../tools/sheetSnapGeometry";
import type { BodyTarget } from "../plan/PlanView";
import type { CommandLineHandle } from "../ui/CommandLine";
import type { CommandEngine } from "../commands/engine";
@@ -497,6 +498,8 @@ export function useGripEditing(opts: {
const pendingAreaGripRef = useRef<{ kind: "room" | "ceiling"; id: string; index: number; flat: number; pt: Vec2 } | null>(null);
const pendingAreaMoveRef = useRef<{ kind: "ceiling" | "room" | "stair"; id: string; total: Vec2 } | null>(null);
const pendingWallMoveRef = useRef<{ wallId: string; total: Vec2 } | null>(null);
/** Aufgeschobene Öffnungs-Verschiebung im Schnitt/in der Ansicht (neue `position`). */
const pendingOpeningMoveRef = useRef<{ id: string; position: number } | null>(null);
/** Laufendes Blatt-Delta (u, Meter) eines Zugs im Schnitt (s. moveInSheet). */
const sheetDuRef = useRef<{ id: string; du: number } | null>(null);
const pendingBodyRef = useRef<{ drawingId: string; total: Vec2 } | null>(null);
@@ -992,6 +995,9 @@ export function useGripEditing(opts: {
moveGripOf(c.drawingId, c.wallId, c.index, { x: c.pos.x + pwm.total.x, y: c.pos.y + pwm.total.y }, scaleDenominator);
}
}
const pom = pendingOpeningMoveRef.current;
pendingOpeningMoveRef.current = null;
if (pom) updateOpening(pom.id, { position: pom.position });
const pa = pendingAreaMoveRef.current;
pendingAreaMoveRef.current = null;
if (pa && (pa.total.x !== 0 || pa.total.y !== 0)) {
@@ -1082,6 +1088,7 @@ export function useGripEditing(opts: {
pendingAreaGripRef.current = null;
pendingAreaMoveRef.current = null;
pendingWallMoveRef.current = null;
pendingOpeningMoveRef.current = null;
sheetDuRef.current = null;
pendingBodyRef.current = null;
pendingEdgeRef.current = null;
@@ -1098,7 +1105,7 @@ export function useGripEditing(opts: {
const moveInSheet = (
sh: { levelId: string; uAxis: Vec2 },
delta: Vec2,
target?: { wallId?: string; drawingId?: string },
target?: BodyTarget,
) => {
if (target?.drawingId) {
// 2D-Element der Ebene selbst: normales Körper-Verschieben im Blatt-Raum.
@@ -1111,8 +1118,12 @@ export function useGripEditing(opts: {
setDraft({ preview: bodyPreviewShapes(), vertices: [], snap: null });
return;
}
if (target?.openingId) {
moveOpeningInSheet(sh, delta, target.openingId);
return;
}
const wallId = target ? target.wallId ?? null : selectedWallId;
const ceilingId = !target && !wallId ? selectedCeilingId : null;
const ceilingId = target ? target.ceilingId ?? null : !wallId ? selectedCeilingId : null;
const kind = wallId ? "wall" : ceilingId ? "ceiling" : null;
const id = wallId ?? ceilingId;
if (!kind || !id) return;
@@ -1135,6 +1146,33 @@ export function useGripEditing(opts: {
setDraft({ preview, vertices: [], snap: null });
};
// Öffnung im Blatt waagrecht ziehen: Blatt-Delta (u) → Verschiebung entlang
// der Wirtswand (Δposition = du · (u-Achse · Wandrichtung)); bei einer quer
// geschnittenen Wand (Achse ⟂ Schnittlinie) bewegt sie sich darum kaum —
// richtig so, sie läuft ja in die Tiefe. Projekt erst beim Loslassen.
const moveOpeningInSheet = (sh: { levelId: string; uAxis: Vec2 }, delta: Vec2, openingId: string) => {
const op = (project.openings ?? []).find((o) => o.id === openingId);
const w = op && project.walls.find((x) => x.id === op.hostWallId);
if (!op || !w || op.locked) return;
const axis = normalize(sub(w.end, w.start));
const factor = dot(sh.uAxis, axis);
if (Math.abs(factor) < 0.15) return;
const prevDu = sheetDuRef.current && sheetDuRef.current.id === openingId ? sheetDuRef.current.du : 0;
const len = Math.hypot(w.end.x - w.start.x, w.end.y - w.start.y);
// Auf die Wand klemmen (Öffnung bleibt drin) — auch die Vorschau.
const rawPos = op.position + (prevDu + delta.x) * factor;
const pos = Math.max(0, Math.min(len - op.width, rawPos));
const du = (pos - op.position) / factor;
sheetDuRef.current = { id: openingId, du };
pendingOpeningMoveRef.current = { id: openingId, position: pos };
const preview: DraftShape[] = sheetOwnerOutlines(sh.levelId, "opening", openingId).map((pts) => ({
kind: "poly",
pts: pts.map((q) => ({ x: q.x + du, y: q.y })),
closed: true,
}));
setDraft({ preview, vertices: [], snap: null });
};
const gripHandlers = {
onGripMove: (index: number, raw: Vec2, pxPerMeter: number, mods: ToolMods) => {
// Erster Move-Event nach dem Grab (gripDragInfoRef noch leer): die
@@ -1217,7 +1255,7 @@ export function useGripEditing(opts: {
},
onMoveBody: (
delta: Vec2,
target?: { wallId?: string; drawingId?: string },
target?: BodyTarget,
mods?: ToolMods,
) => {
// Shift = Ortho: das Delta auf die dominante Achse (H/V) zwingen —
+3 -2
View File
@@ -60,7 +60,7 @@ export function snapSegmentsFromPrimitives(prims: readonly Primitive[]): SnapSeg
}
/** Bauteil-Art, deren Schnittflächen im Blatt gezogen werden können. */
export type SheetOwnerKind = "wall" | "ceiling";
export type SheetOwnerKind = "wall" | "ceiling" | "opening";
/**
* Schnittflächen der Ebene `levelId` je Quell-Bauteil ablegen (aus den Plan-
@@ -79,7 +79,8 @@ export function setSheetOwnerOutlines(levelId: string, prims: readonly Primitive
};
for (const p of prims) {
if (p.kind !== "polygon") continue;
if (p.wallId) add(`wall:${p.wallId}`, p.pts);
if (p.openingId) add(`opening:${p.openingId}`, p.pts);
else if (p.wallId) add(`wall:${p.wallId}`, p.pts);
else if (p.ceilingId) add(`ceiling:${p.ceilingId}`, p.pts);
}
outlinesByLevel.set(levelId, map);
+1
View File
@@ -1331,6 +1331,7 @@ function SectionPlanView({
selectedDrawingId={selectedDrawingId}
selectedDrawingIds={selectedDrawingIds}
gripHandlers={gripHandlers}
sheetBodies
/>
{/* NACH PlanView gerendert (nicht als box-shadow auf .pane), damit der
Isolations-Rahmen über der PlanView-SVG sichtbar bleibt. */}