Drag footprints by pads only if one is under the cursor

This commit is contained in:
Maciej Suminski 2017-07-27 11:13:25 +02:00
parent 545a80839b
commit 3ee2f80188
1 changed files with 9 additions and 2 deletions

View File

@ -254,11 +254,18 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos )
case PCB_MODULE_T:
{
MODULE* mod = static_cast<MODULE*>( aItem );
addAnchor( mod->GetPosition(), ORIGIN | SNAPPABLE, mod );
for( auto pad : mod->Pads() )
{
if( pad->GetBoundingBox().Contains( wxPoint( aRefPos.x, aRefPos.y ) ) )
{
addAnchor( pad->GetPosition(), CORNER | SNAPPABLE, pad );
break;
}
}
// if the cursor is not over a pad, then drag the module by its origin
addAnchor( mod->GetPosition(), ORIGIN | SNAPPABLE, mod );
break;
}