diff --git a/common/preview_items/polygon_geom_manager.cpp b/common/preview_items/polygon_geom_manager.cpp index cbd910b345..6b26c1d91f 100644 --- a/common/preview_items/polygon_geom_manager.cpp +++ b/common/preview_items/polygon_geom_manager.cpp @@ -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 // for us to continue if( !IsPolygonInProgress() && !m_client.OnFirstPoint() ) - return; + return false; if( m_leaderPts.size() > 1 ) { @@ -53,6 +53,7 @@ void POLYGON_GEOM_MANAGER::AddPoint( const VECTOR2I& aPt ) } m_client.OnGeometryChange( *this ); + return true; } diff --git a/include/preview_items/polygon_geom_manager.h b/include/preview_items/polygon_geom_manager.h index aaeda2b869..9e66d89047 100644 --- a/include/preview_items/polygon_geom_manager.h +++ b/include/preview_items/polygon_geom_manager.h @@ -78,7 +78,7 @@ public: /** * Lock in a polygon point. */ - void AddPoint( const VECTOR2I& aPt ); + bool AddPoint( const VECTOR2I& aPt ); /** * Mark the polygon finished and update the client diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index d63aaae2a9..280ab77055 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -1309,10 +1309,9 @@ void DRAWING_TOOL::runPolygonEventLoop( POLYGON_GEOM_MANAGER& polyGeomMgr ) controls.SetAutoPan( false ); controls.CaptureCursor( false ); } - else // adding a corner + // adding a corner + else if( polyGeomMgr.AddPoint( cursorPos ) ) { - polyGeomMgr.AddPoint( cursorPos ); - if( !started ) { started = true;