PNS: Keep last valid drag solution in the node
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5450
This commit is contained in:
parent
26835f582c
commit
d4957b112e
|
@ -69,7 +69,8 @@ bool DRAGGER::startDragSegment( const VECTOR2D& aP, SEGMENT* aSeg )
|
|||
{
|
||||
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 )
|
||||
{
|
||||
|
@ -272,7 +273,7 @@ bool DRAGGER::dragViaMarkObstacles( const VIA_HANDLE& aHandle, NODE* aNode, cons
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
for( ITEM* item : fanout.Items() )
|
||||
{
|
||||
if( const LINE* l = dyn_cast<const LINE*>( item ) )
|
||||
|
@ -345,7 +346,7 @@ bool DRAGGER::dragViaWalkaround( const VIA_HANDLE& aHandle, NODE* aNode, const V
|
|||
|
||||
if( !viaPropOk ) // can't force-propagate the via? bummer...
|
||||
return false;
|
||||
|
||||
|
||||
for( ITEM* item : fanout.Items() )
|
||||
{
|
||||
if( const LINE* l = dyn_cast<const LINE*>( item ) )
|
||||
|
@ -360,7 +361,7 @@ bool DRAGGER::dragViaWalkaround( const VIA_HANDLE& aHandle, NODE* aNode, const V
|
|||
if ( m_world->CheckColliding( &draggedLine ) )
|
||||
{
|
||||
bool ok = tryWalkaround( m_lastNode, draggedLine, walkLine );
|
||||
|
||||
|
||||
if( !ok )
|
||||
return false;
|
||||
|
||||
|
@ -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;
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
|
||||
private:
|
||||
const ITEM_SET findViaFanoutByHandle ( NODE *aNode, const VIA_HANDLE& handle );
|
||||
|
||||
|
||||
bool dragMarkObstacles( const VECTOR2I& aP );
|
||||
bool dragShove(const VECTOR2I& aP );
|
||||
bool dragWalkaround(const VECTOR2I& aP );
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue