Sketcher_Dimension : enable user to deselect geos by clicking on them again.

This commit is contained in:
Paddle
2023-09-05 11:55:39 +02:00
committed by Chris Hennes
parent bc8a5e4704
commit cde6afe847

View File

@@ -1336,11 +1336,12 @@ public:
if (selIdPair.GeoId == GeoEnum::GeoUndef) {
// If mouse is released on "blank" space, finalize and start over
finalizeCommand();
return true;
}
else if (notSelectedYet(selIdPair)) {
std::vector<SelIdPair>& selVector = getSelectionVector(newselGeoType);
std::vector<SelIdPair>& selVector = getSelectionVector(newselGeoType);
if (notSelectedYet(selIdPair)) {
//add the geometry to its type vector. Temporarily if not selAllowed
selVector.push_back(selIdPair);
@@ -1357,6 +1358,21 @@ public:
selVector.pop_back();
}
}
else {
//if it is already selected we unselect it.
selVector.pop_back();
if (!selectionEmpty()) {
makeAppropriateConstraint(onSketchPos);
}
else {
restartCommand(QT_TRANSLATE_NOOP("Command", "Dimension"));
}
Gui::Selection().rmvSelection(Obj->getDocument()->getName(),
Obj->getNameInDocument(),
ss.str().c_str());
sketchgui->draw(false, false); // Redraw
}
return true;
}
protected:
@@ -1494,6 +1510,11 @@ protected:
&& !contains(selEllipseAndCo, elem);
}
bool selectionEmpty()
{
return selPoints.empty() && selLine.empty() && selCircleArc.empty() && selEllipseAndCo.empty();
}
bool makeAppropriateConstraint(Base::Vector2d onSketchPos) {
bool selAllowed = false;