mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-06 20:02:16 +00:00
#5011 added a caller of the old `target_sketch` (MidPoint's `line_stays`, which swaps a point picked after its line) after this branch's base. It now reads the sketch through `sketch_store::target` and `sketch_store::read`, as the other sketch commands do, so a number there is an exact id too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2070,7 +2070,7 @@ fn c_midpoint(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
/// moves when the point can't.
|
||||
fn line_stays(s: &Session, p: &Value, cmd: &str) -> Value {
|
||||
let swapped = (|| {
|
||||
let sk = s.doc.sketch(target_sketch(s, p, cmd).ok()?).ok()?;
|
||||
let sk = sketch_store::read(&s.doc, sketch_store::target(s, p, cmd).ok()?).ok()?;
|
||||
let (a, b) = (p.get("a")?.as_str()?, p.get("b")?.as_str()?);
|
||||
let line = sk.curve_index(b).filter(|c| matches!(sk.curves.get(*c).map(|c| &c.kind), Some(CurveKind::Line { .. })));
|
||||
(sk.curve_index(a).is_none() && sk.resolve_point(a).is_some() && line.is_some()).then(|| {
|
||||
|
||||
Reference in New Issue
Block a user