Skip to content
Permalink
Browse files

correctly keep/clear vertices selection when switching locked feature

  • Loading branch information
3nids committed Feb 22, 2019
1 parent 21fb442 commit b8f1cb37ed1bcf2b9949196ab29fff9577780bea
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/app/vertextool/qgsvertextool.cpp
@@ -436,7 +436,7 @@ void QgsVertexTool::cadCanvasPressEvent( QgsMapMouseEvent *e )
}
}

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

@@ -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
@@ -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

0 comments on commit b8f1cb3

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