fix(sketch): a centerline can be switched straight to construction
sketch.construction set `construction` but left `centerline` on, so the curve stayed a centerline (drawn dash-dot, still marked as an axis) until it was first switched back to normal. Making a curve construction now clears its centerline flag, mirroring sketch.centerline.
This commit is contained in:
1 parent
a7512e5e08
commit
6dc6372b13
2 files changed
+21
-2
No files matched your search
@@ -1703,14 +1703,18 @@ fn construction(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let cs: Vec<usize> =
|
||||
ids.iter().map(|id| sk.curve_index(id).ok_or_else(|| bad(cmd, format!("unknown curve `{id}`")))).collect::<Result<_>>()?;
|
||||
// The selection switches together (a slot or polygon as a whole): to construction
|
||||
// unless all of it already is. Projected curves may switch too.
|
||||
// unless all of it already is. Projected curves may switch too. A centerline that
|
||||
// becomes construction stops being a centerline (one line type at a time).
|
||||
let to = want.unwrap_or_else(|| !cs.iter().all(|c| sk.curves.get(*c).is_some_and(|c| c.construction)));
|
||||
let mut n = 0;
|
||||
for c in cs {
|
||||
if let Some(cu) = sk.curves.get_mut(c)
|
||||
&& cu.construction != to
|
||||
&& (cu.construction != to || to && cu.centerline)
|
||||
{
|
||||
cu.construction = to;
|
||||
if to {
|
||||
cu.centerline = false;
|
||||
}
|
||||
n += 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user