From a889cb8f88c1534898480e82d8459baf05782d23 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 20 Jan 2003 11:52:34 +0000 Subject: [PATCH] Fixed bug in the flight and drive manipulators where they would uncontrollably shrink down to a tiny window size when one rezized the window. --- src/osgGA/DriveManipulator.cpp | 7 +++++-- src/osgGA/FlightManipulator.cpp | 5 ++++- src/osgGA/KeySwitchCameraManipulator.cpp | 12 ++---------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/osgGA/DriveManipulator.cpp b/src/osgGA/DriveManipulator.cpp index f065b0d07..115b05d51 100644 --- a/src/osgGA/DriveManipulator.cpp +++ b/src/osgGA/DriveManipulator.cpp @@ -257,8 +257,11 @@ void DriveManipulator::init(const GUIEventAdapter& ea,GUIActionAdapter& us) } } - us.requestWarpPointer((ea.getXmin()+ea.getXmax())/2,(ea.getYmin()+ea.getYmax())/2); - + if (ea.getEventType()!=GUIEventAdapter::RESIZE) + { + us.requestWarpPointer((ea.getXmin()+ea.getXmax())/2,(ea.getYmin()+ea.getYmax())/2); + } + computeLocalDataFromCamera(); } diff --git a/src/osgGA/FlightManipulator.cpp b/src/osgGA/FlightManipulator.cpp index 7072cf7e6..948397777 100644 --- a/src/osgGA/FlightManipulator.cpp +++ b/src/osgGA/FlightManipulator.cpp @@ -78,7 +78,10 @@ void FlightManipulator::init(const GUIEventAdapter& ea,GUIActionAdapter& us) _velocity = 0.0f; - us.requestWarpPointer((ea.getXmin()+ea.getXmax())/2,(ea.getYmin()+ea.getYmax())/2); + if (ea.getEventType()!=GUIEventAdapter::RESIZE) + { + us.requestWarpPointer((ea.getXmin()+ea.getXmax())/2,(ea.getYmin()+ea.getYmax())/2); + } computeLocalDataFromCamera(); } diff --git a/src/osgGA/KeySwitchCameraManipulator.cpp b/src/osgGA/KeySwitchCameraManipulator.cpp index 1f4cd6589..522d6eef4 100644 --- a/src/osgGA/KeySwitchCameraManipulator.cpp +++ b/src/osgGA/KeySwitchCameraManipulator.cpp @@ -10,6 +10,8 @@ void KeySwitchCameraManipulator::addCameraManipulator(int key, std::string name, _manips[key]=std::make_pair(name,osg::ref_ptr(cm)); if(!_current.valid()){ _current=cm; + _current->setNode(_current->getNode()); + _current->setCamera(_current->getCamera()); } } @@ -39,13 +41,3 @@ bool KeySwitchCameraManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapt return _current->handle(ea,aa); } - -// void KeySwitchCameraManipulator::addCallback(Callback* c) -// { -// _cameraManipChangeCallbacks.addCallback(c); -// } -// -// void KeySwitchCameraManipulator::removeCallback(Callback* c) -// { -// _cameraManipChangeCallbacks.removeCallback(c); -// }