PNS: Keep last valid drag solution in the node

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5450
This commit is contained in:
Jon Evans 2021-04-07 21:59:23 -04:00
parent 26835f582c
commit d4957b112e
2 changed files with 14 additions and 6 deletions

View File

@ -70,6 +70,7 @@ bool DRAGGER::startDragSegment( const VECTOR2D& aP, SEGMENT* aSeg )
int w2 = aSeg->Width() / 2;
m_draggedLine = m_world->AssembleLine( aSeg, &m_draggedSegmentIndex );
m_lastDragSolution = m_draggedLine;
if( m_shove )
{
@ -518,6 +519,7 @@ bool DRAGGER::dragWalkaround( const VECTOR2I& aP )
return true;
}
bool DRAGGER::dragShove( const VECTOR2I& aP )
{
bool ok = false;
@ -560,8 +562,13 @@ bool DRAGGER::dragShove( const VECTOR2I& aP )
VECTOR2D lockV;
dragged.ClearLinks();
dragged.Unmark();
optimizeAndUpdateDraggedLine( dragged, m_draggedLine, aP );
m_lastDragSolution = dragged;
}
else
{
m_lastDragSolution.ClearLinks();
m_lastNode->Add( m_lastDragSolution );
}
break;

View File

@ -134,6 +134,7 @@ private:
NODE* m_lastNode;
int m_mode;
LINE m_draggedLine;
LINE m_lastDragSolution;
std::unique_ptr<SHOVE> m_shove;
int m_draggedSegmentIndex;
bool m_dragStatus;