Skip to content
Permalink
Browse files

[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 cbfb7f4ce25e10aab5f7b8cee147afb801042704
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/app/labeling/qgsmaptoollabel.cpp
@@ -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;
}

0 comments on commit cbfb7f4

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