Sketcher: Dimension: Fix right click/esc so that it dismiss the dimension before exiting the tool.

This commit is contained in:
PaddleStroke
2024-07-15 15:43:05 +02:00
committed by Yorik van Havre
parent 8e376b52f2
commit 4527112392

View File

@@ -1489,7 +1489,7 @@ public:
updateDistanceType(onSketchPos);
//Move constraints
if (cstrIndexes.size() > 0) {
if (!cstrIndexes.empty()) {
bool oneMoved = false;
const std::vector<Sketcher::Constraint*>& ConStr = Obj->Constraints.getValues();
int lastConstrIndex = static_cast<int>(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();