Gui: Move isDraggerUnderCursor from Gesture to NavigationStyle
This commit is contained in:
@@ -959,25 +959,6 @@ SbBool GestureNavigationStyle::processSoEvent_bypass(const SoEvent* const ev)
|
||||
return superclass::processSoEvent(ev);
|
||||
}
|
||||
|
||||
bool GestureNavigationStyle::isDraggerUnderCursor(SbVec2s pos)
|
||||
{
|
||||
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;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool GestureNavigationStyle::is2DViewing() const
|
||||
{
|
||||
// #FIXME: detect sketch editing, ! any editing
|
||||
|
||||
@@ -98,8 +98,6 @@ protected: // members variables
|
||||
int rollDir = 0;
|
||||
bool logging = false;
|
||||
|
||||
protected: //helper functions
|
||||
bool isDraggerUnderCursor(SbVec2s pos);
|
||||
public:
|
||||
bool is2DViewing() const;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -189,6 +189,8 @@ public:
|
||||
SbBool isSelecting() const;
|
||||
const std::vector<SbVec2s>& getPolygon(SelectionRole* role=nullptr) const;
|
||||
|
||||
bool isDraggerUnderCursor(const SbVec2s pos) const;
|
||||
|
||||
void setOrbitStyle(OrbitStyle style);
|
||||
OrbitStyle getOrbitStyle() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user