Skip to content

Commit

Permalink
[labeling] Fix incorrect label placement after moving an 'unplaced' l…
Browse files Browse the repository at this point in the history
…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 19, 2020
1 parent baf8926 commit f8ac790
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/app/qgsmaptoollabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f8ac790

Please sign in to comment.