forked from 1b-agent/opencadstudio-upstream
feat(arc): keep ARC Continue drawing arcs until ended (#327)
The Continue option committed a single tangent-continuing arc and left the command. Now each picked end point commits its arc and re-anchors at that arc's free end, so the user keeps drawing tangent-continuing arcs until ending the run with Enter/Esc. A degenerate (collinear) pick stays active instead of cancelling. Because arcs now commit via CmdResult::CommitEntity (repeating) rather than CommitAndExit, advance the ARC_CONT continuation anchor in the CommitEntity arm too — guarded to line/arc so non-continuable repeats (point/ray/spline) leave it untouched. This also lets a LINE run feed a following ARC Continue. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
26cab3b712
commit
39c0a84c3c
2 files changed
+23
-2
No files matched your search
@@ -218,6 +218,17 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
CmdResult::CommitEntity(entity) => {
|
||||
// A line/arc drawn by a repeating command advances the ARC_CONT
|
||||
// continuation anchor, so ending one run and launching another
|
||||
// keeps continuing from the last segment (mirrors the
|
||||
// CommitAndExit arm). Non-continuable repeats (point/ray/spline)
|
||||
// leave the anchor untouched. (#327)
|
||||
if matches!(
|
||||
entity,
|
||||
acadrust::EntityType::Line(_) | acadrust::EntityType::Arc(_)
|
||||
) {
|
||||
self.update_cont_anchor(&entity);
|
||||
}
|
||||
let label = self.history_label_from_active_cmd(i, "ENTITY");
|
||||
self.push_undo_snapshot(i, label);
|
||||
self.commit_entity(entity);
|
||||
|
||||
@@ -1359,9 +1359,19 @@ impl CadCommand for ArcContCommand {
|
||||
fn on_point(&mut self, pt: DVec3) -> CmdResult {
|
||||
match arc_continue(self.s, self.tangent, pt, self.ctrl) {
|
||||
Some((center, radius, sa, ea)) => {
|
||||
CmdResult::CommitAndExit(make_arc(center, radius, sa, ea))
|
||||
let arc = make_arc(center, radius, sa, ea);
|
||||
// Keep drawing: re-anchor at the arc just committed so the next
|
||||
// click starts another tangent-continuing arc from its end,
|
||||
// until the user ends the run with Enter/Esc (#327).
|
||||
if let Some((end, tangent)) = continue_anchor(&arc, Some(pt)) {
|
||||
self.s = end;
|
||||
self.tangent = tangent;
|
||||
}
|
||||
CmdResult::CommitEntity(arc)
|
||||
}
|
||||
None => CmdResult::Cancel,
|
||||
// A degenerate pick (no arc through these points) shouldn't end the
|
||||
// whole run — stay active and wait for the next end point.
|
||||
None => CmdResult::NeedPoint,
|
||||
}
|
||||
}
|
||||
fn on_enter(&mut self) -> CmdResult {
|
||||
|
||||
Reference in new issue
Block a user