Skip to content

Commit 02cc0cc

Browse files
committedJul 8, 2016
Fix incorrect label/diagram distance when map is rotated
(Cherry-picked from 873eb7f)
1 parent c79f290 commit 02cc0cc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎src/core/qgspallabeling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2898,7 +2898,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
28982898
{
28992899
distance *= vectorScaleFactor;
29002900
}
2901-
double d = qAbs( ptOne.x() - ptZero.x() ) * distance;
2901+
double d = ptOne.distance( ptZero ) * distance;
29022902
( *labelFeature )->setDistLabel( d );
29032903
}
29042904

‎src/core/qgsvectorlayerdiagramprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,6 @@ QgsLabelFeature* QgsVectorLayerDiagramProvider::registerDiagram( QgsFeature& fea
368368

369369
QgsPoint ptZero = mSettings.xform->toMapCoordinates( 0, 0 );
370370
QgsPoint ptOne = mSettings.xform->toMapCoordinates( 1, 0 );
371-
lf->setDistLabel( qAbs( ptOne.x() - ptZero.x() ) * mSettings.dist );
371+
lf->setDistLabel( ptOne.distance( ptZero ) * mSettings.dist );
372372
return lf;
373373
}

0 commit comments

Comments
 (0)
Please sign in to comment.