Soften hit-testing in SchEdit and LibEdit a bit.

Old threshold was 0; new is 5 pixels.
This commit is contained in:
Jeff Young 2019-05-10 20:28:16 +01:00
parent 0c2ba94b16
commit a9f663d5ef
3 changed files with 9 additions and 2 deletions

View File

@ -108,7 +108,7 @@ SEARCH_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
return SEARCH_CONTINUE;
}
if( aItem->HitTest( m_RefPos ) )
if( aItem->HitTest( m_RefPos, m_Threshold ) )
Append( aItem );
return SEARCH_CONTINUE;
@ -463,7 +463,7 @@ SEARCH_RESULT EE_TYPE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* testData )
}
void EE_TYPE_COLLECTOR::Collect( SCH_ITEM* aItem, const KICAD_T aFilterList[] )
void EE_TYPE_COLLECTOR::Collect( EDA_ITEM* aItem, const KICAD_T aFilterList[] )
{
Empty(); // empty the collection

View File

@ -46,6 +46,7 @@ public:
static const KICAD_T SheetsAndSheetLabels[];
EE_COLLECTOR( const KICAD_T* aScanTypes = EE_COLLECTOR::AllItems ) :
m_Threshold( 0 ),
m_MenuCancelled( false )
{
SetScanTypes( aScanTypes );
@ -107,6 +108,8 @@ public:
int m_Unit; // Fixed symbol unit filter (for symbol editor)
int m_Convert; // Fixed DeMorgan filter (for symbol editor)
int m_Threshold; // Hit-test threshold in internal units.
wxString m_MenuTitle; // The title of selection disambiguation menu (if needed)
bool m_MenuCancelled; // Indicates selection disambiguation menu was cancelled
};

View File

@ -149,6 +149,9 @@ SELECTION_CONDITION EE_CONDITIONS::SingleMultiUnitSymbol = [] ( const SELECTION&
};
#define HITTEST_THRESHOLD_PIXELS 5
EE_SELECTION_TOOL::EE_SELECTION_TOOL() :
TOOL_INTERACTIVE( "eeschema.InteractiveSelection" ),
m_frame( nullptr ),
@ -425,6 +428,7 @@ EDA_ITEM* EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T*
if( !start )
return nullptr;
collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
collector.Collect( start, aFilterList, (wxPoint) aWhere, m_unit, m_convert );
bool anyCollected = collector.GetCount() != 0;