Fixed handling of traverse

This commit is contained in:
Robert Osfield
2014-05-21 10:17:31 +00:00
parent 20fd80de3a
commit d8adc80c2c
2 changed files with 11 additions and 9 deletions

View File

@@ -32,20 +32,24 @@ PushButton::PushButton(const osgUI::PushButton& pb, const osg::CopyOp& copyop):
bool PushButton::handleImplementation(osgGA::EventVisitor* ev, osgGA::Event* event)
{
OSG_NOTICE<<"PushButton::handleImplementation"<<std::endl;
osgGA::GUIEventAdapter* ea = event->asGUIEventAdapter();
if (!ea) return false;
switch(ea->getEventType())
{
case(osgGA::GUIEventAdapter::PUSH):
OSG_NOTICE<<"Button pressed "<<std::endl;
if (_buttonSwitch.valid()) _buttonSwitch->setSingleChildOn(2);
if (_buttonSwitch.valid())
{
_buttonSwitch->setSingleChildOn(2);
runCallbacks("pressed");
}
break;
case(osgGA::GUIEventAdapter::RELEASE):
OSG_NOTICE<<"Button release "<<std::endl;
if (_buttonSwitch.valid()) _buttonSwitch->setSingleChildOn(1);
if (_buttonSwitch.valid())
{
_buttonSwitch->setSingleChildOn(1);
runCallbacks("released");
}
break;
default:
break;
@@ -69,7 +73,6 @@ void PushButton::leaveImplementation()
void PushButton::createGraphicsImplementation()
{
if (_textDrawable.valid())
{
OSG_NOTICE<<"PushButton::createGraphicsImplementation() updating existing TextDrawable"<<std::endl;

View File

@@ -180,8 +180,7 @@ void Widget::traverse(osg::NodeVisitor& nv)
{
osg::Parameters inputParameters, outputParameters;
inputParameters.push_back(&nv);
runCallbacks("traverse",inputParameters, outputParameters);
return;
if (runCallbacks("traverse",inputParameters, outputParameters)) return;
}
traverseImplementation(nv);