Skip to content

Commit

Permalink
use float precision for screen coordinates
Browse files Browse the repository at this point in the history
this should fix rounding error when the map canvas has an odd pixel size
  • Loading branch information
3nids committed Sep 28, 2018
1 parent 1a61885 commit 33c68d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/quickgui/qgsquickmapsettings.cpp
Expand Up @@ -118,7 +118,9 @@ QPointF QgsQuickMapSettings::coordinateToScreen( const QgsPoint &point ) const

QgsPoint QgsQuickMapSettings::screenToCoordinate( const QPointF &point ) const
{
const QgsPointXY pp = mMapSettings.mapToPixel().toMapCoordinates( point.toPoint() );
// use floating point precision with mapToCoordinatesF
// instead of integer precision of toMapCoordinates( point.toPoint() )
const QgsPointXY pp = mMapSettings.mapToPixel().toMapCoordinatesF( point.x(), point.y() );
return QgsPoint( pp );
}

Expand Down

0 comments on commit 33c68d2

Please sign in to comment.