Skip to content

Commit 873eb7f

Browse files
committedJul 8, 2016
Fix incorrect label/diagram distance when map is rotated
1 parent 871ea87 commit 873eb7f

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
@@ -2917,7 +2917,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
29172917
{
29182918
distance *= vectorScaleFactor;
29192919
}
2920-
double d = qAbs( ptOne.x() - ptZero.x() ) * distance;
2920+
double d = ptOne.distance( ptZero ) * distance;
29212921
( *labelFeature )->setDistLabel( d );
29222922
}
29232923

‎src/core/qgsvectorlayerdiagramprovider.cpp

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

340340
QgsPoint ptZero = mapSettings.mapToPixel().toMapCoordinates( 0, 0 );
341341
QgsPoint ptOne = mapSettings.mapToPixel().toMapCoordinates( 1, 0 );
342-
lf->setDistLabel( qAbs( ptOne.x() - ptZero.x() ) * mSettings.distance() );
342+
lf->setDistLabel( ptOne.distance( ptZero ) * mSettings.distance() );
343343
return lf;
344344
}

0 commit comments

Comments
 (0)
Please sign in to comment.