pcbnew: Allow deselection when clicking on zone

Deselection by clicking on a zone makes working with plane zones easier
by allowing the selected item to de-selected by clicking on a zone.
Once the selection is cleared, the zone may be re-selected as normal.
Clicking on non-zone items while a separate item is selected will still
select the new non-zone item without requiring a second click.
This commit is contained in:
Seth Hillbrand 2018-10-05 20:24:01 -07:00
parent 502383b759
commit 8c56f5b035
1 changed files with 12 additions and 1 deletions

View File

@ -288,13 +288,24 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
} }
else else
{ {
CLIENT_SELECTION_FILTER filter = nullptr;
// If no modifier keys are pressed, clear the selection // If no modifier keys are pressed, clear the selection
if( !m_additive ) if( !m_additive )
{ {
if( m_selection.Size() != 0 )
filter = []( const VECTOR2I&, GENERAL_COLLECTOR& aCollector )
{
for( int i = aCollector.GetCount() - 1; i >= 0; i-- )
if( aCollector[i]->Type() == PCB_ZONE_AREA_T )
aCollector.Remove( i );
};
clearSelection(); clearSelection();
} }
selectPoint( evt->Position() ); selectPoint( evt->Position(), false, nullptr, filter );
} }
} }