Showing with 10 additions and 5 deletions.
  1. +9 −4 src/gui/qgsrubberband.cpp
  2. +1 −1 src/gui/qgsrubberband.h
13 changes: 9 additions & 4 deletions src/gui/qgsrubberband.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ void QgsRubberBand::removePoint( int index, bool doUpdate/* = true*/, int geomet
}
}

void QgsRubberBand::removeLastPoint( int geometryIndex )
void QgsRubberBand::removeLastPoint( int geometryIndex, bool doUpdate/* = true*/ )
{
removePoint( -1, true, geometryIndex );
removePoint( -1, doUpdate, geometryIndex );
}

/*!
Expand Down Expand Up @@ -272,6 +272,7 @@ void QgsRubberBand::addGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
pt = geom->asPoint();
}
addPoint( pt, false, idx );
removeLastPoint( idx , false );
}
break;

Expand All @@ -285,10 +286,12 @@ void QgsRubberBand::addGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
if ( layer )
{
addPoint( mr->layerToMapCoordinates( layer, pt ), false, idx );
removeLastPoint( idx , false );
}
else
{
addPoint( pt, false, idx );
removeLastPoint( idx , false );
}
}
}
Expand Down Expand Up @@ -499,8 +502,10 @@ void QgsRubberBand::updateRect()
{
return;
}
qreal s = ( mIconSize - 1 ) / 2;
qreal p = mPen.width();

qreal scale = mMapCanvas->mapUnitsPerPixel();
qreal s = ( mIconSize - 1 ) / 2 * scale;
qreal p = mPen.width() * scale;

QgsRectangle r( it->x() + mTranslationOffsetX - s - p, it->y() + mTranslationOffsetY - s - p,
it->x() + mTranslationOffsetX + s + p, it->y() + mTranslationOffsetY + s + p );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsrubberband.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem
/**
* Removes the last point. Most useful in connection with undo operations
*/
void removeLastPoint( int geometryIndex = 0 );
void removeLastPoint( int geometryIndex = 0 , bool doUpdate = true );

/**
* Moves the rubber band point specified by index. Note that if the rubber band is
Expand Down