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...

(cherry picked from commit 7e6b185)
  • Loading branch information
nyalldawson committed Jun 9, 2020
1 parent baf8926 commit f8ac790d179af924b97c7d98d011421373bea466
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/app/qgsmaptoollabel.cpp
@@ -510,11 +510,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 f8ac790

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