Skip to content

Commit

Permalink
Fix annotations not always positioned in reprojected maps correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 8, 2017
1 parent c9f6e11 commit ff6e05c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app/qgsmaptoolannotation.cpp
Expand Up @@ -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 ) );
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsmapcanvasannotationitem.cpp
Expand Up @@ -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 );

Expand Down

0 comments on commit ff6e05c

Please sign in to comment.