@@ -474,12 +474,14 @@ QgsPointLocator::Match QgsNodeTool2::snapToEditableLayer( QgsMapMouseEvent *e )
474
474
{
475
475
QgsPoint mapPoint = toMapCoordinates ( e->pos () );
476
476
double tol = QgsTolerance::vertexSearchRadius ( canvas ()->mapSettings () );
477
+ qDebug ( " snap: pt %f,%f tol %f" , mapPoint.x (), mapPoint.y (), tol );
477
478
478
479
QgsSnappingConfig config ( QgsProject::instance () );
479
480
config.setEnabled ( true );
480
481
config.setMode ( QgsSnappingConfig::AdvancedConfiguration );
481
482
config.setIntersectionSnapping ( false ); // only snap to layers
482
483
484
+ qDebug ( " canvas layers: %d" , canvas ()->layers ().count () );
483
485
Q_FOREACH ( QgsMapLayer* layer, canvas ()->layers () )
484
486
{
485
487
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer*>( layer );
@@ -488,6 +490,7 @@ QgsPointLocator::Match QgsNodeTool2::snapToEditableLayer( QgsMapMouseEvent *e )
488
490
489
491
config.setIndividualLayerSettings ( vlayer, QgsSnappingConfig::IndividualLayerSettings (
490
492
true , QgsSnappingConfig::VertexAndSegment, tol, QgsTolerance::ProjectUnits ) );
493
+ qDebug ( " will use layer %s tolerance %f" , vlayer->name ().toAscii ().data (), tol );
491
494
}
492
495
493
496
QgsSnappingUtils* snapUtils = canvas ()->snappingUtils ();
@@ -733,11 +736,13 @@ void QgsNodeTool2::startDragging( QgsMapMouseEvent *e )
733
736
QgsPoint mapPoint = toMapCoordinates ( e->pos () );
734
737
if ( isNearEndpointMarker ( mapPoint ) )
735
738
{
739
+ qDebug ( " start drag at endpoint" );
736
740
startDraggingAddVertexAtEndpoint ( mapPoint );
737
741
return ;
738
742
}
739
743
740
744
QgsPointLocator::Match m = snapToEditableLayer ( e );
745
+ qDebug ( " match type: %d" , m.type () );
741
746
if ( !m.isValid () )
742
747
return ;
743
748
@@ -747,6 +752,7 @@ void QgsNodeTool2::startDragging( QgsMapMouseEvent *e )
747
752
// adding a new vertex instead of moving a vertex
748
753
if ( m.hasEdge () )
749
754
{
755
+ qDebug ( " dragging edge!" );
750
756
// only start dragging if we are near edge center
751
757
mapPoint = toMapCoordinates ( e->pos () );
752
758
bool isNearCenter = matchEdgeCenterTest ( m, mapPoint );
@@ -757,6 +763,7 @@ void QgsNodeTool2::startDragging( QgsMapMouseEvent *e )
757
763
}
758
764
else // vertex
759
765
{
766
+ qDebug ( " dragging vertex!" );
760
767
startDraggingMoveVertex ( e->mapPoint (), m );
761
768
}
762
769
}
0 commit comments