Skip to content

Commit

Permalink
Fix incorrect label/diagram distance when map is rotated
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 8, 2016
1 parent 871ea87 commit 873eb7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/qgspallabeling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2917,7 +2917,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
{
distance *= vectorScaleFactor;
}
double d = qAbs( ptOne.x() - ptZero.x() ) * distance;
double d = ptOne.distance( ptZero ) * distance;
( *labelFeature )->setDistLabel( d );
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayerdiagramprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,6 @@ QgsLabelFeature* QgsVectorLayerDiagramProvider::registerDiagram( QgsFeature& fea

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

0 comments on commit 873eb7f

Please sign in to comment.