Skip to content
Permalink
Browse files

rotated ticks followup : fix annotation margin to corner calculation

  • Loading branch information
olivierdalang authored and nyalldawson committed Oct 7, 2020
1 parent 07d869a commit 70527cb0861a1db475e05d1380c8d611c0ba8709
Showing with 8 additions and 8 deletions.
  1. +8 −8 src/core/layout/qgslayoutitemmapgrid.cpp
@@ -1357,17 +1357,17 @@ void QgsLayoutItemMapGrid::drawCoordinateAnnotation( QgsRenderContext &context,
facingLeft = !facingLeft;
facingRight = !facingRight;
}
if ( annot.border == BorderSide::Top && ( ( facingLeft && xpos < mRotatedAnnotationsMarginToCorner ) ||
( facingRight && xpos > mMap->rect().width() - mRotatedAnnotationsMarginToCorner ) ) )
if ( annot.border == BorderSide::Top && ( ( facingLeft && annot.position.x() < mRotatedAnnotationsMarginToCorner ) ||
( facingRight && annot.position.x() > mMap->rect().width() - mRotatedAnnotationsMarginToCorner ) ) )
return;
if ( annot.border == BorderSide::Bottom && ( ( facingLeft && xpos > mMap->rect().width() - mRotatedAnnotationsMarginToCorner ) ||
( facingRight && xpos < mRotatedAnnotationsMarginToCorner ) ) )
if ( annot.border == BorderSide::Bottom && ( ( facingLeft && annot.position.x() > mMap->rect().width() - mRotatedAnnotationsMarginToCorner ) ||
( facingRight && annot.position.x() < mRotatedAnnotationsMarginToCorner ) ) )
return;
if ( annot.border == BorderSide::Left && ( ( facingLeft && ypos > mMap->rect().height() - mRotatedAnnotationsMarginToCorner ) ||
( facingRight && ypos < mRotatedAnnotationsMarginToCorner ) ) )
if ( annot.border == BorderSide::Left && ( ( facingLeft && annot.position.y() > mMap->rect().height() - mRotatedAnnotationsMarginToCorner ) ||
( facingRight && annot.position.y() < mRotatedAnnotationsMarginToCorner ) ) )
return;
if ( annot.border == BorderSide::Right && ( ( facingLeft && ypos < mRotatedAnnotationsMarginToCorner ) ||
( facingRight && ypos > mMap->rect().height() - mRotatedAnnotationsMarginToCorner ) ) )
if ( annot.border == BorderSide::Right && ( ( facingLeft && annot.position.y() < mRotatedAnnotationsMarginToCorner ) ||
( facingRight && annot.position.y() > mMap->rect().height() - mRotatedAnnotationsMarginToCorner ) ) )
return;

QgsScopedQPainterState painterState( context.painter() );

0 comments on commit 70527cb

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