Skip to content
Permalink
Browse files

Fix zoom out map tool (fix #12242)

  • Loading branch information
nyalldawson authored and jef-n committed Feb 25, 2015
1 parent b321869 commit d55de83bc4966665a5bec6325ad0f27d7f4a1ab8
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 d55de83

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