Skip to content
Permalink
Browse files

[node editor] Dragging a rectangle to select vertices will only select

vertices from a given feature if it is bounded to the node editor panel
  • Loading branch information
nirvn committed Jan 23, 2019
1 parent 704e3de commit 0a239fa9131562188b3cceb6641f1fe91354d6ff
Showing with 14 additions and 2 deletions.
  1. +14 −2 src/app/vertextool/qgsvertextool.cpp
@@ -477,6 +477,7 @@ void QgsVertexTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgsRectangle map_rect( pt0, pt1 );
QList<Vertex> vertices;
QList<Vertex> selectedVertices;
QList<Vertex> editorVertices;

// for each editable layer, select vertices
const auto layers = canvas()->layers();
@@ -499,17 +500,28 @@ void QgsVertexTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( layerRect.contains( pt ) )
{
vertices << Vertex( vlayer, f.id(), i );

if ( isFeatureSelected )
selectedVertices << Vertex( vlayer, f.id(), i );

if ( mSelectedFeature && mSelectedFeature->featureId() == f.id() && mSelectedFeature->layer() == vlayer )
editorVertices << Vertex( vlayer, f.id(), i );
}
}
}
}

// If there were any vertices that come from selected features, use just vertices from selected features.
// If there were any vertices that come from a feature currently binded to the node editor, use just verices from
// that feature, otherwise if there were any vertices from selected features, use just vertices from those selected features.
// This allows user to select a bunch of features in complex situations to constrain the selection.
if ( !selectedVertices.isEmpty() )
if ( !editorVertices.isEmpty() )
{
vertices = editorVertices;
}
else if ( !selectedVertices.isEmpty() )
{
vertices = selectedVertices;
}

HighlightMode mode = ModeReset;
if ( e->modifiers() & Qt::ShiftModifier )

0 comments on commit 0a239fa

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