Refresh RequestSelection selection if all items were filtered out.

If you have, for instance a pin selected and do a cmd-E we'll filter
out the pin and then do nothing.  We should instead treat it as a
hover selection if everything got filtered.
This commit is contained in:
Jeff Young 2019-05-07 10:38:34 +01:00
parent 4a3add7ac5
commit 2097411550
1 changed files with 14 additions and 12 deletions

View File

@ -493,17 +493,8 @@ void SCH_SELECTION_TOOL::guessSelectionCandidates( SCH_COLLECTOR& collector,
SELECTION& SCH_SELECTION_TOOL::RequestSelection( const KICAD_T aFilterList[] )
{
if( m_selection.Empty() )
{
VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
clearSelection();
SelectPoint( cursorPos, aFilterList );
m_selection.SetIsHover( true );
return m_selection;
}
else // Trim an existing selection by aFilterList
// Filter an existing selection
if( !m_selection.Empty() )
{
for( int i = m_selection.GetSize() - 1; i >= 0; --i )
{
@ -513,8 +504,19 @@ SELECTION& SCH_SELECTION_TOOL::RequestSelection( const KICAD_T aFilterList[] )
toggleSelection( item );
}
return m_selection;
}
// If nothing was selected, or we filtered everything out, do a hover selection
if( m_selection.Empty() )
{
VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
clearSelection();
SelectPoint( cursorPos, aFilterList );
m_selection.SetIsHover( true );
}
return m_selection;
}