@@ -442,7 +442,6 @@ void QgsVertexTool::cadCanvasPressEvent( QgsMapMouseEvent *e )
442
442
{
443
443
if ( !mSelectionRect && !mDraggingVertex && !mDraggingEdge )
444
444
{
445
- // show popup menu - if we are on top of a feature
446
445
if ( mLastMouseMoveMatch .isValid () && mLastMouseMoveMatch .layer () )
447
446
{
448
447
showVertexEditor (); // #spellok
@@ -462,6 +461,9 @@ void QgsVertexTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
462
461
if ( mNewVertexFromDoubleClick )
463
462
{
464
463
QgsPointLocator::Match m ( *mNewVertexFromDoubleClick );
464
+ if ( mSelectedFeature && ( mSelectedFeature ->featureId () != m.featureId () || mSelectedFeature ->layer () != m.layer () ) )
465
+ return ; // when a feature is bound to the vector editor, only process actions on that feature
466
+
465
467
mNewVertexFromDoubleClick .reset ();
466
468
467
469
// dragging of edges and double clicking on edges to add vertex are slightly overlapping
@@ -822,11 +824,12 @@ void QgsVertexTool::mouseMoveNotDragging( QgsMapMouseEvent *e )
822
824
823
825
// do not use snap from mouse event, use our own with any editable layer
824
826
QgsPointLocator::Match m = snapToEditableLayer ( e );
827
+ bool targetIsAllowed = ( !mSelectedFeature || ( mSelectedFeature ->featureId () == m.featureId () && mSelectedFeature ->layer () == m.layer () ) );
825
828
826
829
mLastMouseMoveMatch = m;
827
830
828
831
// possibility to move a vertex
829
- if ( m.type () == QgsPointLocator::Vertex )
832
+ if ( m.type () == QgsPointLocator::Vertex && targetIsAllowed )
830
833
{
831
834
updateVertexBand ( m );
832
835
@@ -857,7 +860,7 @@ void QgsVertexTool::mouseMoveNotDragging( QgsMapMouseEvent *e )
857
860
}
858
861
859
862
// possibility to create new vertex here - or to move the edge
860
- if ( m.type () == QgsPointLocator::Edge )
863
+ if ( m.type () == QgsPointLocator::Edge && targetIsAllowed )
861
864
{
862
865
QgsPointXY mapPoint = toMapCoordinates ( e->pos () );
863
866
bool isCircularEdge = false ;
@@ -941,6 +944,7 @@ void QgsVertexTool::updateFeatureBand( const QgsPointLocator::Match &m )
941
944
{
942
945
if ( mFeatureBandLayer == m.layer () && mFeatureBandFid == m.featureId () )
943
946
return ; // skip regeneration of rubber band if not needed
947
+
944
948
QgsGeometry geom = cachedGeometry ( m.layer (), m.featureId () );
945
949
mFeatureBandMarkers ->setToGeometry ( geometryToMultiPoint ( geom ), m.layer () );
946
950
mFeatureBandMarkers ->setVisible ( true );
@@ -1197,6 +1201,8 @@ void QgsVertexTool::startDragging( QgsMapMouseEvent *e )
1197
1201
QgsPointLocator::Match m = snapToEditableLayer ( e );
1198
1202
if ( !m.isValid () )
1199
1203
return ;
1204
+ if ( mSelectedFeature && ( mSelectedFeature ->featureId () != m.featureId () || mSelectedFeature ->layer () != m.layer () ) )
1205
+ return ; // when a feature is bound to the vertex editor, only process actions for that feature
1200
1206
1201
1207
// activate advanced digitizing dock
1202
1208
setAdvancedDigitizingAllowed ( true );
@@ -1636,6 +1642,7 @@ void QgsVertexTool::moveVertex( const QgsPointXY &mapPoint, const QgsPointLocato
1636
1642
1637
1643
QgsVectorLayer *dragLayer = mDraggingVertex ->layer ;
1638
1644
QgsFeatureId dragFid = mDraggingVertex ->fid ;
1645
+
1639
1646
int dragVertexId = mDraggingVertex ->vertexId ;
1640
1647
bool addingVertex = mDraggingVertexType == AddingVertex || mDraggingVertexType == AddingEndpoint;
1641
1648
bool addingAtEndpoint = mDraggingVertexType == AddingEndpoint;
0 commit comments