diff --git a/src/osgGA/KeySwitchMatrixManipulator.cpp b/src/osgGA/KeySwitchMatrixManipulator.cpp index 644699aa2..cf08daaf3 100644 --- a/src/osgGA/KeySwitchMatrixManipulator.cpp +++ b/src/osgGA/KeySwitchMatrixManipulator.cpp @@ -176,15 +176,19 @@ bool KeySwitchMatrixManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapt KeyManipMap::iterator it=_manips.find(ea.getKey()); if(it != _manips.end()) { - OSG_INFO<<"Switching to manipulator: "<<(*it).second.first<second.second->getNode() ) - { - it->second.second->setNode(_current->getNode()); + CameraManipulator* selectedManipulator = it->second.second.get(); + if (selectedManipulator!=_current) + { + OSG_INFO<<"Switching to manipulator: "<second.first<getNode() ) + { + selectedManipulator->setNode(_current->getNode()); + } + selectedManipulator->setByMatrix(_current->getMatrix()); + selectedManipulator->init(ea,aa); + + _current = selectedManipulator; } - it->second.second->setByMatrix(_current->getMatrix()); - it->second.second->init(ea,aa); - _current = it->second.second; - handled = true; } }