diff --git a/pcbnew/tools/placement_tool.cpp b/pcbnew/tools/placement_tool.cpp index 63a3de7f97..b3454cc2b0 100644 --- a/pcbnew/tools/placement_tool.cpp +++ b/pcbnew/tools/placement_tool.cpp @@ -213,8 +213,11 @@ int ALIGN_DISTRIBUTE_TOOL::AlignTop( const TOOL_EVENT& aEvent ) // Move the selected items for( std::pair& 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();