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

View File

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