Skip to content
Permalink
Browse files
[composer] Smooth scrolling for touchpads
  • Loading branch information
nyalldawson committed Mar 17, 2017
1 parent 25fe2b0 commit 1337ee386669a6252b758f2efe04e74daab2fb5b
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/gui/qgscomposerview.cpp
@@ -2016,14 +2016,17 @@ void QgsComposerView::wheelZoom( QWheelEvent *event )
QgsSettings mySettings;
double zoomFactor = mySettings.value( QStringLiteral( "qgis/zoom_factor" ), 2 ).toDouble();

// "Normal" mouse have an angle delta of 120, precision mouses provide data faster, in smaller steps
zoomFactor = 1.0 + ( zoomFactor - 1.0 ) / 120.0 * qAbs( event->angleDelta().y() );

if ( event->modifiers() & Qt::ControlModifier )
{
//holding ctrl while wheel zooming results in a finer zoom
zoomFactor = 1.0 + ( zoomFactor - 1.0 ) / 10.0;
zoomFactor = 1.0 + ( zoomFactor - 1.0 ) / 20.0;
}

//calculate zoom scale factor
bool zoomIn = event->delta() > 0;
bool zoomIn = event->angleDelta().y() > 0;
double scaleFactor = ( zoomIn ? 1 / zoomFactor : zoomFactor );

//get current visible part of scene

0 comments on commit 1337ee3

Please sign in to comment.