From 513f7ea56b5a1c2e75ccd1eec073881a8a53b909 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Mon, 4 Feb 2019 15:25:44 -0500 Subject: [PATCH] fix error in scale optimization (#9081) --- src/gui/qgsmapcanvas.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index be4c0036e2af..13a3f79a44ec 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -15,6 +15,7 @@ email : sherman at mrcc.com * * ***************************************************************************/ +#include #include #include @@ -68,7 +69,6 @@ email : sherman at mrcc.com #include "qgsmapthemecollection.h" #include "qgscoordinatetransformcontext.h" #include "qgssvgcache.h" -#include /** * \ingroup gui @@ -1010,7 +1010,7 @@ void QgsMapCanvas::zoomToSelected( QgsVectorLayer *layer ) QgsFeatureIterator fit = layer->getFeatures( req ); QgsFeature f; QgsPointXY closestPoint; - double closestSquaredDistance = extentRect.width() + extentRect.height(); + double closestSquaredDistance = pow( extentRect.width(), 2.0 ) + pow( extentRect.height(), 2.0 ); bool pointFound = false; while ( fit.nextFeature( f ) ) {