Commit 33ffda6e authored by Jan Möbius's avatar Jan Möbius

Moved fov mouse wheel to ctrl key + wheel.




git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16453 383ad7c9-94d9-4d36-a494-682f7c89f535
parent d73a37c1
......@@ -1886,27 +1886,35 @@ void glViewer::viewWheelEvent( QWheelEvent* _event)
if (projectionMode() == PERSPECTIVE_PROJECTION )
{
// Old style zoom (bad as it does not modify the projection but the modelview,
// which kills e.g. Sky Boxes
//double d = -(double)_event->delta() / 120.0 * 0.2 * factor * properties_.trackballRadius() / 3.0;
//translate( ACG::Vec3d(0.0, 0.0, d) );
// Most mouse types work in steps of 15 degrees, in which case the delta value is a
// multiple of 120; i.e., 120 units * 1/8 = 15 degrees
double numDegrees = double(_event->delta()) / 8.0;
double numSteps = numDegrees / 15.0;
// Update the fovy modifier
// This modifier will be added to the default fov to get the zoom
fovyModifier_ += numSteps * factor ;
// Clamp to minimum
if ( (OpenFlipperSettings().value("Core/Projection/FOVY", 45.0).toDouble() + fovyModifier_) < 1.0 )
fovyModifier_ = 1.0 -OpenFlipperSettings().value("Core/Projection/FOVY", 45.0).toDouble();
// Clamp to maximum
if ( (OpenFlipperSettings().value("Core/Projection/FOVY", 45.0).toDouble() + fovyModifier_) > 179.0 )
fovyModifier_ = 179.0-OpenFlipperSettings().value("Core/Projection/FOVY", 45.0).toDouble();
// Control key : Modify field of view. Otherwise translate
if ( _event->modifiers() & Qt::ControlModifier ) {
// Most mouse types work in steps of 15 degrees, in which case the delta value is a
// multiple of 120; i.e., 120 units * 1/8 = 15 degrees
double numDegrees = double(_event->delta()) / 8.0;
double numSteps = numDegrees / 15.0;
// Update the fovy modifier
// This modifier will be added to the default fov to get the zoom
fovyModifier_ += numSteps * factor ;
// Clamp to minimum
if ( (OpenFlipperSettings().value("Core/Projection/FOVY", 45.0).toDouble() + fovyModifier_) < 1.0 )
fovyModifier_ = 1.0 -OpenFlipperSettings().value("Core/Projection/FOVY", 45.0).toDouble();
// Clamp to maximum
if ( (OpenFlipperSettings().value("Core/Projection/FOVY", 45.0).toDouble() + fovyModifier_) > 179.0 )
fovyModifier_ = 179.0-OpenFlipperSettings().value("Core/Projection/FOVY", 45.0).toDouble();
} else {
// Old style zoom (bad as it does not modify the projection but the modelview,
// which kills e.g. Sky Boxes
double d = -(double)_event->delta() / 120.0 * 0.2 * factor * properties_.trackballRadius() / 3.0;
translate( ACG::Vec3d(0.0, 0.0, d) );
}
updateGL();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment