pcbnew: Zone selection heuristic continuity for edge

If the user is carefully selecting the zone edge, we do not filter the
zone preemptively from our disambiguation list in the same manner as we
do for selecting on zone copper.

Fixes: lp:1796719
* https://bugs.launchpad.net/kicad/+bug/1796719
This commit is contained in:
Seth Hillbrand 2018-10-08 06:27:41 -07:00
parent 3ee72031a4
commit f11cb736e5
2 changed files with 9 additions and 4 deletions

View File

@ -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 dont 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<BOARD_ITEM*> rejected;
std::set<BOARD_ITEM*> 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<ZONE_CONTAINER*>
( aCollector[i] )->HitTestForEdge( wxPoint( aWhere.x, aWhere.y ) ) )
{
aCollector.Remove( i );
}
}
}

View File

@ -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.