@@ -61,12 +61,15 @@ QgsMeasure::QgsMeasure(bool measureArea, QgsMapCanvas *mc, Qt::WFlags f)
61
61
mRubberBand = new QgsRubberBand (mMapCanvas , mMeasureArea );
62
62
63
63
mCanvas ->setCursor (Qt::CrossCursor);
64
+
65
+ mRightMouseClicked = false ;
64
66
}
65
67
66
68
void QgsMeasure::activate ()
67
69
{
68
70
restorePosition ();
69
71
QgsMapTool::activate ();
72
+ mRightMouseClicked = false ;
70
73
}
71
74
72
75
void QgsMeasure::deactivate ()
@@ -100,6 +103,8 @@ void QgsMeasure::restart(void )
100
103
updateUi ();
101
104
102
105
mRubberBand ->reset (mMeasureArea );
106
+
107
+ mRightMouseClicked = false ;
103
108
}
104
109
105
110
void QgsMeasure::addPoint (QgsPoint &point)
@@ -307,8 +312,11 @@ void QgsMeasure::canvasPressEvent(QMouseEvent * e)
307
312
308
313
void QgsMeasure::canvasMoveEvent (QMouseEvent * e)
309
314
{
310
- QgsPoint point = mCanvas ->getCoordinateTransform ()->toMapCoordinates (e->pos ().x (), e->pos ().y ());
311
- mouseMove (point);
315
+ if (!mRightMouseClicked )
316
+ {
317
+ QgsPoint point = mCanvas ->getCoordinateTransform ()->toMapCoordinates (e->pos ().x (), e->pos ().y ());
318
+ mouseMove (point);
319
+ }
312
320
}
313
321
314
322
@@ -318,11 +326,15 @@ void QgsMeasure::canvasReleaseEvent(QMouseEvent * e)
318
326
319
327
if (e->button () == Qt::RightButton && (e->state () & Qt::LeftButton) == 0 ) // restart
320
328
{
321
- restart ();
329
+ if (mRightMouseClicked )
330
+ restart ();
331
+ else
332
+ mRightMouseClicked = true ;
322
333
}
323
334
else if (e->button () == Qt::LeftButton)
324
335
{
325
336
addPoint (point);
326
337
show ();
327
338
}
339
+
328
340
}
0 commit comments