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>
This commit is contained in:
PaddleStroke
2025-09-12 18:51:31 +02:00
committed by GitHub
parent b53e59c1d6
commit 084350ace3

View File

@@ -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);
}