diff --git a/include/osgGA/SphericalManipulator b/include/osgGA/SphericalManipulator index 5aa869e23..a9e50abea 100644 --- a/include/osgGA/SphericalManipulator +++ b/include/osgGA/SphericalManipulator @@ -109,6 +109,11 @@ class OSGGA_EXPORT SphericalManipulator : public MatrixManipulator RotationMode getRotationMode() const {return _rotationMode;} void setRotationMode(RotationMode mode); + /** Returns true if the camera can be thrown, false otherwise. This defaults to true. */ + bool getAllowThrow() const { return _allowThrow; } + /** Set the 'allow throw' flag. Releasing the mouse button while moving the camera results in a throw. */ + void setAllowThrow(bool allowThrow) { _allowThrow = allowThrow; } + protected: virtual ~SphericalManipulator(); @@ -136,6 +141,7 @@ class OSGGA_EXPORT SphericalManipulator : public MatrixManipulator double _minimumZoomScale; bool _thrown; + bool _allowThrow; RotationMode _rotationMode; osg::Vec3d _center; diff --git a/src/osgGA/SphericalManipulator.cpp b/src/osgGA/SphericalManipulator.cpp index 2aae9c51c..2cd882d60 100644 --- a/src/osgGA/SphericalManipulator.cpp +++ b/src/osgGA/SphericalManipulator.cpp @@ -13,6 +13,7 @@ SphericalManipulator::SphericalManipulator() _modelScale = 0.01; _minimumZoomScale = 0.1; _thrown = false; + _allowThrow = true; _distance=1.0; _homeDistance=1.0; @@ -149,7 +150,7 @@ bool SphericalManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us { us.requestRedraw(); us.requestContinuousUpdate(true); - _thrown = true; + _thrown = _allowThrow; } } else