From e0146f73b9a0ee78b570cce4f2bb72f6331ba849 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 3 Jul 2021 20:00:54 -0400 Subject: [PATCH] PNS: Pick up complete lines between pads when dragging components Fixes https://gitlab.com/kicad/code/kicad/-/issues/7614 --- pcbnew/router/pns_component_dragger.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pcbnew/router/pns_component_dragger.cpp b/pcbnew/router/pns_component_dragger.cpp index 1ccb63b4d5..f290af425f 100644 --- a/pcbnew/router/pns_component_dragger.cpp +++ b/pcbnew/router/pns_component_dragger.cpp @@ -84,6 +84,28 @@ bool COMPONENT_DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives ) cn.attachedPad = aSolid; cn.offset = aOffset; + // Lines that go directly between two linked pads are also special-cased + const SHAPE_LINE_CHAIN& line = cn.origLine.CLine(); + JOINT* jA = m_world->FindJoint( line.CPoint( 0 ), aItem->Layer(), aItem->Net() ); + JOINT* jB = m_world->FindJoint( line.CPoint( -1 ), aItem->Layer(), aItem->Net() ); + + wxASSERT( jA == aJoint || jB == aJoint ); + JOINT* jSearch = ( jA == aJoint ) ? jB : jA; + + if( jSearch && jSearch->LinkCount( ITEM::SOLID_T ) ) + { + for( const ITEM_SET::ENTRY& otherItem : jSearch->LinkList() ) + { + if( aPrimitives.Contains( otherItem.item ) ) + { + for( ITEM* item : cn.origLine.Links() ) + m_fixedItems.insert( item ); + + return; + } + } + } + m_conns.push_back( cn ); };