Skip to content

Commit

Permalink
[FEATURE] Holding shift while using map zoom tools inverts the zoom
Browse files Browse the repository at this point in the history
Eg hold shift and click with zoom in tool = zoom out
  • Loading branch information
nyalldawson committed Jan 23, 2017
1 parent 012515c commit 7a0fa23
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/gui/qgsmaptoolzoom.cpp
Expand Up @@ -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.
Expand Down Expand Up @@ -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 );
}
}

Expand Down

0 comments on commit 7a0fa23

Please sign in to comment.