From Cory Riddell, "I added an _allowThrow bool and get / set accessors to
TrackballManipulator. The purpose of this is to disable throwing when you release the mouse button while moving the mouse. The default settings is true (ie, allow throw). The two source files are attached. "
This commit is contained in:
parent
fddaaf0d00
commit
4f72be65dc
@ -108,6 +108,12 @@ class OSGGA_EXPORT TrackballManipulator : public MatrixManipulator
|
||||
|
||||
/** Get the size of the trackball. */
|
||||
float getTrackballSize() const { return _trackballSize; }
|
||||
|
||||
/** Set the 'allow throw' flag. Releasing the mouse button while moving the camera results in a throw. */
|
||||
void setAllowThrow(bool allowThrow) { _allowThrow = allowThrow; }
|
||||
|
||||
/** Returns true if the camera can be thrown, false otherwise. This defaults to true. */
|
||||
bool getAllowThrow() const { return _allowThrow; }
|
||||
protected:
|
||||
|
||||
virtual ~TrackballManipulator();
|
||||
@ -140,6 +146,7 @@ class OSGGA_EXPORT TrackballManipulator : public MatrixManipulator
|
||||
double _modelScale;
|
||||
double _minimumZoomScale;
|
||||
|
||||
bool _allowThrow;
|
||||
bool _thrown;
|
||||
|
||||
osg::Vec3d _center;
|
||||
|
@ -10,6 +10,7 @@ TrackballManipulator::TrackballManipulator()
|
||||
{
|
||||
_modelScale = 0.01f;
|
||||
_minimumZoomScale = 0.05f;
|
||||
_allowThrow = true;
|
||||
_thrown = false;
|
||||
|
||||
_distance = 1.0f;
|
||||
@ -80,7 +81,7 @@ bool TrackballManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us
|
||||
switch(ea.getEventType())
|
||||
{
|
||||
case(GUIEventAdapter::FRAME):
|
||||
if (_thrown)
|
||||
if (_thrown && _allowThrow)
|
||||
{
|
||||
if (calcMovement()) us.requestRedraw();
|
||||
}
|
||||
@ -117,7 +118,7 @@ bool TrackballManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us
|
||||
{
|
||||
us.requestRedraw();
|
||||
us.requestContinuousUpdate(true);
|
||||
_thrown = true;
|
||||
_thrown = _allowThrow;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user