Ignore pads when selecting drag candidates in router tool.

Fixes: lp:1747156
* https://bugs.launchpad.net/kicad/+bug/1747156
This commit is contained in:
Jeff Young 2018-03-16 18:00:57 +00:00
parent b335ef0531
commit d3e7efcd66
3 changed files with 12 additions and 8 deletions

View File

@ -113,7 +113,7 @@ void TOOL_BASE::Reset( RESET_REASON aReason )
}
ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer )
ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer, bool aIgnorePads )
{
int tl = getView()->GetTopLayer();
@ -143,6 +143,9 @@ ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer )
{
if( item->OfKind( ITEM::VIA_T | ITEM::SOLID_T ) )
{
if( item->OfKind( ITEM::SOLID_T ) && aIgnorePads )
continue;
if( !prioritized[2] )
prioritized[2] = item;
if( item->Layers().Overlaps( tl ) )
@ -227,7 +230,7 @@ bool TOOL_BASE::checkSnap( ITEM *aItem )
return doSnap;
}
void TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent )
void TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent, bool aIgnorePads )
{
int tl = getView()->GetTopLayer();
VECTOR2I cp = controls()->GetCursorPosition();
@ -247,7 +250,7 @@ void TOOL_BASE::updateStartItem( TOOL_EVENT& aEvent )
p = cp;
}
m_startItem = pickSingleItem( p );
m_startItem = pickSingleItem( p, -1, -1, aIgnorePads );
if( !snapEnabled && m_startItem && !m_startItem->Layers().Overlaps( tl ) )
m_startItem = nullptr;

View File

@ -56,9 +56,10 @@ public:
protected:
bool checkSnap( ITEM* aItem );
const VECTOR2I snapToItem( bool aEnabled, ITEM* aItem, VECTOR2I aP);
virtual ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1 );
virtual ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1,
bool aIgnorePads = false );
virtual void highlightNet( bool aEnabled, int aNetcode = -1 );
virtual void updateStartItem( TOOL_EVENT& aEvent );
virtual void updateStartItem( TOOL_EVENT& aEvent, bool aIgnorePads = false );
virtual void updateEndItem( const TOOL_EVENT& aEvent );
void deleteTraces( ITEM* aStartItem, bool aWholeTrack );

View File

@ -893,17 +893,17 @@ int ROUTER_TOOL::mainLoop( PNS::ROUTER_MODE aMode )
}
else if( evt->IsAction( &PCB_ACTIONS::dragFreeAngle ) )
{
updateStartItem( *evt );
updateStartItem( *evt, true );
performDragging( PNS::DM_ANY | PNS::DM_FREE_ANGLE );
}
else if( evt->IsAction( &PCB_ACTIONS::drag45Degree ) )
{
updateStartItem( *evt );
updateStartItem( *evt, true );
performDragging( PNS::DM_ANY );
}
else if( evt->IsAction( &PCB_ACTIONS::breakTrack ) )
{
updateStartItem( *evt );
updateStartItem( *evt, true );
breakTrack( );
}
else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_NewTrack ) )