@@ -190,9 +190,9 @@ void QgsRubberBand::removePoint( int index, bool doUpdate/* = true*/, int geomet
190
190
}
191
191
}
192
192
193
- void QgsRubberBand::removeLastPoint ( int geometryIndex )
193
+ void QgsRubberBand::removeLastPoint ( int geometryIndex, bool doUpdate /* = true */ )
194
194
{
195
- removePoint ( -1 , true , geometryIndex );
195
+ removePoint ( -1 , doUpdate , geometryIndex );
196
196
}
197
197
198
198
/* !
@@ -272,6 +272,7 @@ void QgsRubberBand::addGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
272
272
pt = geom->asPoint ();
273
273
}
274
274
addPoint ( pt, false , idx );
275
+ removeLastPoint ( idx , false );
275
276
}
276
277
break ;
277
278
@@ -285,10 +286,12 @@ void QgsRubberBand::addGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
285
286
if ( layer )
286
287
{
287
288
addPoint ( mr->layerToMapCoordinates ( layer, pt ), false , idx );
289
+ removeLastPoint ( idx , false );
288
290
}
289
291
else
290
292
{
291
293
addPoint ( pt, false , idx );
294
+ removeLastPoint ( idx , false );
292
295
}
293
296
}
294
297
}
@@ -499,8 +502,10 @@ void QgsRubberBand::updateRect()
499
502
{
500
503
return ;
501
504
}
502
- qreal s = ( mIconSize - 1 ) / 2 ;
503
- qreal p = mPen .width ();
505
+
506
+ qreal scale = mMapCanvas ->mapUnitsPerPixel ();
507
+ qreal s = ( mIconSize - 1 ) / 2 * scale;
508
+ qreal p = mPen .width () * scale;
504
509
505
510
QgsRectangle r ( it->x () + mTranslationOffsetX - s - p, it->y () + mTranslationOffsetY - s - p,
506
511
it->x () + mTranslationOffsetX + s + p, it->y () + mTranslationOffsetY + s + p );
0 commit comments