Skip to content
Permalink
Browse files

Fix UI hang when selecting vertices from complex features when releasing

the mouse button after a drag operation

For large geometries the total vertex count was being calculated
once per vertex, resulting in a lot of unnecessary extra work
  • Loading branch information
nyalldawson committed Mar 17, 2021
1 parent 64d04ed commit 6909b45f17a3aa0b29a64e94863aced0ae2f1023
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/app/vertextool/qgsvertextool.cpp
@@ -601,9 +601,10 @@ void QgsVertexTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

bool isFeatureSelected = vlayer->selectedFeatureIds().contains( f.id() );
QgsGeometry g = f.geometry();
for ( int i = 0; i < g.constGet()->nCoordinates(); ++i )
int i = 0;
for ( auto it = g.constGet()->vertices_begin(); it != g.constGet()->vertices_end(); ++it )
{
QgsPoint pt = g.vertexAt( i );
QgsPoint pt = *it;
if ( layerRubberBandEngine->contains( &pt ) )
{
// we don't want to select invisible features,
@@ -618,6 +619,7 @@ void QgsVertexTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( isFeatureSelected )
selectedVertices << Vertex( vlayer, f.id(), i );
}
i++;
}
}
if ( r )

0 comments on commit 6909b45

Please sign in to comment.