[T2] Bogenwand: Bogenlänge per Tab über dem Halbkreis (Seite aus dem Cursor), Vorschau mit echtem Bulge

This commit is contained in:
Claude committed 2026-11-10 13:08:16 +00:00
1 parent 7e6b59f1ea
commit ba4de7b677
9 files changed
+150 -31

No files matched your search

+52 -12
View File
@@ -253,24 +253,40 @@ fn nearest_sweep(d: f64, old: f64, tau: f64) -> f64 {
if (ccw - old).abs() <= (cw - old).abs() { ccw } else { cw }
}
/// [T2] Zielpunkt eines Endpunkt-Griffs der Bogenwand samt Bogenlänge der Wand danach: mit `length` (Tab)
/// der Punkt dieser Bogenlänge vom festen Ende ([`arc_wall_point_at_length`]), sonst der auf den Kreis
/// projizierte Cursor `raw`. `None` bei Unsinn.
/// [T2] Endpunkt-Griff der Bogenwand: neue Wand `(Start, Ende, Bulge)`. Mit `length` (Tab, Bogenlänge ab dem
/// festen Ende, auch über den Halbkreis hinaus) legt der Cursor `raw` nur die SEITE fest ([`arc_length_sweep`]), der
/// Öffnungswinkel ist dann genau `length / r` — nicht die nächstliegende von zwei Lösungen mit gleichem Endpunkt.
/// Ohne `length` der auf den Kreis projizierte Cursor ([`arc_wall_endpoint`]). `None` bei Unsinn.
pub fn arc_wall_resize(s: P, e: P, bulge: f64, index: usize, length: Option<f64>, raw: P) -> Option<(P, P, f64)> {
let Some(l) = length else { return arc_wall_endpoint(s, e, bulge, index, raw) };
let a = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(s.0, s.1), kernel2d::Vec2::new(e.0, e.1), Some(bulge))?;
let (th, sweep) = arc_length_sweep(&a, index, l, raw)?;
let (c, r) = ((a.center.x, a.center.y), a.r);
let at = (c.0 + r * jsnum::cos(th), c.1 + r * jsnum::sin(th));
let nb = -jsnum::tan(sweep / 4.0);
nb.is_finite().then(|| if index == 0 { (at, e, nb) } else { (s, at, nb) })
}
/// [T2] Zielpunkt eines Endpunkt-Griffs der Bogenwand samt Bogenlänge der Wand danach (s. [`arc_wall_resize`]).
pub fn arc_wall_grip_target(s: P, e: P, bulge: f64, index: usize, length: Option<f64>, raw: P) -> Option<(P, f64)> {
let p = match length {
Some(l) => arc_wall_point_at_length(s, e, bulge, index, l, raw)?,
None => raw,
};
let (ns, ne, nb) = arc_wall_endpoint(s, e, bulge, index, p)?;
let (ns, ne, nb) = arc_wall_resize(s, e, bulge, index, length, raw)?;
let a = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(ns.0, ns.1), kernel2d::Vec2::new(ne.0, ne.1), Some(nb))?;
Some((if index == 0 { ns } else { ne }, a.length()))
}
/// [T2] Bogenlängen-Eingabe (Tab) am Endpunkt einer Bogenwand: der Punkt, der `length` (Bogenlänge,
/// Meter) vom festen Ende entfernt auf dem Kreis liegt, auf der Seite des Cursors `raw` (am Fixpunkt:
/// Laufrichtung des bisherigen Bogens). `None` bei Unsinn oder `length` ≤ 0 bzw. ≥ Vollkreis.
/// Meter) vom festen Ende entfernt auf dem Kreis liegt, auf der Seite des Cursors `raw`. `None` bei Unsinn
/// oder `length` ≤ 0 bzw. ≥ Vollkreis.
pub fn arc_wall_point_at_length(s: P, e: P, bulge: f64, index: usize, length: f64, raw: P) -> Option<P> {
let a = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(s.0, s.1), kernel2d::Vec2::new(e.0, e.1), Some(bulge))?;
let (th, _) = arc_length_sweep(&a, index, length, raw)?;
Some((a.center.x + a.r * jsnum::cos(th), a.center.y + a.r * jsnum::sin(th)))
}
/// Winkel des bewegten Endpunkts und neuer vorzeichenbehafteter Öffnungswinkel für die Bogenlänge `length`
/// vom festen Ende. Seite eindeutig aus dem Cursor: Vorzeichen des Winkels Cursor − festes Ende (in (−π, π]);
/// genau auf dem festen Ende oder gegenüber (|d| ≈ 0) gilt die bisherige Laufrichtung.
fn arc_length_sweep(a: &crate::wall_arc::WallArc, index: usize, length: f64, raw: P) -> Option<(f64, f64)> {
let (c, r) = ((a.center.x, a.center.y), a.r);
let tau = 2.0 * PI;
if !(length.is_finite() && length > 0.0 && length / r < tau - 1e-6) {
@@ -285,8 +301,9 @@ pub fn arc_wall_point_at_length(s: P, e: P, bulge: f64, index: usize, length: f6
}
None => run_dir,
};
let ang = fixed_angle + side * length / r;
Some((c.0 + r * jsnum::cos(ang), c.1 + r * jsnum::sin(ang)))
let th = fixed_angle + side * length / r;
// Start bewegt: Öffnungswinkel läuft von th zum festen Ende (Gegenrichtung), Ende bewegt: vom festen Start zu th.
Some((th, if index == 0 { -side } else { side } * length / r))
}
/// [T2] Radius-Griff (Scheitel) einer Bogenwand mit festem Mittelpunkt: der Mittelpunkt und der Öffnungswinkel
@@ -757,6 +774,29 @@ mod tests {
assert!(arc_wall_point_at_length(s, e, 1.0, 1, 100.0, (0.0, 0.0)).is_none());
}
/// [T2] Bogenlänge über dem Halbkreis: die Seite kommt aus dem Cursor, der Öffnungswinkel ist genau l / r.
#[test]
fn bogenwand_bogenlaenge_ueber_halbkreis() {
let (s, e) = ((0.0, 0.0), (4.0, 0.0)); // Halbkreis r = 2
let l = 1.5 * PI * 2.0; // 270°
for (raw, side) in [((3.0, 3.0), -1.0), ((3.0, -3.0), 1.0)] {
let (ns, ne, nb) = arc_wall_resize(s, e, 1.0, 1, Some(l), raw).unwrap();
let a = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(ns.0, ns.1), kernel2d::Vec2::new(ne.0, ne.1), Some(nb)).unwrap();
assert!(close(ns, s) && (a.length() - l).abs() < 1e-9, "{} {raw:?}", a.length());
assert!((a.center.x - 2.0).abs() < 1e-9 && a.center.y.abs() < 1e-9 && (a.r - 2.0).abs() < 1e-9);
assert!((a.sweep - side * 1.5 * PI).abs() < 1e-9, "{} {raw:?}", a.sweep);
}
// Start bewegt, gleiche Länge: das Ende bleibt, die Länge stimmt.
let (ns, ne, nb) = arc_wall_resize(s, e, 1.0, 0, Some(l), (1.0, 3.0)).unwrap();
let a = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(ns.0, ns.1), kernel2d::Vec2::new(ne.0, ne.1), Some(nb)).unwrap();
assert!(close(ne, e) && (a.length() - l).abs() < 1e-9 && a.sweep.abs() > PI, "{}", a.sweep);
// Dieselbe Länge, anderer Cursor-Seite → gespiegelte Wand (eindeutig, nicht „die nächstliegende“).
let (_, e1, _) = arc_wall_resize(s, e, 1.0, 1, Some(l), (3.0, 3.0)).unwrap();
let (_, e2, _) = arc_wall_resize(s, e, 1.0, 1, Some(l), (3.0, -3.0)).unwrap();
assert!(close(e1, (2.0, -2.0)) && close(e2, (2.0, 2.0)), "{e1:?} {e2:?}");
assert!(arc_wall_resize(s, e, 1.0, 1, Some(4.0 * PI), (3.0, 3.0)).is_none());
}
#[test]
fn bogenwand_griff_ziel() {
let (s, e) = ((0.0, 0.0), (4.0, 0.0));
+19 -4
View File
@@ -108,6 +108,8 @@ pub struct Request {
h: N,
fx: N,
fy: N,
/// [T2] Getippte Bogenlänge (Tab) beim Endpunkt-Griff einer Bogenwand; fehlt = NaN = Cursor.
arc_length: N,
thickness: N,
pt: [N; 2],
delta: [N; 2],
@@ -130,6 +132,7 @@ impl Request {
"h" => self.h.0,
"fx" => self.fx.0,
"fy" => self.fy.0,
"arcLength" => self.arc_length.0,
_ => self.thickness.0,
}
}
@@ -214,8 +217,8 @@ pub fn run(lk: &Lookup, req: &Request) -> Result<GripResult, String> {
}
let f: Box<dyn Fn(&Value, bool) -> Option<Value>> = match op {
"moveGrip" => {
let (index, (x, y), scale, free) = (r.n("index"), r.p("pt"), r.n("scale"), r.free);
Box::new(move |e, wall| if wall { Some(wall_grip(e, index, x, y, free)) } else { drawing_grip(e, index, x, y, scale, free) })
let (index, (x, y), scale, free, arc_length) = (r.n("index"), r.p("pt"), r.n("scale"), r.free, r.n("arcLength"));
Box::new(move |e, wall| if wall { Some(wall_grip(e, index, x, y, free, arc_length)) } else { drawing_grip(e, index, x, y, scale, free) })
}
"moveBy" => {
let (dx, dy) = r.p("delta");
@@ -401,7 +404,7 @@ pub fn run(lk: &Lookup, req: &Request) -> Result<GripResult, String> {
// ── Wand ─────────────────────────────────────────────────────────────────────
fn wall_grip(w: &Value, index: f64, x: f64, y: f64, fixed_center: bool) -> Value {
fn wall_grip(w: &Value, index: f64, x: f64, y: f64, fixed_center: bool, arc_length: f64) -> Value {
// Bogenwand ([T2]): Griff 2 = Bogenscheitel; der Bogen geht durch den gezogenen Punkt.
if index == 2.0 {
let (s, e) = (xy(field(w, "start").unwrap_or(&Value::Null)), xy(field(w, "end").unwrap_or(&Value::Null)));
@@ -422,7 +425,7 @@ fn wall_grip(w: &Value, index: f64, x: f64, y: f64, fixed_center: bool) -> Value
if index == 0.0 || index == 1.0 {
let (s, e) = (xy(field(w, "start").unwrap_or(&Value::Null)), xy(field(w, "end").unwrap_or(&Value::Null)));
if let Some(b) = field(w, "bulge").and_then(Value::as_f64).filter(|b| crate::wall_arc::is_arc_bulge(Some(*b))) {
return match crate::grip_drag::arc_wall_endpoint(s, e, b, index as usize, (x, y)) {
return match crate::grip_drag::arc_wall_resize(s, e, b, index as usize, Some(arc_length).filter(|l| l.is_finite()), (x, y)) {
Some((ns, ne, nb)) => with_all(w, vec![("start", pt(ns.0, ns.1)), ("end", pt(ne.0, ne.1)), ("bulge", js_num(nb))]),
None => w.clone(),
};
@@ -1458,6 +1461,18 @@ mod tests {
assert_eq!(xy(&e["start"]), (0.0, 0.0));
}
/// [T2] Endpunkt-Griff mit getippter Bogenlänge über dem Halbkreis: Öffnungswinkel l / r, Seite vom Cursor.
#[test]
fn bogenwand_endpunkt_bogenlaenge_ueber_halbkreis() {
let r = root(json!({"walls": [{"id": "w", "start": {"x": 0, "y": 0}, "end": {"x": 4, "y": 0}, "bulge": 1.0}]}));
let l = 3.0 * std::f64::consts::PI; // 270° bei r = 2
let res = run(&Lookup::plain(&r), &rq(json!({"op": "moveGrip", "wallId": "w", "index": 1, "pt": [2, -2], "arcLength": l}))).unwrap();
let e = res.ops[0].to_json()["entity"].clone();
let (s, en) = (xy(&e["start"]), xy(&e["end"]));
let a = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(s.0, s.1), kernel2d::Vec2::new(en.0, en.1), e["bulge"].as_f64()).unwrap();
assert!((a.length() - l).abs() < 1e-9 && a.sweep.abs() > std::f64::consts::PI, "{} {e}", a.length());
}
/// [172] Masszahl-Griff eines Radius-/Durchmesser-/Bogenmasses: Lage an der Zahl, rastet ein, Alt = frei.
#[test]
fn rundmass_masszahl_griff_rastet_ein() {
+12
View File
@@ -47,6 +47,18 @@ pub fn grip_arc_wall_target(sx: f64, sy: f64, ex: f64, ey: f64, bulge: f64, inde
}
}
/// [T2] Endpunkt-Griff einer Bogenwand (`grip_drag::arc_wall_resize`): die ganze Wand danach
/// `[sx, sy, ex, ey, bulge]`; `length` NaN = Cursor `(rx, ry)` auf den Kreis projiziert. Bei Unsinn leer.
#[wasm_bindgen]
#[allow(clippy::too_many_arguments)]
pub fn grip_arc_wall_resize(sx: f64, sy: f64, ex: f64, ey: f64, bulge: f64, index: f64, length: f64, rx: f64, ry: f64) -> Vec<f64> {
let i = if index == 0.0 { 0 } else if index == 1.0 { 1 } else { return Vec::new() };
match gd::arc_wall_resize((sx, sy), (ex, ey), bulge, i, opt(length), (rx, ry)) {
Some((s, e, b)) => vec![s.0, s.1, e.0, e.1, b],
None => Vec::new(),
}
}
/// [T2] Scheitel-Griff einer Bogenwand (`grip_drag::arc_wall_radius_target`): `fixed_center` = Radius mit festem
/// Mittelpunkt (Shift), `radius` NaN = Cursor `(rx, ry)`. `[x, y, radius]`, bei Unsinn leer.
#[wasm_bindgen]
+1 -1
View File
@@ -74,7 +74,7 @@ export { drawingVertices, gripPt, openEdges, polylineEdgeGrips, ringEdges } from
export { verticalExtents } from "../geometry/grips";
export type { VerticalExtent } from "../geometry/grips";
export type { GripRequest } from "../geometry/grips";
export { clampInside, coincidentGripPoints, excavationGripPoints, gripArcWallRadius, gripArcWallTarget, gripAxisLock, gripEdgeTarget, gripPolar, gripPolarPoint, openingGripPoint, openingSheetSlide, openingTypedPosition, sheetHeightDrag, stairMoveHandle, stairParamPoints, wallGripPoints } from "../geometry/gripDrag";
export { clampInside, coincidentGripPoints, excavationGripPoints, gripArcWallRadius, gripArcWallResize, gripArcWallTarget, gripAxisLock, gripEdgeTarget, gripPolar, gripPolarPoint, openingGripPoint, openingSheetSlide, openingTypedPosition, sheetHeightDrag, stairMoveHandle, stairParamPoints, wallGripPoints } from "../geometry/gripDrag";
export type { EdgeDrive, GripLocks, SheetHeightKind } from "../geometry/gripDrag";
export { openingPreviewProject, openingPreviewSvgs } from "../plan/openingPreview";
export type { OpeningPreviewSvgs } from "../plan/openingPreview";
+25
View File
@@ -2,6 +2,8 @@
import { describe, expect, it } from "vitest";
import {
gripArcWallRadius,
gripArcWallResize,
gripArcWallTarget,
coincidentGripPoints,
gripAxisLock,
@@ -97,3 +99,26 @@ describe("[T2] Bogenwand-Endpunkt-Griff", () => {
expect(gripArcWallTarget(wall, 1, -1, { x: 3, y: 3 })).toBeNull();
});
});
describe("[T2] Bogenwand: Länge über dem Halbkreis, Radius-Griff", () => {
const wall = { start: { x: 0, y: 0 }, end: { x: 4, y: 0 }, bulge: 1 };
it("Bogenlänge 3π: Öffnungswinkel 270°, Seite vom Cursor", () => {
const up = gripArcWallResize(wall, 1, 3 * Math.PI, { x: 3, y: 3 });
const down = gripArcWallResize(wall, 1, 3 * Math.PI, { x: 3, y: -3 });
expect(up?.end.x).toBeCloseTo(2, 9);
expect(up?.end.y).toBeCloseTo(-2, 9);
expect(down?.end.y).toBeCloseTo(2, 9);
expect(up?.bulge).toBeCloseTo(Math.tan((3 * Math.PI) / 8), 9);
expect(down?.bulge).toBeCloseTo(-Math.tan((3 * Math.PI) / 8), 9);
expect(gripArcWallResize(wall, 1, 5 * Math.PI, { x: 3, y: 3 })).toBeNull();
});
it("Radius mit festem Mittelpunkt und mit festen Endpunkten", () => {
const fixed = gripArcWallRadius(wall, true, 5, { x: 2, y: 1 });
expect(fixed?.pt.x).toBeCloseTo(2, 9);
expect(fixed?.pt.y).toBeCloseTo(5, 9);
expect(fixed?.radius).toBe(5);
const ends = gripArcWallRadius(wall, false, 5, { x: 2, y: 1 });
expect(ends?.pt.y).toBeCloseTo(5 - Math.sqrt(21), 9);
expect(gripArcWallRadius(wall, false, 1, { x: 2, y: 1 })).toBeNull();
});
});
+10
View File
@@ -51,6 +51,16 @@ export function gripArcWallTarget(w: Pick<Wall, "start" | "end" | "bulge">, inde
return f.length >= 3 ? { pt: v(f), arcLength: f[2] } : null;
}
/**
* [T2] Endpunkt-Griff einer Bogenwand: die ganze Wand danach (Start, Ende, Bulge). `arcLength` = getippte Bogenlänge
* ab dem festen Ende (auch über dem Halbkreis; der Cursor `raw` bestimmt nur die Seite), sonst der auf den Kreis
* projizierte Cursor. `null` bei Unsinn.
*/
export function gripArcWallResize(w: Pick<Wall, "start" | "end" | "bulge">, index: 0 | 1, arcLength: number | undefined, raw: Vec2): { start: Vec2; end: Vec2; bulge: number } | null {
const f = core().grip_arc_wall_resize(w.start.x, w.start.y, w.end.x, w.end.y, w.bulge ?? 0, index, arcLength ?? NaN, raw.x, raw.y);
return f.length >= 5 ? { start: { x: f[0], y: f[1] }, end: { x: f[2], y: f[3] }, bulge: f[4] } : null;
}
/**
* [T2] Scheitel-Griff einer Bogenwand: Zielpunkt und Radius der Wand danach. `fixedCenter` (Shift) = Radius um den
* festen Mittelpunkt (Enden wandern radial), sonst Endpunkte fest. `radius` = getippter Radius, sonst folgt der
+1 -1
View File
@@ -19,7 +19,7 @@ type P = [number, number];
/** Eine Griff-Änderung für den Kern (`grips.rs::run`); Zahlen dürfen NaN/±∞ sein (Marken). */
export type GripRequest =
| { op: "moveGrip"; drawingId: string | null; wallId: string | null; index: number; pt: P; scale: number; free?: boolean }
| { op: "moveGrip"; drawingId: string | null; wallId: string | null; index: number; pt: P; scale: number; free?: boolean; arcLength?: number }
| { op: "moveBy"; drawingId: string | null; wallId: string | null; delta: P }
| { op: "moveEdge"; drawingId: string | null; wallId: string | null; a: number; b: number; delta: P }
| { op: "resize"; kind: string; id: string; w: number; h: number; fx: number; fy: number }
+8 -3
View File
@@ -244,8 +244,13 @@ export interface ProjectSlice {
pt: Vec2,
/** Papier-Massstab (1:N), nur für den Masszahl-Griff der Bemassung. */
scaleDenominator?: number,
/** [172] Masszahl-Griff ohne Einrasten (Alt gehalten). */
/**
* Modifikator gehalten: Masszahl-Griff ohne Einrasten ([172], Alt) bzw. Scheitel-Griff einer Bogenwand mit
* festem Mittelpunkt ([T2], Shift).
*/
free?: boolean,
/** [T2] Getippte Bogenlänge (Tab) beim Endpunkt-Griff einer Bogenwand, auch über dem Halbkreis. */
arcLength?: number,
) => void;
moveElementByOf: (
drawingId: string | null,
@@ -1145,9 +1150,9 @@ export function createProjectSlice(
// Diese Aktionen laufen AD-HOC bei jedem Maus-Move-Schritt eines Drags
// (kein Draft/Commit-Muster wie bei den Zeichenwerkzeugen) — daher mit
// coalesceKey, damit EIN Drag EINEN Undo-Schritt erzeugt statt vieler.
moveGripOf: (drawingId, wallId, index, pt, scaleDenominator = DEFAULT_SCALE_DENOMINATOR, free) =>
moveGripOf: (drawingId, wallId, index, pt, scaleDenominator = DEFAULT_SCALE_DENOMINATOR, free, arcLength) =>
applyGrip(
{ op: "moveGrip", drawingId, wallId, index, pt: gripPt(pt), scale: scaleDenominator, ...(free ? { free: true } : {}) },
{ op: "moveGrip", drawingId, wallId, index, pt: gripPt(pt), scale: scaleDenominator, ...(free ? { free: true } : {}), ...(arcLength != null ? { arcLength } : {}) },
`moveGripOf:${drawingId ?? ""}:${wallId ?? ""}:${index}`,
),
+22 -10
View File
@@ -17,6 +17,7 @@ import {
coincidentGripPoints,
excavationGripPoints,
gripArcWallRadius,
gripArcWallResize,
gripArcWallTarget,
gripAxisLock,
gripEdgeTarget,
@@ -117,6 +118,7 @@ export function useGripEditing(opts: {
pt: Vec2,
scaleDenominator?: number,
free?: boolean,
arcLength?: number,
) => void;
moveRoomEdge: (id: string, aIndex: number, bIndex: number, delta: Vec2) => void;
moveCeilingEdge: (id: string, aIndex: number, bIndex: number, delta: Vec2) => void;
@@ -566,7 +568,7 @@ export function useGripEditing(opts: {
const pendingGripRef = useRef<{ drawingId: string; localIndex: number; flat: number; pt: Vec2 } | null>(null);
// Dasselbe für das Verschieben eines ganzen 2D-Elements (Gesamt-Delta) und für
// Kanten-Griffe von Polylinien (Ziel-Delta): bis zum Loslassen nur Vorschau.
const pendingWallGripRef = useRef<{ wallId: string; localIndex: number; flat: number; pt: Vec2 } | null>(null);
const pendingWallGripRef = useRef<{ wallId: string; localIndex: number; flat: number; pt: Vec2; arcLength?: number } | null>(null);
const pendingAreaGripRef = useRef<{ kind: "room" | "ceiling" | "excavation"; 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);
@@ -763,6 +765,9 @@ export function useGripEditing(opts: {
const at0 = gripOpeningPos0Ref.current;
if (op && !op.locked && host?.bulge && at0 && length != null) {
slideOpening(op.id, { position: openingTypedPosition(at0.position, length, anchor, pt, at0.dir) }, `slideOpening:${op.id}`);
} else if (length != null && arcWallEnd(index)) {
// Bogenwand-Ende ([T2]): der rohe Cursor legt nur die Seite fest, die Länge der Kern (auch über dem Halbkreis).
applyGrip(index, gripDragInfoRef.current?.raw ?? pt, length);
} else applyGrip(index, pt);
};
@@ -868,7 +873,7 @@ export function useGripEditing(opts: {
// Editier-Dispatch: bei gewählter Decke auf die Decken-Aktionen umleiten, sonst
// auf die Wand/2D-Aktionen. So teilen Plan- UND 3D-Griffe denselben Pfad.
const applyGrip = (index: number, pt: Vec2) => {
const applyGrip = (index: number, pt: Vec2, arcLength?: number) => {
// Öffnung: den gezogenen Punkt auf die Wandachse projizieren → neue
// `position` (Abstand des ersten Pfostens vom Wand-Start), sodass die
// Öffnung entlang der Wand gleitet. Griff sitzt in der Öffnungsmitte, daher
@@ -940,11 +945,11 @@ export function useGripEditing(opts: {
if (wId && !dId && local <= 1) {
const w = project.walls.find((x) => x.id === wId);
if (w && !w.locked) {
pendingWallGripRef.current = { wallId: wId, localIndex: local, flat: index, pt };
pendingWallGripRef.current = { wallId: wId, localIndex: local, flat: index, pt, arcLength };
return;
}
}
moveGripOf(dId, wId, local, pt, scaleDenominator, gripFreeRef.current);
moveGripOf(dId, wId, local, pt, scaleDenominator, gripFreeRef.current, arcLength);
}
};
@@ -967,13 +972,20 @@ export function useGripEditing(opts: {
if (!w) return [];
const wt = project.wallTypes.find((t) => t.id === w.wallTypeId);
const th = wt ? wallTypeThickness(wt) : 0.2;
const a = pw.localIndex === 0 ? pw.pt : w.start;
const b = pw.localIndex === 0 ? w.end : pw.pt;
// Bogenwand: der Bogen behält seinen Öffnungswinkel (Bulge), Vorschau als Band samt Achse.
let a = pw.localIndex === 0 ? pw.pt : w.start;
let b = pw.localIndex === 0 ? w.end : pw.pt;
// Bogenwand ([T2]): der Endpunkt läuft auf dem Kreis, der Bulge folgt (Kern `gripArcWallResize`);
// Vorschau als Band samt Achse.
if (w.bulge) {
const arc = wallArcBand(a, b, w.bulge, th);
const nw = pw.localIndex <= 1 ? gripArcWallResize(w, pw.localIndex as 0 | 1, pw.arcLength, pw.pt) : null;
if (nw) {
a = nw.start;
b = nw.end;
}
const bulge = nw?.bulge ?? w.bulge;
const arc = wallArcBand(a, b, bulge, th);
if (arc) return [{ kind: "poly", pts: arc.band, closed: true }, { kind: "poly", pts: arc.axis, closed: false }];
return [{ kind: "poly", pts: bulgeArcPoints(a, b, w.bulge), closed: false }];
return [{ kind: "poly", pts: bulgeArcPoints(a, b, bulge), closed: false }];
}
return [
{ kind: "poly", pts: wallCorners(a, b, th), closed: true },
@@ -1006,7 +1018,7 @@ export function useGripEditing(opts: {
}
const pw = pendingWallGripRef.current;
pendingWallGripRef.current = null;
if (pw) moveGripOf(null, pw.wallId, pw.localIndex, pw.pt, scaleDenominator);
if (pw) moveGripOf(null, pw.wallId, pw.localIndex, pw.pt, scaleDenominator, undefined, pw.arcLength);
const pend = pendingGripRef.current;
pendingGripRef.current = null;
if (pend) moveGripOf(pend.drawingId, null, pend.localIndex, pend.pt, scaleDenominator);