Commit cf25ab77 authored by schurade's avatar schurade

[CHANGE] pressing a ctrl key while picking an object with the mouse ignores...

[CHANGE] pressing a ctrl key while picking an object with the mouse ignores the first picked object, this lets the user pick something behind nav slices for instance
parent a7775815
......@@ -34,6 +34,7 @@ WPickHandler::WPickHandler()
: m_hitResult( WPickInfo() ),
m_startPick( WPickInfo() ),
m_shift( false ),
m_ctrl( false ),
m_viewerName( "" )
{
}
......@@ -42,6 +43,7 @@ WPickHandler::WPickHandler( std::string viewerName )
: m_hitResult( WPickInfo() ),
m_startPick( WPickInfo() ),
m_shift( false ),
m_ctrl( false ),
m_viewerName( viewerName )
{
}
......@@ -90,6 +92,7 @@ bool WPickHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAda
case osgGA::GUIEventAdapter::KEYUP : // Key on keyboard released.
{
m_shift = false;
m_ctrl = false;
return false;
}
case osgGA::GUIEventAdapter::KEYDOWN : // Key on keyboard pushed.
......@@ -109,6 +112,10 @@ bool WPickHandler::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAda
{
m_shift = true;
}
if ( ea.getKey() == osgGA::GUIEventAdapter::KEY_Control_L || ea.getKey() == osgGA::GUIEventAdapter::KEY_Control_R )
{
m_ctrl = true;
}
return false;
}
default:
......@@ -179,6 +186,11 @@ void WPickHandler::pick( osgViewer::View* view, const osgGA::GUIEventAdapter& ea
++hitr;
}
if ( m_ctrl && ( hitr != intersections.end() ) )
{
++hitr;
}
// if we have a previous pick we search for it in the list
if( m_startPick.getName() != "" && m_startPick.getName() != "unpick" )
{
......
......@@ -113,6 +113,7 @@ protected:
WPickInfo m_hitResult; //!< Textual representation of the result of a pick.
WPickInfo m_startPick; //!< indicates what was first picked. Should be "" after unpick.
bool m_shift; //!< is shift pressed?
bool m_ctrl; //!< is ctrl pressed?
std::string m_viewerName; //!< which viewer sends the signal
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment