Skip to content

Commit e646647

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)
1 parent 34cbbde commit e646647

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/gui/qgsmapcanvassnapper.cpp

+2-1
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)