Skip to content

Commit 03c38e9

Browse files
authoredOct 26, 2018
Merge pull request #8345 from m-kuhn/snapToGridExtentsUpdate
Update snap to grid rect on extentChange
2 parents a0e3c2d + 0a80814 commit 03c38e9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎src/gui/qgssnaptogridcanvasitem.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ void QgsSnapToGridCanvasItem::paint( QPainter *painter )
3131

3232
painter->save();
3333
QgsRectangle mapRect = mMapCanvas->extent();
34-
if ( rect() != mapRect )
35-
setRect( mapRect );
3634

3735
painter->setRenderHints( QPainter::Antialiasing );
3836
painter->setCompositionMode( QPainter::CompositionMode_Difference );
@@ -145,6 +143,10 @@ void QgsSnapToGridCanvasItem::updateZoomFactor()
145143
{
146144
const int threshold = 5;
147145

146+
const QgsRectangle extent = mMapCanvas->extent();
147+
if ( extent != rect() )
148+
setRect( extent );
149+
148150
const QgsPointXY centerPoint = mMapCanvas->extent().center();
149151
const QPointF canvasCenter = toCanvasCoordinates( centerPoint );
150152

0 commit comments

Comments
 (0)
Please sign in to comment.