Skip to content
Permalink
Browse files

Fix zoom out map tool (fix #12242)

  • Loading branch information
nyalldawson committed Feb 25, 2015
1 parent b70d824 commit 935f46080b978533c3c9967e7d3b243be19fad27
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/gui/qgsmaptoolzoom.cpp
@@ -109,12 +109,13 @@ void QgsMapToolZoom::canvasReleaseEvent( QMouseEvent * e )
const QSize& canvasSize = mapSettings.outputSize();
double sfx = ( double )zoomRectSize.width() / canvasSize.width();
double sfy = ( double )zoomRectSize.height() / canvasSize.height();
double sf = qMax( sfx, sfy );

const QgsMapToPixel* m2p = mCanvas->getCoordinateTransform();
QgsPoint c = m2p->toMapCoordinates( mZoomRect.center() );

mCanvas->setCenter( c );
mCanvas->zoomByFactor( std::max( sfx, sfy ) );
mCanvas->zoomByFactor( mZoomOut ? 1.0 / sf : sf );

mCanvas->refresh();
}

0 comments on commit 935f460

Please sign in to comment.
You can’t perform that action at this time.