[T2] Bogenwand: Radius-Griff mit festem Mittelpunkt (Shift) und Tab-Eingabe Radius
This commit is contained in:
6 files changed
+190
-7
No files matched your search
@@ -289,6 +289,58 @@ pub fn arc_wall_point_at_length(s: P, e: P, bulge: f64, index: usize, length: f6
|
||||
Some((c.0 + r * jsnum::cos(ang), c.1 + r * jsnum::sin(ang)))
|
||||
}
|
||||
|
||||
/// [T2] Radius-Griff (Scheitel) einer Bogenwand mit festem Mittelpunkt: der Mittelpunkt und der Öffnungswinkel
|
||||
/// (Bulge) bleiben, der Radius wird der Abstand `target` – Mittelpunkt; Start und Ende wandern radial mit.
|
||||
/// Ergebnis `(neuer Start, neues Ende)`; `None` bei Unsinn, Ziel im Mittelpunkt (Radius < 1 mm) oder ohne Bogen.
|
||||
pub fn arc_wall_radius_fixed_center(s: P, e: P, bulge: f64, target: P) -> Option<(P, 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 c = (a.center.x, a.center.y);
|
||||
let r = hypot2(target.0 - c.0, target.1 - c.1);
|
||||
if !(r.is_finite() && r > 1e-3) {
|
||||
return None;
|
||||
}
|
||||
let at = |ang: f64| (c.0 + r * jsnum::cos(ang), c.1 + r * jsnum::sin(ang));
|
||||
Some((at(a.a0), at(a.a0 + a.sweep)))
|
||||
}
|
||||
|
||||
/// [T2] Zielpunkt des Scheitel-Griffs einer Bogenwand samt Radius der Wand danach. Mit `fixed_center` (Shift):
|
||||
/// Punkt auf dem Strahl Mittelpunkt → Cursor `raw` im Abstand `radius` (getippt, sonst der Cursor-Abstand);
|
||||
/// Ziehen mit [`arc_wall_radius_fixed_center`]. Sonst (Endpunkte fest): ohne `radius` der Cursor selbst, mit
|
||||
/// `radius` der Scheitel des Bogens dieses Radius über der Sehne, auf der Seite des Cursors (liegt der Cursor
|
||||
/// weiter als `radius` von der Sehne entfernt, der Grossbogen, sonst der Kleinbogen). `None` bei Unsinn, bei
|
||||
/// `radius` unter der halben Sehne oder bei gerader Wand.
|
||||
pub fn arc_wall_radius_target(s: P, e: P, bulge: f64, fixed_center: bool, radius: Option<f64>, raw: P) -> Option<(P, f64)> {
|
||||
let a = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(s.0, s.1), kernel2d::Vec2::new(e.0, e.1), Some(bulge))?;
|
||||
if !(raw.0.is_finite() && raw.1.is_finite()) || radius.is_some_and(|r| !(r.is_finite() && r > 1e-3)) {
|
||||
return None;
|
||||
}
|
||||
let c = (a.center.x, a.center.y);
|
||||
if fixed_center {
|
||||
let d = sub(raw, c);
|
||||
let l = hypot2(d.0, d.1);
|
||||
// Cursor im Mittelpunkt: Richtung des bisherigen Scheitels.
|
||||
let dir = if l > 1e-9 { scale(d, 1.0 / l) } else { let am = a.a0 + a.sweep / 2.0; (jsnum::cos(am), jsnum::sin(am)) };
|
||||
let r = radius.unwrap_or(l);
|
||||
return (r > 1e-3).then(|| (add(c, scale(dir, r)), r));
|
||||
}
|
||||
let Some(r) = radius else {
|
||||
let b = crate::bulge::from_sagitta_point(s.0, s.1, e.0, e.1, raw.0, raw.1);
|
||||
let na = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(s.0, s.1), kernel2d::Vec2::new(e.0, e.1), Some(b))?;
|
||||
return Some((raw, na.r));
|
||||
};
|
||||
let (d, mid) = (sub(e, s), scale(add(s, e), 0.5));
|
||||
let hc = hypot2(d.0, d.1) / 2.0;
|
||||
if r < hc - 1e-9 {
|
||||
return None;
|
||||
}
|
||||
let n = normalize((-d.1, d.0));
|
||||
let dist = dot(sub(raw, mid), n);
|
||||
let side = if dist.abs() > 1e-9 { dist.signum() } else if bulge >= 0.0 { 1.0 } else { -1.0 };
|
||||
let root = (r * r - hc * hc).max(0.0).sqrt();
|
||||
let h = if dist.abs() > r { r + root } else { r - root };
|
||||
Some((add(mid, scale(n, side * h)), r))
|
||||
}
|
||||
|
||||
/// Öffnung im Schnitt-Blatt waagrecht ziehen: Blatt-Delta `du` (gesamt, entlang der Schnitt-Achse `u_axis`)
|
||||
/// → neue `position` (geklemmt) und das dazu passende, tatsächlich wirksame Blatt-Delta. `None`, wenn die
|
||||
/// Wand fast quer zur Schnittlinie steht (|u · Wandrichtung| < 0.15). Bogenwand ([144], `bulge`):
|
||||
@@ -715,6 +767,58 @@ mod tests {
|
||||
assert!(arc_wall_grip_target(s, e, 1.0, 1, Some(f64::NAN), (2.0, 7.0)).is_none());
|
||||
}
|
||||
|
||||
/// [T2] Radius-Griff mit festem Mittelpunkt: Mittelpunkt und Öffnungswinkel bleiben, Enden wandern radial.
|
||||
#[test]
|
||||
fn bogenwand_radius_fester_mittelpunkt() {
|
||||
let (s, e) = ((0.0, 0.0), (4.0, 0.0)); // Halbkreis, Mitte (2, 0), r = 2
|
||||
let (ns, ne) = arc_wall_radius_fixed_center(s, e, 1.0, (2.0, 6.0)).unwrap();
|
||||
assert!(close(ns, (-4.0, 0.0)) && close(ne, (8.0, 0.0)), "{ns:?} {ne:?}");
|
||||
let a = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(ns.0, ns.1), kernel2d::Vec2::new(ne.0, ne.1), Some(1.0)).unwrap();
|
||||
assert!((a.center.x - 2.0).abs() < 1e-9 && a.center.y.abs() < 1e-9 && (a.r - 6.0).abs() < 1e-9);
|
||||
// Viertelkreis (bulge tan(π/8)): Enden bleiben auf ihren Winkeln.
|
||||
let b = std::f64::consts::FRAC_PI_8.tan();
|
||||
let c = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(0.0, 0.0), kernel2d::Vec2::new(2.0, 2.0), Some(b)).unwrap();
|
||||
let (ns, ne) = arc_wall_radius_fixed_center((0.0, 0.0), (2.0, 2.0), b, (c.center.x + 3.0, c.center.y)).unwrap();
|
||||
let a = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(ns.0, ns.1), kernel2d::Vec2::new(ne.0, ne.1), Some(b)).unwrap();
|
||||
assert!((a.center.x - c.center.x).abs() < 1e-9 && (a.center.y - c.center.y).abs() < 1e-9 && (a.r - 3.0).abs() < 1e-9 && (a.a0 - c.a0).abs() < 1e-9);
|
||||
assert!(arc_wall_radius_fixed_center(s, e, 1.0, (2.0, 0.0)).is_none());
|
||||
assert!(arc_wall_radius_fixed_center(s, e, 1.0, (f64::NAN, 0.0)).is_none());
|
||||
assert!(arc_wall_radius_fixed_center(s, e, 0.0, (2.0, 3.0)).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bogenwand_radius_ziel() {
|
||||
let (s, e) = ((0.0, 0.0), (4.0, 0.0));
|
||||
// Fester Mittelpunkt, Radius getippt: Punkt auf dem Strahl Mitte → Cursor.
|
||||
let (p, r) = arc_wall_radius_target(s, e, 1.0, true, Some(5.0), (2.0, 1.0)).unwrap();
|
||||
assert!(close(p, (2.0, 5.0)) && (r - 5.0).abs() < 1e-12);
|
||||
let (p, r) = arc_wall_radius_target(s, e, 1.0, true, None, (2.0, 3.0)).unwrap();
|
||||
assert!(close(p, (2.0, 3.0)) && (r - 3.0).abs() < 1e-12);
|
||||
// Cursor im Mittelpunkt: Richtung des bisherigen Scheitels (hier -y, bulge > 0 = links der Sehne → +y? Scheitel (2, 2)).
|
||||
let (p, _) = arc_wall_radius_target(s, e, 1.0, true, Some(1.0), (2.0, 0.0)).unwrap();
|
||||
assert!(close(p, (2.0, 1.0)), "{p:?}");
|
||||
// Feste Endpunkte, Radius 5 über der Sehne 4: Kleinbogen, Pfeilhöhe 5 − √21; Seite folgt dem Cursor.
|
||||
let h = 5.0 - 21f64.sqrt();
|
||||
let (p, r) = arc_wall_radius_target(s, e, 1.0, false, Some(5.0), (2.0, 1.0)).unwrap();
|
||||
assert!(close(p, (2.0, h)) && (r - 5.0).abs() < 1e-12, "{p:?}");
|
||||
let (p, _) = arc_wall_radius_target(s, e, 1.0, false, Some(5.0), (2.0, -1.0)).unwrap();
|
||||
assert!(close(p, (2.0, -h)), "{p:?}");
|
||||
// Cursor weiter als der Radius von der Sehne: Grossbogen.
|
||||
let (p, _) = arc_wall_radius_target(s, e, 1.0, false, Some(5.0), (2.0, 7.0)).unwrap();
|
||||
assert!(close(p, (2.0, 5.0 + 21f64.sqrt())), "{p:?}");
|
||||
// Das Ergebnis ergibt zurückgerechnet genau diesen Radius.
|
||||
let b = crate::bulge::from_sagitta_point(0.0, 0.0, 4.0, 0.0, 2.0, h);
|
||||
let a = crate::wall_arc::WallArc::of(kernel2d::Vec2::new(0.0, 0.0), kernel2d::Vec2::new(4.0, 0.0), Some(b)).unwrap();
|
||||
assert!((a.r - 5.0).abs() < 1e-9);
|
||||
// Radius kleiner als die halbe Sehne: unmöglich.
|
||||
assert!(arc_wall_radius_target(s, e, 1.0, false, Some(1.5), (2.0, 1.0)).is_none());
|
||||
// Ohne Radius: der Cursor selbst, Radius der Wand danach.
|
||||
let (p, r) = arc_wall_radius_target(s, e, 1.0, false, None, (2.0, 1.0)).unwrap();
|
||||
assert!(close(p, (2.0, 1.0)) && (r - 2.5).abs() < 1e-9, "{r}");
|
||||
assert!(arc_wall_radius_target(s, e, 1.0, true, Some(f64::NAN), (2.0, 1.0)).is_none());
|
||||
assert!(arc_wall_radius_target(s, e, 0.0, true, Some(2.0), (2.0, 1.0)).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn treppe_wand_baugrube() {
|
||||
assert!(close(stair_handle(false, None, (1.0, 1.0), (0.0, 2.0), 4.0), (1.0, 3.0)));
|
||||
|
||||
@@ -113,7 +113,8 @@ pub struct Request {
|
||||
delta: [N; 2],
|
||||
/// Punkttyp der Polylinie (`vertexType`: "corner" | "arc" | "spline").
|
||||
vertex_type: Option<String>,
|
||||
/// [172] Freie Lage ohne Einrasten (gehaltene Alt-Taste), bisher nur beim Masszahl-Griff.
|
||||
/// Modifikator gehalten: Masszahl-Griff frei ohne Einrasten ([172], Alt), Scheitel-Griff einer Bogenwand mit
|
||||
/// festem Mittelpunkt statt festen Endpunkten ([T2], Shift) — die Hülle setzt es je nach Griff.
|
||||
free: bool,
|
||||
}
|
||||
|
||||
@@ -214,7 +215,7 @@ 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)) } else { drawing_grip(e, index, x, y, scale, 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) })
|
||||
}
|
||||
"moveBy" => {
|
||||
let (dx, dy) = r.p("delta");
|
||||
@@ -400,10 +401,19 @@ pub fn run(lk: &Lookup, req: &Request) -> Result<GripResult, String> {
|
||||
|
||||
// ── Wand ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
fn wall_grip(w: &Value, index: f64, x: f64, y: f64) -> Value {
|
||||
fn wall_grip(w: &Value, index: f64, x: f64, y: f64, fixed_center: bool) -> 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)));
|
||||
// Mit festem Mittelpunkt (Shift): Radius = Abstand zum Mittelpunkt, Öffnungswinkel bleibt, die Enden wandern radial.
|
||||
if fixed_center {
|
||||
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_radius_fixed_center(s, e, b, (x, y)) {
|
||||
Some((ns, ne)) => with_all(w, vec![("start", pt(ns.0, ns.1)), ("end", pt(ne.0, ne.1))]),
|
||||
None => w.clone(),
|
||||
};
|
||||
}
|
||||
}
|
||||
let b = crate::bulge::from_sagitta_point(s.0, s.1, e.0, e.1, x, y);
|
||||
return with_opt(w, vec![("bulge", (b.is_finite() && b.abs() > 1e-9).then(|| js_num(b)))]);
|
||||
}
|
||||
@@ -1434,6 +1444,20 @@ mod tests {
|
||||
assert!(res.ops[0].to_json()["entity"].get("bulge").is_none());
|
||||
}
|
||||
|
||||
/// [T2] Scheitel-Griff mit gehaltenem Modifikator (`free`): fester Mittelpunkt, Enden wandern radial.
|
||||
#[test]
|
||||
fn bogenwand_scheitel_fester_mittelpunkt() {
|
||||
let r = root(json!({"walls": [{"id": "w", "start": {"x": 0, "y": 0}, "end": {"x": 4, "y": 0}, "bulge": 1.0}]}));
|
||||
let res = run(&Lookup::plain(&r), &rq(json!({"op": "moveGrip", "wallId": "w", "index": 2, "pt": [2, 3], "free": true}))).unwrap();
|
||||
let e = res.ops[0].to_json()["entity"].clone();
|
||||
let (s, en) = (xy(&e["start"]), xy(&e["end"]));
|
||||
assert!((s.0 + 1.0).abs() < 1e-9 && s.1.abs() < 1e-9 && (en.0 - 5.0).abs() < 1e-9 && e["bulge"].as_f64() == Some(1.0), "{e}");
|
||||
// Ohne Modifikator bleiben die Endpunkte fest.
|
||||
let res = run(&Lookup::plain(&r), &rq(json!({"op": "moveGrip", "wallId": "w", "index": 2, "pt": [2, 3]}))).unwrap();
|
||||
let e = res.ops[0].to_json()["entity"].clone();
|
||||
assert_eq!(xy(&e["start"]), (0.0, 0.0));
|
||||
}
|
||||
|
||||
/// [172] Masszahl-Griff eines Radius-/Durchmesser-/Bogenmasses: Lage an der Zahl, rastet ein, Alt = frei.
|
||||
#[test]
|
||||
fn rundmass_masszahl_griff_rastet_ein() {
|
||||
|
||||
@@ -47,6 +47,17 @@ pub fn grip_arc_wall_target(sx: f64, sy: f64, ex: f64, ey: f64, bulge: f64, inde
|
||||
}
|
||||
}
|
||||
|
||||
/// [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]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn grip_arc_wall_radius(sx: f64, sy: f64, ex: f64, ey: f64, bulge: f64, fixed_center: bool, radius: f64, rx: f64, ry: f64) -> Vec<f64> {
|
||||
match gd::arc_wall_radius_target((sx, sy), (ex, ey), bulge, fixed_center, opt(radius), (rx, ry)) {
|
||||
Some((p, r)) => vec![p.0, p.1, r],
|
||||
None => Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Shift-Achsen-Lock (`grip_drag::axis_lock`): Ursprung `(ox, oy)` NaN = noch keiner; `ring` = Punkte des
|
||||
/// Elements (leer = keine Polygon-Nachbarn), `index` = gezogener Punkt darin. `[x, y]`.
|
||||
#[wasm_bindgen]
|
||||
|
||||
+1
-1
@@ -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, gripArcWallTarget, gripAxisLock, gripEdgeTarget, gripPolar, gripPolarPoint, openingGripPoint, openingSheetSlide, openingTypedPosition, sheetHeightDrag, stairMoveHandle, stairParamPoints, wallGripPoints } from "../geometry/gripDrag";
|
||||
export { clampInside, coincidentGripPoints, excavationGripPoints, gripArcWallRadius, 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";
|
||||
|
||||
@@ -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] 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
|
||||
* Punkt dem Cursor `raw`. `null` bei Unsinn (z. B. Radius unter der halben Sehne).
|
||||
*/
|
||||
export function gripArcWallRadius(w: Pick<Wall, "start" | "end" | "bulge">, fixedCenter: boolean, radius: number | undefined, raw: Vec2): { pt: Vec2; radius: number } | null {
|
||||
const f = core().grip_arc_wall_radius(w.start.x, w.start.y, w.end.x, w.end.y, w.bulge ?? 0, fixedCenter, radius ?? NaN, raw.x, raw.y);
|
||||
return f.length >= 3 ? { pt: v(f), radius: f[2] } : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shift-Achsen-Lock eines Punkt-Griffs: Welt-H/V durch den Nachbar-Griff `anchor`, bei einem Vielecks-
|
||||
* Eckpunkt (`ring` = Punkte des Elements, `index` darin, `origin` = Lage vor dem Zug) zusätzlich die Flucht
|
||||
|
||||
@@ -16,6 +16,7 @@ import { openEdges, polylineEdgeGrips, ringEdges } from "../core";
|
||||
import {
|
||||
coincidentGripPoints,
|
||||
excavationGripPoints,
|
||||
gripArcWallRadius,
|
||||
gripArcWallTarget,
|
||||
gripAxisLock,
|
||||
gripEdgeTarget,
|
||||
@@ -594,7 +595,15 @@ export function useGripEditing(opts: {
|
||||
const wall = owner?.wallId ? project.walls.find((x) => x.id === owner.wallId) : undefined;
|
||||
return wall && wall.bulge && (owner?.localIndex === 0 || owner?.localIndex === 1) ? { wall, end: owner.localIndex } : null;
|
||||
};
|
||||
// [T2] Scheitel-Griff einer Bogenwand: Tab-Feld ist der Radius (Shift = fester Mittelpunkt statt fester Endpunkte).
|
||||
const arcWallApex = (index: number): Wall | null => {
|
||||
const owner = gripOwners[index];
|
||||
const wall = owner?.wallId ? project.walls.find((x) => x.id === owner.wallId) : undefined;
|
||||
return wall && wall.bulge && owner?.localIndex === 2 ? wall : null;
|
||||
};
|
||||
const gripEditPoint = (anchor: Vec2, locks: GripLocks, raw: Vec2, index?: number): Vec2 => {
|
||||
const apex = index != null ? arcWallApex(index) : null;
|
||||
if (apex) return gripArcWallRadius(apex, gripFreeRef.current, locks.length, raw)?.pt ?? raw;
|
||||
const arc = index != null ? arcWallEnd(index) : null;
|
||||
return (arc && gripArcWallTarget(arc.wall, arc.end, locks.length, raw)?.pt) ?? gripPolarPoint(anchor, locks, raw);
|
||||
};
|
||||
@@ -604,6 +613,11 @@ export function useGripEditing(opts: {
|
||||
const ge = gripEdit;
|
||||
const info = gripDragInfoRef.current;
|
||||
if (!ge || !info) return [];
|
||||
const apex = arcWallApex(info.index);
|
||||
if (apex) {
|
||||
const live = gripArcWallRadius(apex, gripFreeRef.current, undefined, info.raw)?.radius ?? 0;
|
||||
return [{ id: "length", labelKey: "cmd.field.radius", value: ge.locks.length ?? live, locked: ge.locks.length != null, active: true }];
|
||||
}
|
||||
const arc = arcWallEnd(info.index);
|
||||
if (arc) {
|
||||
const live = gripArcWallTarget(arc.wall, arc.end, undefined, info.raw)?.arcLength ?? 0;
|
||||
@@ -688,7 +702,14 @@ export function useGripEditing(opts: {
|
||||
if (!anchor) return; // ohne Anker keine polare Eingabe möglich
|
||||
const wallDir = openingWallDir();
|
||||
const arcEnd = arcWallEnd(info.index);
|
||||
const apex = arcWallApex(info.index);
|
||||
setGripEdit((prev) => {
|
||||
if (apex) {
|
||||
// Bogenwand-Scheitel ([T2]): nur das Radiusfeld, eingefroren auf dem aktuellen Radius.
|
||||
if (prev) return prev;
|
||||
const radius = gripArcWallRadius(apex, gripFreeRef.current, undefined, grips[info.index])?.radius;
|
||||
return radius != null ? { anchor, active: "length", locks: { length: radius } } : prev;
|
||||
}
|
||||
if (arcEnd) {
|
||||
// Bogenwand ([T2]): nur das Längenfeld (Bogenlänge), eingefroren auf der aktuellen Länge.
|
||||
if (prev) return prev;
|
||||
@@ -727,7 +748,7 @@ export function useGripEditing(opts: {
|
||||
const info = gripDragInfoRef.current;
|
||||
if (!ge || !info) return;
|
||||
const locks = { ...ge.locks, [ge.active]: value };
|
||||
const next = ge.active === "length" && !arcWallEnd(info.index) ? "angle" : "length";
|
||||
const next = ge.active === "length" && !arcWallEnd(info.index) && !arcWallApex(info.index) ? "angle" : "length";
|
||||
setGripEdit({ ...ge, locks, active: next });
|
||||
// Zielpunkt mit dem frischen Lock anwenden (live, ohne Maus-Bewegung).
|
||||
const pt = gripEditPoint(ge.anchor, locks, info.raw, info.index);
|
||||
@@ -1098,7 +1119,10 @@ export function useGripEditing(opts: {
|
||||
// Bogenwand ([T2]): Länge = Bogenlänge der Wand mit dem Endpunkt am Cursor.
|
||||
const arc = arcWallEnd(index);
|
||||
const arcLength = arc ? gripArcWallTarget(arc.wall, arc.end, undefined, pt)?.arcLength : undefined;
|
||||
return { at: pt, length: arcLength ?? length, angleDeg };
|
||||
// Scheitel einer Bogenwand: Länge = Radius der Wand mit dem Scheitel am Cursor.
|
||||
const apex = arcWallApex(index);
|
||||
const radius = apex ? gripArcWallRadius(apex, gripFreeRef.current, undefined, pt)?.radius : undefined;
|
||||
return { at: pt, length: radius ?? arcLength ?? length, angleDeg };
|
||||
};
|
||||
// Dasselbe für einen gezogenen Kanten-Griff: freie Kanten zeigen Länge+Winkel
|
||||
// (wie ein Punkt-Griff), geführte Kanten nur EINEN Wert (Abstand entlang der
|
||||
@@ -1270,6 +1294,16 @@ export function useGripEditing(opts: {
|
||||
// also nutzlos für „entlang der bestehenden Kante weiterziehen". Der Lock
|
||||
// dominiert (kein Snap), damit die Endkoordinate garantiert eine Achse
|
||||
// trifft — identisch zum bisherigen Ortho-Verhalten.
|
||||
// [T2] Scheitel einer Bogenwand: Shift = Radius mit festem Mittelpunkt (Kern, `free` im Zug), kein Achsen-Lock.
|
||||
const apexWall = arcWallApex(index);
|
||||
if (apexWall) {
|
||||
gripFreeRef.current = !!mods.shift;
|
||||
if (mods.shift) {
|
||||
applyGrip(index, raw);
|
||||
setDraft({ preview: gripPreviewShapes(), vertices: [], snap: null, hud: hudFor(index, raw) });
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (mods.shift && anchor) {
|
||||
const origin = gripOriginRef.current;
|
||||
const ring = origin ? resolvePolygonRing(index) : null;
|
||||
@@ -1279,7 +1313,7 @@ export function useGripEditing(opts: {
|
||||
return;
|
||||
}
|
||||
// [172] Masszahl-Griff: der Kern rastet an festen Stellen ein (Alt = frei); Objektfang würde das stören.
|
||||
gripFreeRef.current = !!mods.alt;
|
||||
gripFreeRef.current = !apexWall && !!mods.alt;
|
||||
if (owner?.drawingId) {
|
||||
const od = project.drawings2d.find((x) => x.id === owner.drawingId);
|
||||
if (od?.geom.shape === "dimension" && owner.localIndex > od.geom.pts.length) {
|
||||
|
||||
Reference in new issue
Block a user