Skip to content
Permalink
Browse files

Fix annotations not always positioned in reprojected maps correctly

  • Loading branch information
nyalldawson committed Mar 8, 2017
1 parent c9f6e11 commit ff6e05c7786080adde61ec704dcdf2a34b1a1b5e
Showing with 2 additions and 0 deletions.
  1. +1 −0 src/app/qgsmaptoolannotation.cpp
  2. +1 −0 src/gui/qgsmapcanvasannotationitem.cpp
@@ -123,6 +123,7 @@ void QgsMapToolAnnotation::canvasPressEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPos = transformCanvasToAnnotation( toMapCoordinates( e->pos() ), annotation );
annotation->setMapPosition( mapPos );
annotation->setMapPositionCrs( mCanvas->mapSettings().destinationCrs() );
annotation->setRelativePosition( QPointF( e->posF().x() / mCanvas->width(),
e->posF().y() / mCanvas->height() ) );
annotation->setFrameSize( QSizeF( 200, 100 ) );
@@ -36,6 +36,7 @@ QgsMapCanvasAnnotationItem::QgsMapCanvasAnnotationItem( QgsAnnotation *annotatio
connect( mAnnotation, &QgsAnnotation::appearanceChanged, this, [this] { update(); } );
connect( mAnnotation, &QgsAnnotation::moved, this, [this] { updatePosition(); } );
connect( mAnnotation, &QgsAnnotation::moved, this, &QgsMapCanvasAnnotationItem::setFeatureForMapPosition );
connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, [ = ] { updatePosition(); } );

connect( mAnnotation, &QgsAnnotation::appearanceChanged, this, &QgsMapCanvasAnnotationItem::updateBoundingRect );

0 comments on commit ff6e05c

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