PNS: Grab start item based on clearance if no direct hits found
Fixes annoying "routing start point violates DRC" messages when entering the router from the hotkey and not directly over a track.
This commit is contained in:
parent
f02d7ee593
commit
3475d0cebd
|
@ -118,10 +118,30 @@ bool ROUTER::RoutingInProgress() const
|
|||
}
|
||||
|
||||
|
||||
const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP )
|
||||
const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP, bool aUseClearance )
|
||||
{
|
||||
if( m_state == IDLE || m_placer == nullptr )
|
||||
return m_world->HitTest( aP );
|
||||
{
|
||||
if( aUseClearance )
|
||||
{
|
||||
SEGMENT test( SEG( aP, aP ), -1 );
|
||||
test.SetWidth( 1 );
|
||||
test.SetLayers( LAYER_RANGE::All() );
|
||||
NODE::OBSTACLES obs;
|
||||
m_world->QueryColliding( &test, obs, ITEM::ANY_T, -1, false );
|
||||
|
||||
PNS::ITEM_SET ret;
|
||||
|
||||
for( OBSTACLE& obstacle : obs )
|
||||
ret.Add( obstacle.m_item, false );
|
||||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_world->HitTest( aP );
|
||||
}
|
||||
}
|
||||
else
|
||||
return m_placer->CurrentNode()->HitTest( aP );
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ public:
|
|||
|
||||
bool IsPlacingVia() const;
|
||||
|
||||
const ITEM_SET QueryHoverItems( const VECTOR2I& aP );
|
||||
const ITEM_SET QueryHoverItems( const VECTOR2I& aP, bool aUseClearance = false );
|
||||
|
||||
bool StartDragging( const VECTOR2I& aP, ITEM* aItem, int aDragMode = DM_ANY );
|
||||
bool StartDragging( const VECTOR2I& aP, ITEM_SET aItems, int aDragMode = DM_COMPONENT );
|
||||
|
|
|
@ -113,6 +113,9 @@ ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer, b
|
|||
|
||||
ITEM_SET candidates = m_router->QueryHoverItems( aWhere );
|
||||
|
||||
if( candidates.Empty() )
|
||||
candidates = m_router->QueryHoverItems( aWhere, true );
|
||||
|
||||
for( ITEM* item : candidates.Items() )
|
||||
{
|
||||
if( !item->IsRoutable() )
|
||||
|
|
Loading…
Reference in New Issue