Sketcher: Dimension tool: Filter coincident points (#27630)

This commit is contained in:
PaddleStroke
2026-03-07 15:34:56 -06:00
committed by GitHub
parent cee71e1fb1
commit 36dd4b983c
@@ -2061,6 +2061,10 @@ protected:
selVector.push_back(selIdPair);
}
// Remove redundant coincident points from the selection
// This ensures box-selecting a junction of multiple lines is treated as 1 point.
filterCoincidentPoints();
// See if the selection is valid
bool selAllowed = makeAppropriateConstraint(Base::Vector2d(0.,0.));
@@ -2069,6 +2073,31 @@ protected:
}
}
void filterCoincidentPoints()
{
if (selPoints.size() < 2) {
return;
}
std::vector<SelIdPair> filteredPoints;
for (const auto& p : selPoints) {
bool isRedundant = false;
for (const auto& kept : filteredPoints) {
if (Obj->arePointsCoincident(p.GeoId, p.PosId, kept.GeoId, kept.PosId)) {
isRedundant = true;
break;
}
}
if (!isRedundant) {
filteredPoints.push_back(p);
}
}
selPoints = std::move(filteredPoints);
}
void finalizeCommand()
{
if (hasBeenAborted()) {