File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1414 ***************************************************************************/
1515#include " qgsmapcanvasdockwidget.h"
1616#include " qgsmapcanvas.h"
17+ #include " qgscsexception.h"
1718#include " qgsprojectionselectiondialog.h"
1819#include " qgsscalecombobox.h"
1920#include " qgsstatusbarmagnifierwidget.h"
@@ -194,7 +195,18 @@ void QgsMapCanvasDockWidget::mapExtentChanged()
194195 syncView ( false );
195196
196197 QgsMapCanvas *destCanvas = sourceCanvas == mMapCanvas ? mMainCanvas : mMapCanvas ;
197- destCanvas->setExtent ( sourceCanvas->extent () );
198+
199+ // reproject extent
200+ QgsCoordinateTransform ct ( sourceCanvas->mapSettings ().destinationCrs (),
201+ destCanvas->mapSettings ().destinationCrs () );
202+ try
203+ {
204+ destCanvas->setExtent ( ct.transformBoundingBox ( sourceCanvas->extent () ) );
205+ }
206+ catch ( QgsCsException & )
207+ {
208+ destCanvas->setExtent ( sourceCanvas->extent () );
209+ }
198210 destCanvas->refresh ();
199211
200212 syncView ( true );
You can’t perform that action at this time.
0 commit comments