Skip to content
Permalink
Browse files
Fix preview icon of text formats using balloon callouts with top/bottom
margins
  • Loading branch information
nyalldawson committed Apr 19, 2021
1 parent 804914f commit cefd4edbb056f0cafbd526c6929794850d33d5ae
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/core/callouts/qgscallout.cpp
@@ -1263,9 +1263,13 @@ QPolygonF QgsBalloonCallout::getPoints( QgsRenderContext &context, QgsPointXY or
const double marginTop = context.convertToPainterUnits( top, mMarginUnit );
const double marginBottom = context.convertToPainterUnits( bottom, mMarginUnit );

const QRectF expandedRect( rect.left() - marginLeft, rect.top() + marginBottom,
rect.width() + marginLeft + marginRight,
rect.height() - marginTop - marginBottom );
const QRectF expandedRect = rect.height() < 0 ?
QRectF( rect.left() - marginLeft, rect.top() + marginBottom,
rect.width() + marginLeft + marginRight,
rect.height() - marginTop - marginBottom ) :
QRectF( rect.left() - marginLeft, rect.top() - marginTop,
rect.width() + marginLeft + marginRight,
rect.height() + marginTop + marginBottom );

// IMPORTANT -- check for degenerate height is sometimes >=0, because QRectF are not normalized and we are using painter
// coordinates with descending vertical axis!

0 comments on commit cefd4ed

Please sign in to comment.