Moved Handled propety from GUIEventAdapter to Event base class.
Added CameraManipulator::finishAnimation() method to allow application code to stop any animation/throw of manipulators.
This commit is contained in:
@@ -16,10 +16,12 @@
|
||||
using namespace osgGA;
|
||||
|
||||
Event::Event():
|
||||
_handled(false),
|
||||
_time(0.0)
|
||||
{}
|
||||
|
||||
Event::Event(const Event& rhs, const osg::CopyOp& copyop):
|
||||
osg::Object(rhs, copyop),
|
||||
_handled(rhs._handled),
|
||||
_time(rhs._time)
|
||||
{}
|
||||
|
||||
@@ -23,7 +23,6 @@ osg::ref_ptr<GUIEventAdapter>& GUIEventAdapter::getAccumulatedEventState()
|
||||
}
|
||||
|
||||
GUIEventAdapter::GUIEventAdapter():
|
||||
_handled(false),
|
||||
_eventType(NONE),
|
||||
_windowX(0),
|
||||
_windowY(0),
|
||||
@@ -48,7 +47,6 @@ GUIEventAdapter::GUIEventAdapter():
|
||||
|
||||
GUIEventAdapter::GUIEventAdapter(const GUIEventAdapter& rhs,const osg::CopyOp& copyop):
|
||||
osgGA::Event(rhs,copyop),
|
||||
_handled(rhs._handled),
|
||||
_eventType(rhs._eventType),
|
||||
_context(rhs._context),
|
||||
_windowX(rhs._windowX),
|
||||
|
||||
@@ -98,6 +98,18 @@ void KeySwitchMatrixManipulator::computeHomePosition()
|
||||
}
|
||||
}
|
||||
|
||||
void KeySwitchMatrixManipulator::finishAnimation()
|
||||
{
|
||||
OSG_NOTICE<<"KeySwitchMatrixManipulator::finishAnimation()"<<std::endl;
|
||||
for(KeyManipMap::iterator itr=_manips.begin();
|
||||
itr!=_manips.end();
|
||||
++itr)
|
||||
{
|
||||
itr->second.second->finishAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KeySwitchMatrixManipulator::home(const GUIEventAdapter& ee,GUIActionAdapter& aa)
|
||||
{
|
||||
// call home for all child manipulators
|
||||
@@ -178,7 +190,7 @@ bool KeySwitchMatrixManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapt
|
||||
{
|
||||
CameraManipulator* selectedManipulator = it->second.second.get();
|
||||
if (selectedManipulator!=_current)
|
||||
{
|
||||
{
|
||||
OSG_INFO<<"Switching to manipulator: "<<it->second.first<<std::endl;
|
||||
if ( !selectedManipulator->getNode() )
|
||||
{
|
||||
@@ -186,7 +198,7 @@ bool KeySwitchMatrixManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapt
|
||||
}
|
||||
selectedManipulator->setByMatrix(_current->getMatrix());
|
||||
selectedManipulator->init(ea,aa);
|
||||
|
||||
|
||||
_current = selectedManipulator;
|
||||
}
|
||||
handled = true;
|
||||
|
||||
@@ -154,6 +154,8 @@ bool StandardManipulator::isAnimating() const
|
||||
/// Finishes the animation by performing a step that moves it to its final position.
|
||||
void StandardManipulator::finishAnimation()
|
||||
{
|
||||
_thrown = false;
|
||||
|
||||
if( !isAnimating() )
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user