Commit 8f5e6bad authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Removed selection disambiguation in case when there is a choice between a...

Removed selection disambiguation in case when there is a choice between a footprint and a smaller component (smaller components have priority).
parent 382c6bd2
Loading
Loading
Loading
Loading
+25 −5
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )

void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
{
    if( aItem->IsSelected() )
    if( m_selectedItems.find( aItem ) != m_selectedItems.end() )
    {
        aItem->ClearSelected();
        m_selectedItems.erase( aItem );
@@ -204,9 +204,29 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere )
        break;

    default:
        // Remove footprints, they have to be selected by clicking on area that does not
        // contain anything but footprint
        for( int i = 0; i < collector.GetCount(); ++i )
        {
            BOARD_ITEM* boardItem = ( collector )[i];
            if( boardItem->Type() == PCB_MODULE_T )
            {
                wxLogDebug( wxT( "Removing %s" ), boardItem->GetSelectMenuText() );
                collector.Remove( i );
            }
        }

        // Let's see if there is still disambiguation in selection..
        if( collector.GetCount() == 1 )
        {
            toggleSelection( collector[0] );
        }
        else
        {
            item = disambiguationMenu( &collector );
            if( item )
                toggleSelection( item );
        }
        break;
    }
}