diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index 982f98473f..78418df241 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -110,7 +110,8 @@ void TOOL_BASE::Reset( RESET_REASON aReason ) } -ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer, bool aIgnorePads ) +ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer, bool aIgnorePads, + const std::vector aAvoidItems) { int tl = getView()->GetTopLayer(); @@ -137,6 +138,9 @@ ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer, b if( !IsCopperLayer( item->Layers().Start() ) ) continue; + if( std::find( aAvoidItems.begin(), aAvoidItems.end(), item ) != aAvoidItems.end() ) + continue; + // fixme: this causes flicker with live loop removal... //if( item->Parent() && !item->Parent()->ViewIsVisible() ) // continue; @@ -286,7 +290,7 @@ void TOOL_BASE::updateStartItem( const TOOL_EVENT& aEvent, bool aIgnorePads ) m_startSnapPoint = snapToItem( snapEnabled, m_startItem, p ); - if( checkSnap ( m_startItem ) ) + if( checkSnap( m_startItem ) ) { controls()->ForceCursorPosition( true, m_startSnapPoint ); } @@ -324,7 +328,7 @@ void TOOL_BASE::updateEndItem( const TOOL_EVENT& aEvent ) for( int net : nets ) { - endItem = pickSingleItem( mousePos, net, layer ); + endItem = pickSingleItem( mousePos, net, layer, false, { m_startItem } ); if( endItem ) break; diff --git a/pcbnew/router/pns_tool_base.h b/pcbnew/router/pns_tool_base.h index 5ee6d6ce1a..fb97b563bd 100644 --- a/pcbnew/router/pns_tool_base.h +++ b/pcbnew/router/pns_tool_base.h @@ -55,7 +55,7 @@ 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, - bool aIgnorePads = false ); + bool aIgnorePads = false, const std::vector aAvoidItems = {} ); virtual void highlightNet( bool aEnabled, int aNetcode = -1 ); virtual void updateStartItem( const TOOL_EVENT& aEvent, bool aIgnorePads = false ); virtual void updateEndItem( const TOOL_EVENT& aEvent ); diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 4b6359b8ee..ef154660a7 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -54,6 +54,7 @@ using namespace std::placeholders; #include #include #include +#include #include #include "router_tool.h" @@ -1025,6 +1026,7 @@ void ROUTER_TOOL::performDragging( int aMode ) return; } + m_gridHelper->SetAuxAxes( true, m_startSnapPoint, true ); bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem, aMode ); if( !dragStarted ) @@ -1175,10 +1177,11 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) } VECTOR2I p0 = controls()->GetCursorPosition( false ); - + auto p = snapToItem( true, m_startItem, p0 ); + m_gridHelper->SetAuxAxes( true, p, true ); int dragMode = aEvent.Parameter (); - bool dragStarted = m_router->StartDragging( p0, m_startItem, dragMode ); + bool dragStarted = m_router->StartDragging( p, m_startItem, dragMode ); if( !dragStarted ) return 0;