From 45271123928025d6868cd360b507f35ab0365f17 Mon Sep 17 00:00:00 2001 From: PaddleStroke Date: Mon, 15 Jul 2024 15:43:05 +0200 Subject: [PATCH] Sketcher: Dimension: Fix right click/esc so that it dismiss the dimension before exiting the tool. --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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();