@@ -655,6 +655,18 @@ void QgsComposerMap::zoomContent( int delta, double x, double y )
655
655
currentMapExtent ()->setYMaximum ( centerY + newIntervalY / 2 );
656
656
currentMapExtent ()->setYMinimum ( centerY - newIntervalY / 2 );
657
657
658
+ if ( mAtlasDriven && mAtlasScalingMode == Fixed && mComposition ->atlasMode () != QgsComposition::AtlasOff )
659
+ {
660
+ // if map is atlas controlled and set to fixed scaling mode, then scale changes should be treated as permanant
661
+ // and also apply to the map's original extent (see #9602)
662
+ // we can't use the scaleRatio calculated earlier, as the scale can vary depending on extent for geographic coordinate systems
663
+ QgsScaleCalculator calculator;
664
+ calculator.setMapUnits ( mComposition ->mapSettings ().mapUnits () );
665
+ calculator.setDpi ( 25.4 ); // QGraphicsView units are mm
666
+ double scaleRatio = scale () / calculator.calculate ( mExtent , rect ().width () );
667
+ mExtent .scale ( scaleRatio );
668
+ }
669
+
658
670
cache ();
659
671
update ();
660
672
emit itemChanged ();
@@ -789,6 +801,19 @@ void QgsComposerMap::setNewScale( double scaleDenominator )
789
801
790
802
double scaleRatio = scaleDenominator / currentScaleDenominator;
791
803
currentMapExtent ()->scale ( scaleRatio );
804
+
805
+ if ( mAtlasDriven && mAtlasScalingMode == Fixed && mComposition ->atlasMode () != QgsComposition::AtlasOff )
806
+ {
807
+ // if map is atlas controlled and set to fixed scaling mode, then scale changes should be treated as permanant
808
+ // and also apply to the map's original extent (see #9602)
809
+ // we can't use the scaleRatio calculated earlier, as the scale can vary depending on extent for geographic coordinate systems
810
+ QgsScaleCalculator calculator;
811
+ calculator.setMapUnits ( mComposition ->mapSettings ().mapUnits () );
812
+ calculator.setDpi ( 25.4 ); // QGraphicsView units are mm
813
+ scaleRatio = scaleDenominator / calculator.calculate ( mExtent , rect ().width () );
814
+ mExtent .scale ( scaleRatio );
815
+ }
816
+
792
817
mCacheUpdated = false ;
793
818
cache ();
794
819
update ();
0 commit comments