Skip to content
Permalink
Browse files

Scale icon and pen width with rubberband when computing rect

Restores full 2.6 compatibility
  • Loading branch information
Sandro Santilli
Sandro Santilli committed Apr 1, 2015
1 parent d43d8bf commit 84d47c9cf020b0c038e1a371ea6efc52de2d4474
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/gui/qgsrubberband.cpp
@@ -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 )
@@ -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 );

0 comments on commit 84d47c9

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