From 084350ace329ffe90da0c154681fab538effeecb Mon Sep 17 00:00:00 2001 From: PaddleStroke Date: Fri, 12 Sep 2025 18:51:31 +0200 Subject: [PATCH] Sketcher: Bspline tool: prevent double click failure (#23872) * Sketcher: Bspline tool: prevent double click failure * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update DrawSketchHandlerBSpline.h * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h index 28a753a19e..f13bca80e9 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerBSpline.h @@ -515,6 +515,12 @@ private: sketchgui->getSketchObject()->solve(); } else if (state() == SelectMode::SeekSecond) { + // Prevent adding a new point if it's coincident with the last one. + if (!points.empty() + && (prevCursorPosition - getLastPoint()).Length() < Precision::Confusion()) { + return false; + } + // We stay in SeekSecond unless the user closed the bspline. bool isClosed = false; @@ -776,7 +782,9 @@ private: for (auto& point : points) { bsplinePoints3D.emplace_back(point.x, point.y, 0.0); } - if (onlyeditoutline) { + + double len = (prevCursorPosition - getLastPoint()).Length(); + if (onlyeditoutline && (points.empty() || len >= Precision::Confusion())) { bsplinePoints3D.emplace_back(prevCursorPosition.x, prevCursorPosition.y, 0.0); }