diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 12f77daf7f..8911caec31 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -1489,7 +1489,7 @@ public: updateDistanceType(onSketchPos); //Move constraints - if (cstrIndexes.size() > 0) { + if (!cstrIndexes.empty()) { bool oneMoved = false; const std::vector& ConStr = Obj->Constraints.getValues(); int lastConstrIndex = static_cast(ConStr.size()) - 1; @@ -1610,6 +1610,18 @@ public: } return true; } + + void quit() override + { + if (!cstrIndexes.empty()) { + // if a constraint is being made, then we cancel the dimension but not the tool. + resetTool(); + sketchgui->draw(false, false); // Redraw + } + else { + DrawSketchHandler::quit(); + } + } protected: SpecialConstraint specialConstraint; AvailableConstraint availableConstraint; @@ -2712,6 +2724,7 @@ protected: void resetTool() { + Gui::Command::abortCommand(); Gui::Selection().clearSelection(); Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Dimension")); cstrIndexes.clear();