Skip to content
Permalink
Browse files

Snap to grid to sub unit resolution

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 aa95881633280e894627cbf5b317bb62329873aa
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/gui/qgssnaptogridcanvasitem.cpp
@@ -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 );

0 comments on commit aa95881

Please sign in to comment.
You can’t perform that action at this time.