Skip to content

Commit

Permalink
Fix #43275 Panning in a rotated map view with a locked scale changes …
Browse files Browse the repository at this point in the history
…the magnification factor
  • Loading branch information
YoannQDQ authored and nyalldawson committed Mar 29, 2023
1 parent 106a3b7 commit 307cf48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -1465,8 +1465,8 @@ void QgsMapCanvas::setExtent( const QgsRectangle &r, bool magnified )
if ( mScaleLocked && magnified )
{
ScaleRestorer restorer( this );
const double ratio { extent().width() / extent().height() };
const double factor { r.width() / r.height() > ratio ? extent().width() / r.width() : extent().height() / r.height() };
const double ratio { mapSettings().extent().width() / mapSettings().extent().height() };
const double factor { r.width() / r.height() > ratio ? mapSettings().extent().width() / r.width() : mapSettings().extent().height() / r.height() };
const double scaleFactor { std::clamp( mSettings.magnificationFactor() * factor, QgsGuiUtils::CANVAS_MAGNIFICATION_MIN, QgsGuiUtils::CANVAS_MAGNIFICATION_MAX ) };
const QgsPointXY newCenter { r.center() };
mSettings.setMagnificationFactor( scaleFactor, &newCenter );
Expand Down

0 comments on commit 307cf48

Please sign in to comment.