Skip to content

Commit

Permalink
correctly keep/clear vertices selection when switching locked feature
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 25, 2019
1 parent 9a08a7d commit 9750868
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/app/vertextool/qgsvertextool.cpp
Expand Up @@ -436,7 +436,7 @@ void QgsVertexTool::cadCanvasPressEvent( QgsMapMouseEvent *e )
}
}

if ( !clickedOnHighlightedVertex )
if ( !clickedOnHighlightedVertex && e->button() == Qt::LeftButton )
setHighlightedVertices( QList<Vertex>() ); // reset selection
}

Expand Down Expand Up @@ -980,6 +980,14 @@ void QgsVertexTool::tryToSelectFeature( QgsMapMouseEvent *e )
{
// we have a feature to select
QPair<QgsVectorLayer *, QgsFeatureId> alternative = mLockedFeatureAlternatives->alternatives.at( mLockedFeatureAlternatives->index );
// keep only corrsesponding vertices
// todo: it might be nice to keep other vertices in memory, so we could select them when switching lokcked feature
QList<Vertex> vertices;
for ( const Vertex &v : qgis::as_const( mSelectedVertices ) )
if ( v.layer == alternative.first && v.fid == alternative.second )
vertices << v;
setHighlightedVertices( vertices, ModeReset );

updateVertexEditor( alternative.first, alternative.second );
}
else
Expand All @@ -991,6 +999,7 @@ void QgsVertexTool::tryToSelectFeature( QgsMapMouseEvent *e )
{
mVertexEditor->updateEditor( nullptr );
}
setHighlightedVertices( QList<Vertex>(), ModeReset );
}

// we have either locked ourselves to a feature or unlocked again
Expand Down

0 comments on commit 9750868

Please sign in to comment.