diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 9ab8774e7f..60868a5dcc 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -531,7 +531,7 @@ bool SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag, // Apply some ugly heuristics to avoid disambiguation menus whenever possible if( !m_skip_heuristics ) { - guessSelectionCandidates( collector ); + guessSelectionCandidates( collector, aWhere ); if( collector.GetCount() == 1 ) { @@ -1996,7 +1996,8 @@ double calcRatio( double a, double b ) // We currently check for pads and text mostly covering a footprint, but we don’t check for // smaller footprints mostly covering a larger footprint. // -void SELECTION_TOOL::guessSelectionCandidates( GENERAL_COLLECTOR& aCollector ) const +void SELECTION_TOOL::guessSelectionCandidates( GENERAL_COLLECTOR& aCollector, + const VECTOR2I& aWhere ) const { std::set rejected; std::set forced; @@ -2055,8 +2056,11 @@ void SELECTION_TOOL::guessSelectionCandidates( GENERAL_COLLECTOR& aCollector ) c { for( int i = aCollector.GetCount() - 1; i >= 0; i-- ) { - if( aCollector[i]->Type() == PCB_ZONE_AREA_T ) + if( aCollector[i]->Type() == PCB_ZONE_AREA_T && !static_cast + ( aCollector[i] )->HitTestForEdge( wxPoint( aWhere.x, aWhere.y ) ) ) + { aCollector.Remove( i ); + } } } diff --git a/pcbnew/tools/selection_tool.h b/pcbnew/tools/selection_tool.h index 3a8619d616..a7c6e91956 100644 --- a/pcbnew/tools/selection_tool.h +++ b/pcbnew/tools/selection_tool.h @@ -331,8 +331,9 @@ private: * Tries to guess best selection candidates in case multiple items are clicked, by * doing some braindead heuristics. * @param aCollector is the collector that has a list of items to be queried. + * @param aWhere is the selection point to consider */ - void guessSelectionCandidates( GENERAL_COLLECTOR& aCollector ) const; + void guessSelectionCandidates( GENERAL_COLLECTOR& aCollector, const VECTOR2I& aWhere ) const; /** * Event handler to update the selection VIEW_ITEM.