Skip to content

Commit d55de83

Browse files
nyalldawsonjef-n
authored andcommitted
Fix zoom out map tool (fix #12242)
1 parent b321869 commit d55de83

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/gui/qgsmaptoolzoom.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ void QgsMapToolZoom::canvasReleaseEvent( QMouseEvent * e )
109109
const QSize& canvasSize = mapSettings.outputSize();
110110
double sfx = ( double )zoomRectSize.width() / canvasSize.width();
111111
double sfy = ( double )zoomRectSize.height() / canvasSize.height();
112+
double sf = qMax( sfx, sfy );
112113

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

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

119120
mCanvas->refresh();
120121
}

0 commit comments

Comments
 (0)