pcbnew: Initialize drag and clear links

Drag is used for multiple modes so should be initialized when starting.
The line that we generate however needs to be pristine in drag, so we
clear the links in the duplicate.

Fixes: lp:1839612
* https://bugs.launchpad.net/kicad/+bug/1839612
This commit is contained in:
Seth Hillbrand 2019-08-12 07:30:46 -07:00
parent ccf18ceb0e
commit 619c78622e
1 changed files with 3 additions and 4 deletions

View File

@ -136,10 +136,8 @@ bool DRAGGER::Start( const VECTOR2I& aP, ITEM* aStartItem )
m_currentMode = Settings().Mode();
m_freeAngleMode = (m_mode & DM_FREE_ANGLE);
if( m_currentMode == RM_Shove )
{
m_shove.reset( new SHOVE( m_world, Router() ) );
}
if( m_currentMode != RM_MarkObstacles )
m_shove = std::make_unique<SHOVE>( m_world, Router() );
aStartItem->Unmark( MK_LOCKED );
@ -184,6 +182,7 @@ bool DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine.Width() / 4 : 0;
LINE origLine( m_draggedLine );
LINE dragged( m_draggedLine );
dragged.ClearSegmentLinks();
if( m_mode == DM_SEGMENT )
dragged.DragSegment( aP, m_draggedSegmentIndex, thresh );