mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
router: Inline drag by track end even if cursor is slightly outside the track shape.
(cherry picked from commit 12cf3f93011e5c7a76d52f17fd10253648049baf) Co-authored-by: Alex Shvartzkop <dudesuchamazing@gmail.com>
This commit is contained in:
parent
937d53b77c
commit
d636eec643
@ -2274,26 +2274,33 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
||||
m_gridHelper->SetUseGrid( gal->GetGridSnapping() && !aEvent.DisableGridSnapping() );
|
||||
m_gridHelper->SetSnap( !aEvent.Modifier( MD_SHIFT ) );
|
||||
|
||||
std::set<PNS::NET_HANDLE> highlightNetcodes;
|
||||
|
||||
if( itemsToDrag.Count() >= 1 )
|
||||
{
|
||||
int layer = m_iface->GetPNSLayerFromBoardLayer( m_originalActiveLayer );
|
||||
// Snap to closest item
|
||||
int layer = m_iface->GetPNSLayerFromBoardLayer( m_originalActiveLayer );
|
||||
PNS::ITEM* closestItem = nullptr;
|
||||
SEG::ecoord closestDistSq = std::numeric_limits<SEG::ecoord>::max();
|
||||
|
||||
for( PNS::ITEM* pitem : itemsToDrag.Items() )
|
||||
{
|
||||
if( pitem->Shape( layer )->Collide( p0, 0 ) )
|
||||
{
|
||||
p = snapToItem( pitem, p0 );
|
||||
m_startItem = pitem;
|
||||
SEG::ecoord distSq = pitem->Shape( layer )->SquaredDistance( p0, 0 );
|
||||
|
||||
if( pitem->Net() )
|
||||
highlightNetcodes.insert( pitem->Net() );
|
||||
if( distSq < closestDistSq )
|
||||
{
|
||||
closestDistSq = distSq;
|
||||
closestItem = pitem;
|
||||
}
|
||||
}
|
||||
|
||||
if( highlightNetcodes.size() )
|
||||
highlightNets( true, highlightNetcodes );
|
||||
if( closestItem )
|
||||
{
|
||||
p = snapToItem( closestItem, p0 );
|
||||
|
||||
m_startItem = closestItem;
|
||||
|
||||
if( closestItem->Net() )
|
||||
highlightNets( true, { closestItem->Net() } );
|
||||
}
|
||||
}
|
||||
|
||||
if( !footprints.empty() && singleFootprintDrag )
|
||||
|
Loading…
x
Reference in New Issue
Block a user