Skip to content

Commit

Permalink
[composer] Avoid some use of composition map settings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 14, 2017
1 parent 6ffe507 commit 7d2cd37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposer.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3931,7 +3931,7 @@ void QgsComposer::cleanupAfterTemplateRead()
double currentHeight = mapItem->rect().height(); double currentHeight = mapItem->rect().height();
if ( currentWidth - 0 > 0.0 ) //don't divide through zero if ( currentWidth - 0 > 0.0 ) //don't divide through zero
{ {
QgsRectangle canvasExtent = mComposition->mapSettings().visibleExtent(); QgsRectangle canvasExtent = mQgis->mapCanvas()->mapSettings().visibleExtent();
//adapt min y of extent such that the size of the map item stays the same //adapt min y of extent such that the size of the map item stays the same
double newCanvasExtentHeight = currentHeight / currentWidth * canvasExtent.width(); double newCanvasExtentHeight = currentHeight / currentWidth * canvasExtent.width();
canvasExtent.setYMinimum( canvasExtent.yMaximum() - newCanvasExtentHeight ); canvasExtent.setYMinimum( canvasExtent.yMaximum() - newCanvasExtentHeight );
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposermapwidget.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ void QgsComposerMapWidget::on_mSetToMapCanvasExtentButton_clicked()
return; return;
} }


QgsRectangle newExtent = mComposerMap->composition()->mapSettings().visibleExtent(); QgsRectangle newExtent = QgisApp::instance()->mapCanvas()->mapSettings().visibleExtent();


mComposerMap->beginCommand( tr( "Map extent changed" ) ); mComposerMap->beginCommand( tr( "Map extent changed" ) );
mComposerMap->zoomToExtent( newExtent ); mComposerMap->zoomToExtent( newExtent );
Expand Down

0 comments on commit 7d2cd37

Please sign in to comment.