Skip to content

Commit

Permalink
Snap to grid to sub unit resolution
Browse files Browse the repository at this point in the history
When the grid was smaller than 1 map unit, qgis would just freeze. ouch
  • Loading branch information
m-kuhn committed Sep 13, 2018
1 parent 85ff90f commit aa95881
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gui/qgssnaptogridcanvasitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ void QgsSnapToGridCanvasItem::paint( QPainter *painter )
const double gridYMin = std::ceil( layerExtent.yMinimum() / mPrecision ) * mPrecision;
const double gridYMax = std::ceil( layerExtent.yMaximum() / mPrecision ) * mPrecision;

for ( int x = gridXMin ; x < gridXMax; x += mPrecision )
for ( double x = gridXMin ; x < gridXMax; x += mPrecision )
{
for ( int y = gridYMin ; y < gridYMax; y += mPrecision )
for ( double y = gridYMin ; y < gridYMax; y += mPrecision )
{
const QgsPointXY pt = mTransform.transform( x, y );
const QPointF canvasPt = toCanvasCoordinates( pt );
Expand Down

0 comments on commit aa95881

Please sign in to comment.