router: fix regression in Backspace (unfix/undo last segment) caused by redesign of the line placement algo

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12835
This commit is contained in:
Tomasz Wlostowski 2022-11-15 22:59:54 +01:00
parent f9bfb8534f
commit b507c44d74
2 changed files with 10 additions and 8 deletions

View File

@ -1325,6 +1325,7 @@ bool LINE_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
{
m_placementCorrect = false;
m_currentStart = VECTOR2I( aP );
m_fixStart = VECTOR2I( aP );
m_currentEnd = VECTOR2I( aP );
m_currentNet = std::max( 0, aStartItem ? aStartItem->Net() : 0 );
m_startItem = aStartItem;
@ -1376,7 +1377,7 @@ bool LINE_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
else
n = m_currentNode;
m_fixedTail.AddStage( m_currentStart, m_currentLayer, m_placingVia, m_direction, n );
m_fixedTail.AddStage( m_fixStart, m_currentLayer, m_placingVia, m_direction, n );
return true;
}
@ -1612,14 +1613,9 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis
setInitialDirection( d_last );
m_currentStart = ( m_placingVia || fixAll ) ? p_last : p_pre_last;
VECTOR2I ps;
if( m_tail.SegmentCount() )
ps = m_tail.CPoint( 0 );
else
ps = m_p_start;
m_fixedTail.AddStage( ps, m_currentLayer, m_placingVia, m_direction, m_currentNode );
m_fixedTail.AddStage( m_fixStart, m_currentLayer, m_placingVia, m_direction, m_currentNode );
m_fixStart = m_currentStart;
m_startItem = nullptr;
m_placingVia = false;
m_chainedPlacement = !pl.EndsWithVia();
@ -1661,16 +1657,20 @@ bool LINE_PLACER::UnfixRoute()
FIXED_TAIL::STAGE st;
if ( !m_fixedTail.PopStage( st ) )
{
return false;
}
m_head.Line().Clear();
m_tail.Line().Clear();
m_startItem = nullptr;
m_p_start = st.pts[0].p;
m_fixStart = m_p_start;
m_direction = st.pts[0].direction;
m_placingVia = st.pts[0].placingVias;
m_currentNode = st.commit;
m_currentLayer = st.pts[0].layer;
m_currentStart = m_p_start;
m_head.SetLayer( m_currentLayer );
m_tail.SetLayer( m_currentLayer );
m_head.RemoveVia();

View File

@ -348,6 +348,8 @@ private:
NODE* m_world; ///< pointer to world to search colliding items
VECTOR2I m_p_start; ///< current routing start (end of tail, beginning of head)
VECTOR2I m_fixStart; ///< start point of the last 'fix'
std::optional<VECTOR2I> m_last_p_end;
std::unique_ptr<SHOVE> m_shove; ///< The shove engine