Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Scale icon and pen width with rubberband when computing rect
Restores full 2.6 compatibility
  • Loading branch information
Sandro Santilli committed Apr 1, 2015
1 parent d43d8bf commit 84d47c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gui/qgsrubberband.cpp
Expand Up @@ -535,7 +535,8 @@ void QgsRubberBand::updateRect()

const QgsMapToPixel& m2p = *( mMapCanvas->getCoordinateTransform() );

qreal w = ( mIconSize - 1 ) / 2 + mPen.width();
qreal res = m2p.mapUnitsPerPixel();
qreal w = ( ( mIconSize - 1 ) / 2 + mPen.width() ) / res;

QgsRectangle r;
for ( int i = 0; i < mPoints.size(); ++i )
Expand Down Expand Up @@ -563,7 +564,6 @@ void QgsRubberBand::updateRect()
// This is an hack to pass QgsMapCanvasItem::setRect what it
// expects (encoding of position and size of the item)
QgsPoint topLeft = m2p.toMapPoint( r.xMinimum(), r.yMinimum() );
double res = m2p.mapUnitsPerPixel();
QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + r.width()*res, topLeft.y() - r.height()*res );

setRect( rect );
Expand Down

0 comments on commit 84d47c9

Please sign in to comment.