Skip to content

Commit

Permalink
Fix zoom out map tool (fix #12242)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson authored and jef-n committed Feb 25, 2015
1 parent b321869 commit d55de83
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gui/qgsmaptoolzoom.cpp
Expand Up @@ -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();
}
Expand Down

0 comments on commit d55de83

Please sign in to comment.