diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp index 417063f6fe..b77a18227a 100644 --- a/pcbnew/router/pns_dragger.cpp +++ b/pcbnew/router/pns_dragger.cpp @@ -151,6 +151,7 @@ bool DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives ) m_draggedItems.Clear(); m_currentMode = Settings().Mode(); m_freeAngleMode = (m_mode & DM_FREE_ANGLE); + m_lastValidPoint = aP; if( m_currentMode == RM_Shove && !m_freeAngleMode ) { @@ -535,19 +536,16 @@ bool DRAGGER::FixRoute() // invalid). In other modes, we can only commit if "Allow DRC violations" is enabled. if( !m_dragStatus ) { - switch( m_currentMode ) - { - case RM_Shove: - case RM_Smart: - break; + Drag( m_lastValidPoint ); + node = CurrentNode(); - case RM_Walkaround: - default: - if( !Settings().CanViolateDRC() ) - return false; - } + if( !node ) + return false; } + if( !m_dragStatus && !Settings().CanViolateDRC() ) + return false; + Router()->CommitRouting( node ); return true; } @@ -558,24 +556,38 @@ bool DRAGGER::FixRoute() bool DRAGGER::Drag( const VECTOR2I& aP ) { + bool ret = false; + if( m_freeAngleMode ) - return dragMarkObstacles( aP ); - - switch( m_currentMode ) { - case RM_MarkObstacles: - return dragMarkObstacles( aP ); - - case RM_Shove: - case RM_Smart: - return dragShove( aP ); - - case RM_Walkaround: - return dragWalkaround( aP ); - - default: - return false; + ret = dragMarkObstacles( aP ); } + else + { + switch( m_currentMode ) + { + case RM_MarkObstacles: + ret = dragMarkObstacles( aP ); + break; + + case RM_Shove: + case RM_Smart: + ret = dragShove( aP ); + break; + + case RM_Walkaround: + ret = dragWalkaround( aP ); + break; + + default: + break; + } + } + + if( ret ) + m_lastValidPoint = aP; + + return ret; } diff --git a/pcbnew/router/pns_dragger.h b/pcbnew/router/pns_dragger.h index 8dc33a4de5..170253d285 100644 --- a/pcbnew/router/pns_dragger.h +++ b/pcbnew/router/pns_dragger.h @@ -137,6 +137,7 @@ private: int m_draggedSegmentIndex; bool m_dragStatus; PNS_MODE m_currentMode; + VECTOR2D m_lastValidPoint; ///< Contains the list of items that are currently modified by the dragger ITEM_SET m_draggedItems;