Skip to content
Permalink
Browse files
[FEATURE] Holding shift while using map zoom tools inverts the zoom
Eg hold shift and click with zoom in tool = zoom out
  • Loading branch information
nyalldawson committed Jan 23, 2017
1 parent 012515c commit 7a0fa23490a0fec8bd34f98be7c75eb88b4b5ef1
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/gui/qgsmaptoolzoom.cpp
@@ -83,6 +83,10 @@ void QgsMapToolZoom::canvasReleaseEvent( QgsMapMouseEvent* e )
if ( e->button() != Qt::LeftButton )
return;

bool zoomOut = mZoomOut;
if ( e->modifiers() & Qt::ShiftModifier )
zoomOut = !zoomOut;

// We are not really dragging in this case. This is sometimes caused by
// a pen based computer reporting a press, move, and release, all the
// one point.
@@ -117,14 +121,14 @@ void QgsMapToolZoom::canvasReleaseEvent( QgsMapMouseEvent* e )
const QgsMapToPixel* m2p = mCanvas->getCoordinateTransform();
QgsPoint c = m2p->toMapCoordinates( mZoomRect.center() );

mCanvas->zoomByFactor( mZoomOut ? 1.0 / sf : sf, &c );
mCanvas->zoomByFactor( zoomOut ? 1.0 / sf : sf, &c );

mCanvas->refresh();
}
else // not dragging
{
// change to zoom in/out by the default multiple
mCanvas->zoomWithCenter( e->x(), e->y(), !mZoomOut );
mCanvas->zoomWithCenter( e->x(), e->y(), !zoomOut );
}
}

0 comments on commit 7a0fa23

Please sign in to comment.