Fix alignment tool with locked footprints

This commit is contained in:
Seth Hillbrand 2021-01-08 13:18:52 -08:00
parent 721155165d
commit 51f02ecc51
1 changed files with 14 additions and 2 deletions

View File

@ -66,7 +66,7 @@ bool ALIGN_DISTRIBUTE_TOOL::Init()
m_placementMenu->Add( PCB_ACTIONS::alignLeft );
m_placementMenu->Add( PCB_ACTIONS::alignCenterX );
m_placementMenu->Add( PCB_ACTIONS::alignRight );
m_placementMenu->AppendSeparator();
m_placementMenu->Add( PCB_ACTIONS::alignTop );
m_placementMenu->Add( PCB_ACTIONS::alignCenterY );
@ -162,7 +162,19 @@ size_t ALIGN_DISTRIBUTE_TOOL::GetSelections( ALIGNMENT_RECTS& aItemsToAlign,
BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
if( boardItem->IsLocked() )
lockedItems.push_back( boardItem );
{
// Locking a pad but not the footprint means that we align the footprint using
// the pad position. So we test for footprint locking here
if( m_frame->IsType( FRAME_PCB_EDITOR ) && boardItem->Type() == PCB_PAD_T
&& !boardItem->GetParent()->IsLocked() )
{
itemsToAlign.push_back( boardItem );
}
else
{
lockedItems.push_back( boardItem );
}
}
else
itemsToAlign.push_back( boardItem );
}