Pcbnew: Do not move footprint fields twice in align/distribution tools

Fixes https://gitlab.com/kicad/code/kicad/issues/8094
This commit is contained in:
Mikolaj Wielgus 2021-04-02 22:52:06 +02:00 committed by Seth Hillbrand
parent 7655533412
commit 99fd872fce
1 changed files with 31 additions and 1 deletions

View File

@ -213,8 +213,11 @@ int ALIGN_DISTRIBUTE_TOOL::AlignTop( const TOOL_EVENT& aEvent )
// Move the selected items
for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
{
int difference = targetTop - i.second.GetTop();
BOARD_ITEM* item = i.first;
int difference = targetTop - i.second.GetTop();
if( item->GetParent() && item->GetParent()->IsSelected() )
continue;
// Don't move a pad by itself unless editing the footprint
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
@ -258,6 +261,9 @@ int ALIGN_DISTRIBUTE_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
int difference = targetBottom - i.second.GetBottom();
BOARD_ITEM* item = i.first;
if( item->GetParent() && item->GetParent()->IsSelected() )
continue;
// Don't move a pad by itself unless editing the footprint
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
item = item->GetParent();
@ -315,6 +321,9 @@ int ALIGN_DISTRIBUTE_TOOL::doAlignLeft()
int difference = targetLeft - i.second.GetLeft();
BOARD_ITEM* item = i.first;
if( item->GetParent() && item->GetParent()->IsSelected() )
continue;
// Don't move a pad by itself unless editing the footprint
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
item = item->GetParent();
@ -372,6 +381,9 @@ int ALIGN_DISTRIBUTE_TOOL::doAlignRight()
int difference = targetRight - i.second.GetRight();
BOARD_ITEM* item = i.first;
if( item->GetParent() && item->GetParent()->IsSelected() )
continue;
// Don't move a pad by itself unless editing the footprint
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
item = item->GetParent();
@ -414,6 +426,9 @@ int ALIGN_DISTRIBUTE_TOOL::AlignCenterX( const TOOL_EVENT& aEvent )
int difference = targetX - i.second.GetCenter().x;
BOARD_ITEM* item = i.first;
if( item->GetParent() && item->GetParent()->IsSelected() )
continue;
// Don't move a pad by itself unless editing the footprint
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
item = item->GetParent();
@ -456,6 +471,9 @@ int ALIGN_DISTRIBUTE_TOOL::AlignCenterY( const TOOL_EVENT& aEvent )
int difference = targetY - i.second.GetCenter().y;
BOARD_ITEM* item = i.first;
if( item->GetParent() && item->GetParent()->IsSelected() )
continue;
// Don't move a pad by itself unless editing the footprint
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
item = item->GetParent();
@ -549,6 +567,9 @@ void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally( ALIGNMENT_RECTS& items
if( lastItem == item )
continue;
if( item->GetParent() && item->GetParent()->IsSelected() )
continue;
// Don't move a pad by itself unless editing the footprint
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
item = item->GetParent();
@ -579,6 +600,9 @@ void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally( ALIGNMENT_RECTS &it
{
BOARD_ITEM* item = i.first;
if( item->GetParent() && item->GetParent()->IsSelected() )
continue;
// Don't move a pad by itself unless editing the footprint
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
item = item->GetParent();
@ -670,6 +694,9 @@ void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically( ALIGNMENT_RECTS& itemsTo
if( lastItem == item )
continue;
if( item->GetParent() && item->GetParent()->IsSelected() )
continue;
// Don't move a pad by itself unless editing the footprint
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
item = item->GetParent();
@ -700,6 +727,9 @@ void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically( ALIGNMENT_RECTS& item
{
BOARD_ITEM* item = i.first;
if( item->GetParent() && item->GetParent()->IsSelected() )
continue;
// Don't move a pad by itself unless editing the footprint
if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
item = item->GetParent();