Added Dragger::get/setActivationMouseButtonMask(uint).

This commit is contained in:
Robert Osfield 2012-05-25 15:32:51 +00:00
parent c21f1f488f
commit 1dbb0a7a82
2 changed files with 15 additions and 3 deletions

View File

@ -220,6 +220,9 @@ class OSGMANIPULATOR_EXPORT Dragger : public osg::MatrixTransform
void setActivationModKeyMask(unsigned int mask) { _activationModKeyMask = mask; }
unsigned int getActivationModKeyMask() const { return _activationModKeyMask; }
void setActivationMouseButtonMask(unsigned int mask) { _activationMouseButtonMask = mask; }
unsigned int getActivationMouseButtonMask() const { return _activationMouseButtonMask; }
void setActivationKeyEvent(int key) { _activationKeyEvent = key; }
int getActivationKeyEvent() const { return _activationKeyEvent; }
@ -278,8 +281,10 @@ class OSGMANIPULATOR_EXPORT Dragger : public osg::MatrixTransform
bool _draggerActive;
unsigned int _activationModKeyMask;
unsigned int _activationMouseButtonMask;
int _activationKeyEvent;
bool _activationPermittedByModKeyMask;
bool _activationPermittedByMouseButtonMask;
bool _activationPermittedByKeyEvent;
osgManipulator::PointerInfo _pointer;

View File

@ -166,8 +166,10 @@ Dragger::Dragger() :
_handleEvents(false),
_draggerActive(false),
_activationModKeyMask(0),
_activationMouseButtonMask(0),
_activationKeyEvent(0),
_activationPermittedByModKeyMask(false),
_activationPermittedByMouseButtonMask(false),
_activationPermittedByKeyEvent(false),
_intersectionMask(0xffffffff)
{
@ -183,12 +185,13 @@ Dragger::Dragger(const Dragger& rhs, const osg::CopyOp& copyop):
_handleEvents(rhs._handleEvents),
_draggerActive(false),
_activationModKeyMask(rhs._activationModKeyMask),
_activationMouseButtonMask(rhs._activationMouseButtonMask),
_activationKeyEvent(rhs._activationKeyEvent),
_activationPermittedByModKeyMask(false),
_activationPermittedByMouseButtonMask(false),
_activationPermittedByKeyEvent(false),
_intersectionMask(0xffffffff)
{
OSG_NOTICE<<"CompositeDragger::CompositeDragger(const CompositeDragger& rhs, const osg::CopyOp& copyop) not Implemented yet."<<std::endl;
}
Dragger::~Dragger()
@ -322,12 +325,16 @@ bool Dragger::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&
bool handled = false;
bool activationPermitted = true;
if (_activationModKeyMask!=0 || _activationKeyEvent!=0)
if (_activationModKeyMask!=0 || _activationMouseButtonMask!=0 || _activationKeyEvent!=0)
{
_activationPermittedByModKeyMask = (_activationModKeyMask!=0) ?
((ea.getModKeyMask() & _activationModKeyMask)!=0) :
false;
_activationPermittedByMouseButtonMask = (_activationMouseButtonMask!=0) ?
((ea.getButtonMask() & _activationMouseButtonMask)!=0) :
false;
if (_activationKeyEvent!=0)
{
switch (ea.getEventType())
@ -347,7 +354,7 @@ bool Dragger::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&
}
}
activationPermitted = _activationPermittedByModKeyMask || _activationPermittedByKeyEvent;
activationPermitted = _activationPermittedByModKeyMask || _activationPermittedByMouseButtonMask || _activationPermittedByKeyEvent;
}