Gui: Move isDraggerUnderCursor from Gesture to NavigationStyle

This commit is contained in:
Bas Ruigrok
2025-10-03 20:01:29 +02:00
parent b7c6d8d165
commit 0c2270d4d6
4 changed files with 22 additions and 21 deletions

View File

@@ -24,6 +24,7 @@
# include <Inventor/SbViewportRegion.h>
# include <Inventor/SoPickedPoint.h>
# include <Inventor/actions/SoGetBoundingBoxAction.h>
# include <Inventor/draggers/SoDragger.h>
# include <Inventor/errors/SoDebugError.h>
# include <Inventor/nodes/SoSeparator.h>
# include <Inventor/nodes/SoCamera.h>
@@ -1542,6 +1543,25 @@ const std::vector<SbVec2s>& NavigationStyle::getPolygon(SelectionRole* role) con
return pcPolygon;
}
bool NavigationStyle::isDraggerUnderCursor(const SbVec2s pos) const
{
SoRayPickAction rp(this->viewer->getSoRenderManager()->getViewportRegion());
rp.setRadius(viewer->getPickRadius());
rp.setPoint(pos);
rp.apply(this->viewer->getSoRenderManager()->getSceneGraph());
SoPickedPoint* pick = rp.getPickedPoint();
if (pick) {
const auto fullpath = static_cast<const SoFullPath*>(pick->getPath());
for (int i = 0; i < fullpath->getLength(); ++i) {
if (fullpath->getNode(i)->isOfType(SoDragger::getClassTypeId())) {
return true;
}
}
return false;
}
return false;
}
// This method adds another point to the mouse location log, used for spin
// animation calculations.
void NavigationStyle::addToLog(const SbVec2s pos, const SbTime time)