Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[labeling] Fix incorrect label placement after moving an 'unplaced' l…
…abel

For unplaced labels, we can't calculate the new position relative to
the original stored label placement, because we're not actually
showing the 'unplaced' label at the stored position...
  • Loading branch information
nyalldawson committed Jun 9, 2020
1 parent 12dcfab commit cbfb7f4
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/app/labeling/qgsmaptoollabel.cpp
Expand Up @@ -512,11 +512,19 @@ bool QgsMapToolLabel::currentLabelDataDefinedPosition( double &x, bool &xSuccess
return false;
}

QgsAttributes attributes = f.attributes();
if ( !attributes.at( xCol ).isNull() )
x = attributes.at( xCol ).toDouble( &xSuccess );
if ( !attributes.at( yCol ).isNull() )
y = attributes.at( yCol ).toDouble( &ySuccess );
if ( mCurrentLabel.pos.isUnplaced )
{
xSuccess = false;
ySuccess = false;
}
else
{
QgsAttributes attributes = f.attributes();
if ( !attributes.at( xCol ).isNull() )
x = attributes.at( xCol ).toDouble( &xSuccess );
if ( !attributes.at( yCol ).isNull() )
y = attributes.at( yCol ).toDouble( &ySuccess );
}

return true;
}
Expand Down

0 comments on commit cbfb7f4

Please sign in to comment.