[333] Schnitt: waagrechte Griffe für Decke und Wand (Ende entlang der Schnittlinie ziehen, Kern sheet_height::end_ops)
check / check (push) Canceled after 0s
check / licenses (push) Canceled after 0s
check / e2e (push) Canceled after 0s
macos / native (push) Canceled after 0s

This commit is contained in:
Claude committed 2026-11-27 02:41:25 +00:00
1 parent 880d7751f9
commit c3bfe2cf59
15 files changed
+324 -17

No files matched your search

+1 -1
View File
@@ -91,7 +91,7 @@ export type { VerticalExtent } from "../geometry/grips";
export type { GripRequest, RingKind } from "../geometry/grips";
export { edgeArcToggle, type ArcRingKind } from "../geometry/grips";
export { clampInside, coincidentGripPoints, excavationGripPoints, gripArcWallRadius, gripArcWallResize, gripArcWallTarget, gripAxisLock, gripEdgeTarget, gripPolar, gripPolarPoint, openingGripPoint, openingSheetSlide, openingTypedPosition, contourMarks, sheetHeightDrag, snapSheetHeight, stairMoveHandle, stairParamPoints, wallGripPoints } from "../geometry/gripDrag";
export type { EdgeDrive, GripLocks, SheetHeightKind } from "../geometry/gripDrag";
export type { EdgeDrive, GripLocks, SheetEndKind, SheetHeightKind } from "../geometry/gripDrag";
export { openingPreviewProject, openingPreviewSvgs } from "../plan/openingPreview";
export type { OpeningPreviewSvgs } from "../plan/openingPreview";
export { surfaceOpeningInfo, surfaceOpeningGrips, surfaceOpeningGripPatch } from "../plan/surfaceOpening";
+3
View File
@@ -114,6 +114,9 @@ export type SheetHeightKind =
// Dach: Traufe, First (bzw. Neigung), Attika; Treppe: Austritt; Gelände: Oberkante (Netz) bzw. Sohle (Baugrube).
| "roofEave" | "roofTop" | "parapetTop" | "stairTop" | "stairBottom" | "contextTop" | "contextBottom" | "contourLine";
/** [333] Art eines waagrechten End-Griffs im Schnitt: Decken-Kante bzw. Wand-Ende (Kern `sheet_height::end_ops`). */
export type SheetEndKind = "ceilingEdge" | "wallEnd";
const SHEET_KIND = { wallTop: 0, openingTop: 1, openingBottom: 2, wallBottom: 3, ceilingTop: 4, ceilingBottom: 6,
roofEave: 7, roofTop: 8, parapetTop: 9, stairTop: 10, stairBottom: 11, contextTop: 4, contextBottom: 7, contourLine: 4 } as const;
+4 -1
View File
@@ -13,7 +13,7 @@ import { core } from "../engine/coreWasm";
import { toMarkedJson } from "../core/ops";
import { DEFAULT_SCALE_DENOMINATOR } from "../model/dimension";
import { textFrameCorners } from "../text/textFrame";
import type { SheetHeightKind } from "./gripDrag";
import type { SheetEndKind, SheetHeightKind } from "./gripDrag";
/** Punkt als `[x, y]` (Anfragen an den Kern). */
type P = [number, number];
@@ -67,6 +67,9 @@ export type GripRequest =
| { op: "vertexType"; id: string; index: number; vertexType: "corner" | "arc" | "spline" }
// [187] Höhen-Griff im Schnitt/in der Ansicht: Kante `kind` auf die Blatt-Höhe `a` (absolutes Z) ziehen (Kern `sheet_height.rs`).
| { op: "sheetHeight"; kind: SheetHeightKind; id: string; a: number; b?: number; index?: number; free?: boolean; newId: string; newName: string }
// [333] Waagrechter End-Griff im Schnitt: Ende `index` (0 links, 1 rechts im Blatt) von Decke/Wand um `a` m in u ziehen;
// `pt` = Punkt der Schnittlinie (u = 0), `delta` = u-Achse im Grundriss (Kern `sheet_height::end_ops`).
| { op: "sheetEnd"; kind: SheetEndKind; id: string; index: number; a: number; pt: P; delta: P }
| { op: "wallThickness" | "ceilingThickness"; id: string; thickness: number; newId: string; newName: string }
// [144] Wandöffnung gleiten lassen (Kern `opening_slide`): Griff-Zug nach `pt` bzw. Position `a` ab Wandanfang.
| { op: "openingSlide"; id: string; pt: P }
+1
View File
@@ -2770,6 +2770,7 @@ export const de = {
"cmd.field.length": "Länge",
"cmd.field.level": "Kote",
"grip.sheetHeight": "Kote {z} m · Höhe {d} m",
"grip.sheetEnd": "Ende {d} m entlang des Schnitts",
"grip.sheetWallBottomClamped": "Unterkante über Oberkante: Mindesthöhe 0.30 m",
"cmd.field.angle": "Winkel",
"cmd.field.width": "Breite",
+1
View File
@@ -2758,6 +2758,7 @@ export const en: Record<TranslationKey, string> = {
"cmd.field.length": "Length",
"cmd.field.level": "Level",
"grip.sheetHeight": "Level {z} m · height {d} m",
"grip.sheetEnd": "End {d} m along the section",
"grip.sheetWallBottomClamped": "Bottom above top: minimum height 0.30 m",
"cmd.field.angle": "Angle",
"cmd.field.width": "Width",
+6 -1
View File
@@ -64,7 +64,7 @@ import { reorderByIds } from "../model/reorder";
import { transformMutation } from "../tools/transform";
import type { CopyMode, TransformOp, TransformSelection } from "../tools/transform";
import { uniqueId } from "../tools/types";
import { gripPt, type GripRequest, type RingKind, type SheetHeightKind } from "../core";
import { gripPt, type GripRequest, type RingKind, type SheetEndKind, type SheetHeightKind } from "../core";
import { DEFAULT_SCALE_DENOMINATOR } from "../model/dimension";
import { DEFAULT_PRESETS, type TextStylePreset } from "../text/richText";
import { t } from "../i18n";
@@ -433,6 +433,8 @@ export interface ProjectSlice {
setCeilingThickness: (ceilingId: string, thickness: number) => void;
/** [187] Höhen-Griff im Schnitt/in der Ansicht: Kante `kind` des Bauteils `id` auf die Blatt-Höhe `y` (absolutes Z) ziehen. */
sheetHeightGrip: (kind: SheetHeightKind, id: string, y: number, free?: boolean, from?: number, index?: number) => void;
/** [333] Waagrechter End-Griff im Schnitt: Ende `end` (0 links, 1 rechts) von Decke/Wand um `du` m in u ziehen. */
sheetEndGrip: (kind: SheetEndKind, id: string, end: 0 | 1, du: number, base: Vec2, uAxis: Vec2) => void;
// ── Öffnungs-Editieren (Object-Info-Panel) ────────────────────────────────
/** Generischer immutabler Patch auf eine Öffnung (per ID). */
@@ -1387,6 +1389,9 @@ export function createProjectSlice(
newName: t("default.ceilingTypeSingle", { thickness: "{t}" }), // {t} setzt der Kern ein
}),
sheetEndGrip: (kind, id, end, du, base, uAxis) =>
applyGrip({ op: "sheetEnd", kind, id, index: end, a: du, pt: gripPt(base), delta: gripPt(uAxis) }),
// ── Öffnungs-Editieren ────────────────────────────────────────────────
updateOpening: (id, patch) => applyChange((p) => patchItem(p, "openings", id, patch)),
slideOpening: (id, to, coalesceKey) =>
+3
View File
@@ -40,6 +40,8 @@ declare global {
selected: () => { drawings: string[]; groups: string[]; all: string };
/** [144] Öffnungen (id, Wirtswand, Lage ab Wandanfang). */
openings: () => { id: string; hostWallId: string; position: number }[];
/** [333] Umriss einer Decke (Modell-Meter). */
ceilingOutline: (id: string) => { x: number; y: number }[];
/** [187] Höhen von Decken (UK/OK/Dicke), Wänden (UK/OK) und Fenstern (Brüstung/Höhe) aus dem Kern, in Metern (absolutes Z). */
heights: () => {
ceilings: { id: string; zBottom: number; zTop: number; thickness: number }[];
@@ -219,6 +221,7 @@ export function installTestHooks(): void {
polylines: (prefix) =>
getState().project.drawings2d.flatMap((d) => (d.id.startsWith(prefix) && d.geom.shape === "polyline" ? [{ id: d.id, pts: d.geom.pts }] : [])),
openings: () => (getState().project.openings ?? []).map((o) => ({ id: o.id, hostWallId: o.hostWallId, position: o.position })),
ceilingOutline: (id) => (getState().project.ceilings ?? []).find((c) => c.id === id)?.outline.map((q) => ({ x: q.x, y: q.y })) ?? [],
heights: () => {
const p = getState().project;
const ceilings = p.ceilings ?? [];
+77 -3
View File
@@ -35,6 +35,7 @@ import {
stairParamPoints,
wallGripPoints,
type GripLocks,
type SheetEndKind,
} from "../core";
import { areaMovePreview, drawingMovePreview, transformPreview } from "../tools/transform";
import { contextAnchor } from "./contextDrag";
@@ -115,6 +116,8 @@ export function useGripEditing(opts: {
slideOpening: (id: string, to: { position: number } | { pt: Vec2 }, coalesceKey?: string) => void;
/** [187] Höhen-Griff im Schnitt/in der Ansicht anwenden (Kern `sheet_height.rs`); EIN Aufruf je Zug. */
sheetHeightGrip: (kind: SheetHeightKind, id: string, y: number, free?: boolean, from?: number, index?: number) => void;
/** [333] Waagrechter End-Griff im Schnitt (Kern `sheet_height::end_ops`); EIN Aufruf je Zug. */
sheetEndGrip: (kind: SheetEndKind, id: string, end: 0 | 1, du: number, base: Vec2, uAxis: Vec2) => void;
moveStairBy: (id: string, delta: Vec2) => void;
/** [151] Parameter-Griff einer Podesttreppe ziehen (Index ohne den Bewegpunkt). */
dragStairParam?: (id: string, index: number, pt: Vec2) => void;
@@ -173,6 +176,7 @@ export function useGripEditing(opts: {
updateOpening,
slideOpening,
sheetHeightGrip,
sheetEndGrip,
moveStairBy,
moveRoomGrip,
moveCeilingGrip,
@@ -447,6 +451,43 @@ export function useGripEditing(opts: {
return [];
})();
// [333] Waagrechte End-Griffe im Schnitt (wie in Archicad): Decke an den Enden ihres Schnitts (Mitte der Dicke) bzw. Wand,
// deren Achse höchstens 30° von der Schnittlinie abweicht (Mitte der Höhe). Ziehen verlängert/verkürzt das Bauteil entlang
// der Schnittlinie; der Kern (`end_ops`) rechnet beim Loslassen. Nur gerade Schnittlinien (bei Knicken ist u nicht eindeutig).
type SheetEndGrip = { kind: SheetEndKind; id: string; end: 0 | 1; pt: Vec2; horizontal: true };
const sheetEndGrips: SheetEndGrip[] = (() => {
if (modelEditable || !sheet?.base) return [];
const lvl = project.drawingLevels.find((l) => l.id === sheet.levelId);
if (!lvl || lvl.kind !== "section" || (lvl.bendPoints?.length ?? 0) > 0) return [];
const ends = (kind: SheetEndKind, id: string, owner: "wall" | "ceiling", zMid: number): SheetEndGrip[] => {
const polys = sheetOwnerOutlines(sheet.levelId, owner, id);
let u0 = Infinity, u1 = -Infinity;
for (const poly of polys) for (const q of poly) { u0 = Math.min(u0, q.x); u1 = Math.max(u1, q.x); }
if (!(u1 > u0)) return [];
return [
{ kind, id, end: 0, pt: { x: u0, y: zMid }, horizontal: true },
{ kind, id, end: 1, pt: { x: u1, y: zMid }, horizontal: true },
];
};
if (selectedWallId && selectedWallIds.length <= 1 && !selectedOpeningId) {
const w = project.walls.find((x) => x.id === selectedWallId);
if (!w || w.locked || w.bulge) return [];
const len = Math.hypot(w.end.x - w.start.x, w.end.y - w.start.y);
if (len < 1e-6) return [];
const cos = Math.abs(((w.end.x - w.start.x) * sheet.uAxis.x + (w.end.y - w.start.y) * sheet.uAxis.y) / len);
if (cos < Math.cos((30 * Math.PI) / 180)) return [];
const { zBottom, zTop } = verticalExtents(project, [w]).walls[0];
return ends("wallEnd", w.id, "wall", (zBottom + zTop) / 2);
}
if (selectedCeilingId && !selectedOpeningId) {
const c = (project.ceilings ?? []).find((x) => x.id === selectedCeilingId);
if (!c || c.locked) return [];
const { zBottom, zTop } = verticalExtents(project, [], [c]).ceilings[0];
return ends("ceilingEdge", c.id, "ceiling", (zBottom + zTop) / 2);
}
return [];
})();
const MAX_INSERT_GRIP_POINTS = 100; // Kataster-Umrisse mit tausenden Punkten: keine Rauten
const MAX_CONTOUR_GRIPS = 600; // Höhenlinien-Sätze mit tausenden Punkten: gar keine Punkt-Griffe
/** Anteil entlang der Kante, an dem der Einfüge-Griff sitzt (neben dem Kanten-Anfasser in der Mitte). */
@@ -494,8 +535,9 @@ export function useGripEditing(opts: {
// verschiebt die Öffnung entlang der Wirts-Wand (siehe applyGrip →
// `position`). Nur bei genau einer selektierten Öffnung (Auswahl exklusiv).
if (!modelEditable && effectiveDrawingIds.length === 0) {
sheetHeightGrips.forEach((_, i) => { gripOwners.push({ localIndex: i }); gripOwnerRange.push([0, sheetHeightGrips.length - 1]); });
return sheetHeightGrips.map((g) => g.pt);
const all: (Vec2 & { horizontal?: boolean })[] = [...sheetHeightGrips.map((g) => g.pt), ...sheetEndGrips.map((g) => ({ ...g.pt, horizontal: true }))];
all.forEach((_, i) => { gripOwners.push({ localIndex: i }); gripOwnerRange.push([0, all.length - 1]); });
return all;
}
if (selectedOpeningId && modelEditable) {
const op = (project.openings ?? []).find((o) => o.id === selectedOpeningId);
@@ -902,6 +944,8 @@ export function useGripEditing(opts: {
const pendingOpeningMoveRef = useRef<{ id: string; position: number } | null>(null);
/** Aufgeschobene Höhen-Änderung im Schnitt (Kante `kind` auf die Höhe `y`, Kern `sheetHeight`). */
const pendingSheetHeightRef = useRef<{ kind: SheetHeightKind; id: string; y: number; free: boolean; from: number; index?: number } | null>(null);
/** [333] Aufgeschobener End-Zug im Schnitt (Ende von Decke/Wand um `du` in u, Kern `sheetEnd`). */
const pendingSheetEndRef = useRef<{ kind: SheetEndKind; id: string; end: 0 | 1; du: number } | null>(null);
/** [187] Kote der gezogenen Kante im laufenden Höhen-Zug (Tab-Feld „Kote“). */
const sheetDragRef = useRef<{ z: number } | null>(null);
/** Laufendes Blatt-Delta (u, Meter) eines Zugs im Schnitt (s. moveInSheet). */
@@ -1461,6 +1505,9 @@ export function useGripEditing(opts: {
const ph = pendingSheetHeightRef.current;
pendingSheetHeightRef.current = null;
if (ph) sheetHeightGrip(ph.kind, ph.id, ph.y, ph.free, ph.from, ph.index);
const pe = pendingSheetEndRef.current;
pendingSheetEndRef.current = null;
if (pe && sheet?.base) sheetEndGrip(pe.kind, pe.id, pe.end, pe.du, sheet.base, sheet.uAxis);
const pc = pendingContourRef.current;
pendingContourRef.current = null;
if (pc?.mesh) storeState().moveMeshPoint(pc.id, pc.index, pc.pt);
@@ -1650,6 +1697,7 @@ export function useGripEditing(opts: {
pendingWallMoveRef.current = null;
pendingOpeningMoveRef.current = null;
pendingSheetHeightRef.current = null;
pendingSheetEndRef.current = null;
sheetDragRef.current = null;
sheetDuRef.current = null;
pendingBodyRef.current = null;
@@ -1734,6 +1782,29 @@ export function useGripEditing(opts: {
setDraft({ preview, vertices: [], snap: null });
};
/**
* [333] End-Zug anwenden: Blatt-Delta `du` (u, Meter, 1-cm-Raster ausser `free`). Nur Vorschau und HUD — die Umrisse der
* Bauteil-Schnittfläche werden am gezogenen Ende um `du` verschoben; das Projekt ändert sich beim Loslassen (Kern `sheetEnd`).
*/
const applySheetEnd = (g: SheetEndGrip, rawU: number, free: boolean) => {
const du0 = rawU - g.pt.x;
const du = free ? du0 : Math.round(du0 * 100) / 100;
pendingSheetEndRef.current = { kind: g.kind, id: g.id, end: g.end, du };
const edgeU = g.pt.x;
const preview: DraftShape[] = sheetOwnerOutlines(sheet!.levelId, g.kind === "wallEnd" ? "wall" : "ceiling", g.id).map((pts) => ({
kind: "poly" as const,
// Die Ecken am gezogenen Ende (äusserste u) wandern mit.
pts: pts.map((q) => (Math.abs(q.x - edgeU) < 1e-6 ? { x: q.x + du, y: q.y } : q)),
closed: true,
}));
setDraft({
preview,
vertices: [],
snap: null,
hud: { at: { x: g.pt.x + du, y: g.pt.y }, text: t("grip.sheetEnd", { d: (du >= 0 ? "+" : "") + du.toFixed(2) }) },
});
};
/**
* [187] Höhen-Zug anwenden: nur Vorschau und HUD (das Projekt ändert sich beim Loslassen, EIN Undo-Schritt).
* `y` = Blatt-Höhe (absolutes Z); `free` ohne 1-cm-Raster.
@@ -1773,6 +1844,8 @@ export function useGripEditing(opts: {
// Schnitt/Ansicht ([187]): Höhen-Griff (Wand, Öffnung, Decke).
if (!modelEditable && sheet) {
gripDragInfoRef.current = { index, raw };
const endGrip = sheetEndGrips[index - sheetHeightGrips.length];
if (endGrip) return applySheetEnd(endGrip, raw.x, !!mods.ctrl);
const typed = gripEditRef.current?.locks.length; // Tab: getippte Kote
if (typed != null) return applySheetHeight(index, typed, true);
if (mods.ctrl) return applySheetHeight(index, raw.y, true);
@@ -2057,8 +2130,9 @@ export function useGripEditing(opts: {
// danach wie onGripEnd aufräumen.
onGripCancel: (index: number, origin: Vec2) => {
// Ausstehender Zug: einfach verwerfen (das Projekt wurde nie verändert).
if (pendingSheetHeightRef.current) {
if (pendingSheetHeightRef.current || pendingSheetEndRef.current) {
pendingSheetHeightRef.current = null;
pendingSheetEndRef.current = null;
} else if (pendingGripRef.current || pendingWallGripRef.current || pendingAreaGripRef.current || pendingContourRef.current) {
pendingContourRef.current = null;
pendingGripRef.current = null;
+2
View File
@@ -389,6 +389,7 @@ export function useProjectActions(
const updateCeiling = useStore((s) => s.updateCeiling);
const setCeilingThickness = useStore((s) => s.setCeilingThickness);
const sheetHeightGrip = useStore((s) => s.sheetHeightGrip);
const sheetEndGrip = useStore((s) => s.sheetEndGrip);
const updateStair = useStore((s) => s.updateStair);
const moveStairBy = useStore((s) => s.moveStairBy);
const dragStairParam = useStore((s) => s.dragStairParam);
@@ -513,6 +514,7 @@ export function useProjectActions(
updateCeiling,
setCeilingThickness,
sheetHeightGrip,
sheetEndGrip,
updateStair,
moveStairBy,
dragStairParam,
+1
View File
@@ -137,6 +137,7 @@ export function ViewportCenter(props: {
updateOpening: pa.updateOpening,
slideOpening: pa.slideOpening,
sheetHeightGrip: pa.sheetHeightGrip,
sheetEndGrip: pa.sheetEndGrip,
moveStairBy: pa.moveStairBy,
dragStairParam: pa.dragStairParam,
moveRoomGrip: pa.moveRoomGrip,
+9 -5
View File
@@ -1189,16 +1189,20 @@ export const PlanView = forwardRef<PlanViewHandle, PlanViewProps>(
return idx.map((i) => {
const s = toLocal(grips![i]);
const insert = !!(grips![i] as { insert?: boolean }).insert;
// [333] Waagrechter End-Griff im Schnitt: breites flaches Rechteck (links-rechts ziehen), nicht das Quadrat der Höhen-Griffe.
const horizontal = !!(grips![i] as { horizontal?: boolean }).horizontal;
const hover = hoverGrip === i;
const half = (gripSquareHalfPx(insert, hover) * k * (hover ? 1 : crowd)) / meet;
const halfW = horizontal ? half * 1.9 : half;
const halfH = horizontal ? half * 0.8 : half;
return (
<rect
key={`grip-${i}`}
className={"plan-grip" + (insert ? " plan-grip-insert" : "") + (hover ? " plan-grip-hover" : "")}
x={s.x - half}
y={s.y - half}
width={half * 2}
height={half * 2}
className={"plan-grip" + (insert ? " plan-grip-insert" : "") + (horizontal ? " plan-grip-horizontal" : "") + (hover ? " plan-grip-hover" : "")}
x={s.x - halfW}
y={s.y - halfH}
width={halfW * 2}
height={halfH * 2}
pointerEvents="none"
/>
);