fix(spline): terminate on finish and preview the real curve (#282)

on_enter/on_escape returned CmdResult::CommitEntity, which commits the
spline but keeps the command armed with its accumulated points — the
cursor stayed in spline mode and the next click began a new spline,
trapping the user in the command loop. Return CommitAndExit so Enter/Esc
finalize the spline and return to the selection state.

The in-progress preview drew only the straight control polygon. Sample
the actual degree-3 clamped B-spline (same control points + knot vector
build() commits) so the rubber-band traces the exact final curve.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-09 23:03:25 +03:00
commit 714fed7f00
2 changed files with 41 additions and 7 deletions

View file

@ -221,7 +221,7 @@ impl OpenCADStudio {
// 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)
// CommitAndExit arm). Non-continuable repeats (point/ray)
// leave the anchor untouched. (#327)
if matches!(
entity,