Sketcher: Fix double icons not selectable
========================================= The scaling factor used was the one of the ViewProviderSketch, however ZoomTranslation uses its own scaling factor. fixes #6283
This commit is contained in:
committed by
abdullahtahiriyo
parent
423ff82409
commit
11c76c998e
@@ -1743,6 +1743,7 @@ std::set<int> EditModeConstraintCoinManager::detectPreselectionConstr(const SoPi
|
||||
|
||||
SbVec3f absPos;
|
||||
SbVec3f trans;
|
||||
float scaleFactor;
|
||||
|
||||
auto translation = static_cast<SoZoomTranslation *>(static_cast<SoSeparator *>(tailFather)->getChild( static_cast<int>(ConstraintNodePosition::FirstTranslationIndex)));
|
||||
|
||||
@@ -1750,17 +1751,22 @@ std::set<int> EditModeConstraintCoinManager::detectPreselectionConstr(const SoPi
|
||||
|
||||
trans = translation->translation.getValue();
|
||||
|
||||
scaleFactor = translation->getScaleFactor();
|
||||
|
||||
if (tail != sep->getChild(static_cast<int>(ConstraintNodePosition::FirstIconIndex))) {
|
||||
Base::Console().Log("SecondIcon\n");
|
||||
|
||||
auto translation2 = static_cast<SoZoomTranslation *>(static_cast<SoSeparator *>(tailFather)->getChild( static_cast<int>(ConstraintNodePosition::SecondTranslationIndex)));
|
||||
|
||||
absPos += translation2->abPos.getValue();
|
||||
|
||||
trans += translation2->translation.getValue();
|
||||
|
||||
scaleFactor = translation2->getScaleFactor();
|
||||
}
|
||||
|
||||
// TODO: Is this calculation actually sound? Why the absolute position is not scaled and the translation is? Review.
|
||||
SbVec3f constrPos = absPos + trans*ViewProviderSketchCoinAttorney::getScaleFactor(viewProvider);
|
||||
// Only the translation is scaled because this is how SoZoomTranslation works
|
||||
SbVec3f constrPos = absPos + scaleFactor*trans;
|
||||
|
||||
SbVec2f iconCoords = ViewProviderSketchCoinAttorney::getScreenCoordinates(viewProvider, SbVec2f(constrPos[0],constrPos[1]));
|
||||
|
||||
@@ -1785,16 +1791,20 @@ std::set<int> EditModeConstraintCoinManager::detectPreselectionConstr(const SoPi
|
||||
|
||||
if (b->first.contains(iconX, iconY)) {
|
||||
// We've found a bounding box that contains the mouse pointer!
|
||||
for (std::set<int>::iterator k = b->second.begin(); k != b->second.end(); ++k)
|
||||
for (std::set<int>::iterator k = b->second.begin(); k != b->second.end(); ++k) {
|
||||
constrIndices.insert(*k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// It's a constraint icon, not a combined one
|
||||
QStringList constrIdStrings = constrIdsStr.split(QString::fromLatin1(","));
|
||||
while (!constrIdStrings.empty())
|
||||
constrIndices.insert(constrIdStrings.takeAt(0).toInt());
|
||||
while (!constrIdStrings.empty()) {
|
||||
auto constraintid = constrIdStrings.takeAt(0).toInt();
|
||||
constrIndices.insert(constraintid);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user