Skip to content

Commit

Permalink
Merge pull request #8271 from pblottiere/as_cancel_id
Browse files Browse the repository at this point in the history
Fix map tool when auxiliary layer creation is canceled
  • Loading branch information
pblottiere committed Oct 23, 2018
2 parents 49e8e86 + 6df252a commit 9e82d44
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/app/qgsmaptoolchangelabelproperties.cpp
Expand Up @@ -71,6 +71,12 @@ void QgsMapToolChangeLabelProperties::canvasPressEvent( QgsMapMouseEvent *e )
QgsPalIndexes indexes;
bool newAuxiliaryLayer = createAuxiliaryFields( indexes );

if ( !newAuxiliaryLayer && !mCurrentLabel.layer->auxiliaryLayer() )
{
deleteRubberBands();
return;
}

// in case of a new auxiliary layer, a dialog window is displayed and the
// canvas release event is lost.
if ( newAuxiliaryLayer )
Expand Down
8 changes: 7 additions & 1 deletion src/app/qgsmaptoolmovelabel.cpp
Expand Up @@ -57,13 +57,16 @@ void QgsMapToolMoveLabel::canvasPressEvent( QgsMapMouseEvent *e )

int xCol = -1, yCol = -1;

if ( !mCurrentLabel.pos.isDiagram && !labelMoveable( vlayer, mCurrentLabel.settings, xCol, yCol ) )
if ( !mCurrentLabel.pos.isDiagram && !labelMoveable( vlayer, mCurrentLabel.settings, xCol, yCol ) )
{
QgsPalIndexes indexes;

if ( createAuxiliaryFields( indexes ) )
return;

if ( !labelMoveable( vlayer, mCurrentLabel.settings, xCol, yCol ) )
return;

xCol = indexes[ QgsPalLayerSettings::PositionX ];
yCol = indexes[ QgsPalLayerSettings::PositionY ];
}
Expand All @@ -74,6 +77,9 @@ void QgsMapToolMoveLabel::canvasPressEvent( QgsMapMouseEvent *e )
if ( createAuxiliaryFields( indexes ) )
return;

if ( !diagramMoveable( vlayer, xCol, yCol ) )
return;

xCol = indexes[ QgsDiagramLayerSettings::PositionX ];
yCol = indexes[ QgsDiagramLayerSettings::PositionY ];
}
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsmaptoolrotatelabel.cpp
Expand Up @@ -83,6 +83,9 @@ void QgsMapToolRotateLabel::canvasPressEvent( QgsMapMouseEvent *e )
QgsPalIndexes indexes;
if ( createAuxiliaryFields( indexes ) )
return;

if ( !labelIsRotatable( mCurrentLabel.layer, mCurrentLabel.settings, rotationCol ) )
return;
}

if ( currentLabelDataDefinedRotation( mCurrentRotation, hasRotationValue, rotationCol, true ) )
Expand Down

0 comments on commit 9e82d44

Please sign in to comment.