Skip to content

Commit b280c87

Browse files
committedJun 8, 2017
Node tool: give preference to vertex match over segment match from previous feature
1 parent 91be49a commit b280c87

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎src/app/nodetool/qgsnodetool.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,13 @@ QgsPointLocator::Match QgsNodeTool::snapToEditableLayer( QgsMapMouseEvent *e )
626626
{
627627
OneFeatureFilter filterLast( mLastSnap->layer(), mLastSnap->featureId() );
628628
QgsPointLocator::Match lastMatch = snapUtils->snapToMap( mapPoint, &filterLast );
629-
if ( lastMatch.isValid() && lastMatch.distance() <= m.distance() )
629+
// but skip the the previously used feature if it would only snap to segment, while now we have snap to vertex
630+
// so that if there is a point on a line, it gets priority (as is usual with combined vertex+segment snapping)
631+
bool matchHasVertexLastHasEdge = m.hasVertex() && lastMatch.hasEdge();
632+
if ( lastMatch.isValid() && lastMatch.distance() <= m.distance() && !matchHasVertexLastHasEdge )
633+
{
630634
m = lastMatch;
635+
}
631636
}
632637

633638
snapUtils->setConfig( oldConfig );

0 commit comments

Comments
 (0)
Please sign in to comment.