From 8c56f5b035ba4cf5c7445b80f61720ea77862d55 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 5 Oct 2018 20:24:01 -0700 Subject: [PATCH] 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. --- pcbnew/tools/selection_tool.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 374cd51855..9ab8774e7f 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -288,13 +288,24 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) } else { + CLIENT_SELECTION_FILTER filter = nullptr; + // If no modifier keys are pressed, clear the selection 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(); } - selectPoint( evt->Position() ); + selectPoint( evt->Position(), false, nullptr, filter ); + } }