Skip to content
Permalink
Browse files

Node tool: give preference to vertex match over segment match from pr…

…evious feature
  • Loading branch information
wonder-sk committed Jun 8, 2017
1 parent 91be49a commit b280c873d5667a5049bafdf247076406f30e4bd7
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/app/nodetool/qgsnodetool.cpp
@@ -626,8 +626,13 @@ QgsPointLocator::Match QgsNodeTool::snapToEditableLayer( QgsMapMouseEvent *e )
{
OneFeatureFilter filterLast( mLastSnap->layer(), mLastSnap->featureId() );
QgsPointLocator::Match lastMatch = snapUtils->snapToMap( mapPoint, &filterLast );
if ( lastMatch.isValid() && lastMatch.distance() <= m.distance() )
// but skip the the previously used feature if it would only snap to segment, while now we have snap to vertex
// so that if there is a point on a line, it gets priority (as is usual with combined vertex+segment snapping)
bool matchHasVertexLastHasEdge = m.hasVertex() && lastMatch.hasEdge();
if ( lastMatch.isValid() && lastMatch.distance() <= m.distance() && !matchHasVertexLastHasEdge )
{
m = lastMatch;
}
}

snapUtils->setConfig( oldConfig );

0 comments on commit b280c87

Please sign in to comment.
You can’t perform that action at this time.