Skip to content

Commit 65748d5

Browse files
committed
Make QgsMapCanvas.snapToCurrentLayer() work again (fixes #12631)
The snapper was called with screen coords instead of map coords (due to implicit conversion QPoint->QgsPoint) (cherry picked from commit e646647)
1 parent be0dae1 commit 65748d5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/gui/qgsmapcanvassnapper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ int QgsMapCanvasSnapper::snapToCurrentLayer( const QPoint& p, QList<QgsSnappingR
108108
snapLayers.append( snapLayer );
109109
mSnapper->setSnapLayers( snapLayers );
110110

111-
if ( mSnapper->snapMapPoint( p, results, excludePoints ) != 0 )
111+
QgsPoint mapPoint = mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( p );
112+
if ( mSnapper->snapMapPoint( mapPoint, results, excludePoints ) != 0 )
112113
return 4;
113114

114115
return 0;

0 commit comments

Comments
 (0)