Don't capture cursor if zone or polygon cancelled.

If the client tool indicates it isn't happy for us to continue
(because, for instance, the user has cancelled the Zone Properties
dialog), then make sure we don't capture the mouse.

Fixes: lp: 1740780
* https://bugs.launchpad.net/kicad/+bug/1740780
This commit is contained in:
Jeff Young 2018-01-01 21:14:08 +00:00 committed by Wayne Stambaugh
parent 5bc5942f36
commit 658d181ec7
3 changed files with 6 additions and 6 deletions

View File

@ -32,12 +32,12 @@ POLYGON_GEOM_MANAGER::POLYGON_GEOM_MANAGER( CLIENT& aClient ):
{} {}
void POLYGON_GEOM_MANAGER::AddPoint( const VECTOR2I& aPt ) bool POLYGON_GEOM_MANAGER::AddPoint( const VECTOR2I& aPt )
{ {
// if this is the first point, make sure the client is happy // if this is the first point, make sure the client is happy
// for us to continue // for us to continue
if( !IsPolygonInProgress() && !m_client.OnFirstPoint() ) if( !IsPolygonInProgress() && !m_client.OnFirstPoint() )
return; return false;
if( m_leaderPts.size() > 1 ) if( m_leaderPts.size() > 1 )
{ {
@ -53,6 +53,7 @@ void POLYGON_GEOM_MANAGER::AddPoint( const VECTOR2I& aPt )
} }
m_client.OnGeometryChange( *this ); m_client.OnGeometryChange( *this );
return true;
} }

View File

@ -78,7 +78,7 @@ public:
/** /**
* Lock in a polygon point. * Lock in a polygon point.
*/ */
void AddPoint( const VECTOR2I& aPt ); bool AddPoint( const VECTOR2I& aPt );
/** /**
* Mark the polygon finished and update the client * Mark the polygon finished and update the client

View File

@ -1309,10 +1309,9 @@ void DRAWING_TOOL::runPolygonEventLoop( POLYGON_GEOM_MANAGER& polyGeomMgr )
controls.SetAutoPan( false ); controls.SetAutoPan( false );
controls.CaptureCursor( false ); controls.CaptureCursor( false );
} }
else // adding a corner // adding a corner
else if( polyGeomMgr.AddPoint( cursorPos ) )
{ {
polyGeomMgr.AddPoint( cursorPos );
if( !started ) if( !started )
{ {
started = true; started = true;