Tidy up pad & parent footprint selection corner cases.

Fixes https://gitlab.com/kicad/code/kicad/issues/9923

(cherry picked from commit d9dba2edb2)
This commit is contained in:
Jeff Young 2021-12-21 23:02:33 +00:00
parent 34d855cd53
commit 1dc78c4adc
2 changed files with 7 additions and 9 deletions

View File

@ -699,6 +699,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
sTool->FilterCollectorForMarkers( aCollector );
sTool->FilterCollectorForHierarchy( aCollector, true );
},
// Prompt user regarding locked items if in board editor and in free-pad-mode (if
// we're not in free-pad mode we delay this until the second RequestSelection()).
@ -720,6 +721,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
sTool->FilterCollectorForMarkers( aCollector );
sTool->FilterCollectorForHierarchy( aCollector, true );
sTool->FilterCollectorForFreePads( aCollector );
},
true /* prompt user regarding locked items */ );
@ -1068,6 +1070,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &orig_items );
editFrame->PopTool( tool );
editFrame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
return restore_state ? -1 : 0;
}
@ -1419,6 +1422,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
sTool->FilterCollectorForHierarchy( aCollector, true );
sTool->FilterCollectorForMarkers( aCollector );
},
// Prompt user regarding locked items if in board editor and in free-pad-mode (if

View File

@ -551,25 +551,19 @@ PCB_SELECTION& PCB_SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aCl
DISPOSITION disposition = itemDisposition.second;
if( disposition == BEFORE )
{
unhighlight( item, SELECTED, &m_selection );
}
}
for( std::pair<EDA_ITEM* const, DISPOSITION> itemDisposition : itemDispositions )
{
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( itemDisposition.first );
DISPOSITION disposition = itemDisposition.second;
if( disposition == AFTER )
{
// Note that we must re-highlight even previously-highlighted items
// (ie: disposition BOTH) in case we removed any of their children.
if( disposition == AFTER || disposition == BOTH )
highlight( item, SELECTED, &m_selection );
}
else if( disposition == BOTH )
{
// nothing to do
}
}
m_frame->GetCanvas()->ForceRefresh();
}