diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index beac915dec..01406558ee 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -457,7 +457,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) } else if( dimension ) { - // Dimensions feels particularly hard to select, probably due to their + // Dimensions feel particularly hard to select, probably due to their // noisy shape making it feel like they should have a larger bounary. if( dimension->HitTest( m_refPos, KiROUND( accuracy * 1.5 ) ) ) { @@ -467,7 +467,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) } else { - if( item->HitTest( m_refPos, 0 ) ) + if( item->HitTest( m_refPos, accuracy ) ) { Append( item ); goto exit; diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index 5535cba3eb..6da17572ca 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -426,7 +426,7 @@ public: m_preferredLayer = aPreferredLayer; m_ignorePreferredLayer = false; - m_visibleLayers = aVisibleLayerMask; + m_visibleLayers = aVisibleLayerMask; m_ignoreLockedLayers = true; m_ignoreNonVisibleLayers = true; m_ignoreLockedItems = false; @@ -437,18 +437,18 @@ public: m_includeSecondary = true; #endif - m_ignoreHiddenFPText = true; // g_ModuleTextNOVColor; + m_ignoreHiddenFPText = true; // g_ModuleTextNOVColor; m_ignoreFPTextOnBack = true; m_ignoreFPTextOnFront = false; - m_ignoreFootprintsOnBack = true; // !Show_footprints_Cmp; - m_ignoreFootprintsOnFront = false; + m_ignoreFootprintsOnBack = true; // !Show_footprints_Cmp; + m_ignoreFootprintsOnFront = false; m_ignorePadsOnFront = false; m_ignorePadsOnBack = false; m_ignoreThroughHolePads = false; - m_ignoreFPValues = false; - m_ignoreFPReferences = false; + m_ignoreFPValues = false; + m_ignoreFPReferences = false; m_ignoreThroughVias = false; m_ignoreBlindBuriedVias = false; @@ -601,6 +601,7 @@ public: void SetIgnoreZoneFills( bool ignore ) { m_ignoreZoneFills = ignore; } double OnePixelInIU() const override { return m_onePixelInIU; } + void SetOnePixelInIU( double aValue ) { m_onePixelInIU = aValue; } }; diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index a968713c45..82bd411340 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -2234,12 +2234,14 @@ void PCB_SELECTION_TOOL::unhighlightInternal( BOARD_ITEM* aItem, int aMode, bool bool PCB_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const { - const unsigned GRIP_MARGIN = 20; - VECTOR2I margin = getView()->ToWorld( VECTOR2I( GRIP_MARGIN, GRIP_MARGIN ), false ); - GENERAL_COLLECTORS_GUIDE guide = getCollectorsGuide(); GENERAL_COLLECTOR collector; + // Since we're just double-checking, we want something considerably sloppier than the initial + // selection (most tools use a 5 pixel slop value). We increase this to an effective 20 pixels + // by inflating the value of a pixel by 4x. + guide.SetOnePixelInIU( guide.OnePixelInIU() * 4 ); + collector.Collect( board(), m_isFootprintEditor ? GENERAL_COLLECTOR::FootprintItems : GENERAL_COLLECTOR::AllBoardItems, (wxPoint) aPoint, guide ); @@ -2248,7 +2250,7 @@ bool PCB_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const { BOARD_ITEM* item = collector[i]; - if( item->IsSelected() && item->HitTest( (wxPoint) aPoint, margin.x ) ) + if( item->IsSelected() && item->HitTest( (wxPoint) aPoint, 5 * guide.OnePixelInIU() ) ) return true; }