Skip to content

Commit

Permalink
Remove deprecated wheel action behaviour from composer
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 29, 2016
1 parent d6ec868 commit f9a10e4
Showing 1 changed file with 5 additions and 27 deletions.
32 changes: 5 additions & 27 deletions src/gui/qgscomposerview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2032,14 +2032,8 @@ void QgsComposerView::wheelZoom( QWheelEvent * event )
{
//get mouse wheel zoom behaviour settings
QSettings mySettings;
int wheelAction = mySettings.value( "/qgis/wheel_action", 2 ).toInt();
double zoomFactor = mySettings.value( "/qgis/zoom_factor", 2 ).toDouble();

if (( QgsMapCanvas::WheelAction )wheelAction == QgsMapCanvas::WheelNothing )
{
return;
}

if ( event->modifiers() & Qt::ControlModifier )
{
//holding ctrl while wheel zooming results in a finer zoom
Expand All @@ -2057,27 +2051,11 @@ void QgsComposerView::wheelZoom( QWheelEvent * event )
//transform the mouse pos to scene coordinates
QPointF scenePoint = mapToScene( event->pos() );

//adjust view center according to wheel action setting
switch (( QgsMapCanvas::WheelAction )wheelAction )
{
case QgsMapCanvas::WheelZoomAndRecenter:
{
centerOn( scenePoint.x(), scenePoint.y() );
break;
}

case QgsMapCanvas::WheelZoomToMouseCursor:
{
QgsPoint oldCenter( visibleRect.center() );
QgsPoint newCenter( scenePoint.x() + (( oldCenter.x() - scenePoint.x() ) * scaleFactor ),
scenePoint.y() + (( oldCenter.y() - scenePoint.y() ) * scaleFactor ) );
centerOn( newCenter.x(), newCenter.y() );
break;
}

default:
break;
}
//adjust view center
QgsPoint oldCenter( visibleRect.center() );
QgsPoint newCenter( scenePoint.x() + (( oldCenter.x() - scenePoint.x() ) * scaleFactor ),
scenePoint.y() + (( oldCenter.y() - scenePoint.y() ) * scaleFactor ) );
centerOn( newCenter.x(), newCenter.y() );

//zoom composition
if ( zoomIn )
Expand Down

0 comments on commit f9a10e4

Please sign in to comment.