Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[composer] Make drawing polygon/polyline follow canvas right click
behaviour (right click ends drawing without adding node)
  • Loading branch information
nyalldawson committed Apr 1, 2016
1 parent 38fa298 commit b466c63
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/gui/qgscomposerview.cpp
Expand Up @@ -796,6 +796,9 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e )
if ( ! mPolygonItem.isNull() )
{
QPolygonF poly = mPolygonItem.data()->polygon();

// last (temporary) point is removed
poly.remove( poly.count() - 1 );
if ( poly.size() >= 3 )
{
mPolygonItem.data()->setPolygon( poly );
Expand Down Expand Up @@ -827,7 +830,9 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e )
// ignore the last point due to release event before doubleClick event
QPolygonF poly = mPolygonItem.data()->polygon();

if ( poly.size() >= 3 )
// last (temporary) point is removed
poly.remove( poly.count() - 1 );
if ( poly.size() >= 2 )
{
mPolygonItem.data()->setPolygon( poly );

Expand Down

0 comments on commit b466c63

Please sign in to comment.