Better-encapsulate collector sources in the selection tool.
Fixes https://gitlab.com/kicad/code/kicad/issues/7191
This commit is contained in:
parent
ef2aa8a730
commit
351074cc48
|
@ -343,7 +343,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
bool continueSelect = true;
|
bool continueSelect = true;
|
||||||
|
|
||||||
// Collect items at the clicked location (doesn't select them yet)
|
// Collect items at the clicked location (doesn't select them yet)
|
||||||
if( collectHits( collector, evt->Position() ) )
|
if( CollectHits( collector, evt->Position()) )
|
||||||
{
|
{
|
||||||
narrowSelection( collector, evt->Position(), false );
|
narrowSelection( collector, evt->Position(), false );
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
// We are checking if we should display a pencil when hovering over anchors
|
// We are checking if we should display a pencil when hovering over anchors
|
||||||
// for "auto starting" wires when clicked
|
// for "auto starting" wires when clicked
|
||||||
if( collectHits( collector, evt->Position() ) )
|
if( CollectHits( collector, evt->Position()) )
|
||||||
{
|
{
|
||||||
narrowSelection( collector, evt->Position(), false );
|
narrowSelection( collector, evt->Position(), false );
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@ EE_SELECTION& EE_SELECTION_TOOL::GetSelection()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EE_SELECTION_TOOL::collectHits( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere,
|
bool EE_SELECTION_TOOL::CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere,
|
||||||
const KICAD_T* aFilterList )
|
const KICAD_T* aFilterList )
|
||||||
{
|
{
|
||||||
aCollector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
|
aCollector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
|
||||||
|
@ -770,7 +770,7 @@ bool EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T* aFil
|
||||||
{
|
{
|
||||||
EE_COLLECTOR collector;
|
EE_COLLECTOR collector;
|
||||||
|
|
||||||
if( !collectHits( collector, aWhere, aFilterList ) )
|
if( !CollectHits( collector, aWhere, aFilterList ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
narrowSelection( collector, aWhere, aCheckLocked );
|
narrowSelection( collector, aWhere, aCheckLocked );
|
||||||
|
|
|
@ -170,7 +170,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void RebuildSelection();
|
void RebuildSelection();
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
/**
|
||||||
* Function CollectHits()
|
* Function CollectHits()
|
||||||
* Selects one or more items at the location given by parameter aWhere.
|
* Selects one or more items at the location given by parameter aWhere.
|
||||||
|
@ -182,9 +181,10 @@ private:
|
||||||
* @param aFilterList is a list of items that are acceptable for collection
|
* @param aFilterList is a list of items that are acceptable for collection
|
||||||
* @param aCheckLocked indicates if locked items should be excluded.
|
* @param aCheckLocked indicates if locked items should be excluded.
|
||||||
*/
|
*/
|
||||||
bool collectHits( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere,
|
bool CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere,
|
||||||
const KICAD_T* aFilterList = EE_COLLECTOR::AllItems );
|
const KICAD_T* aFilterList = EE_COLLECTOR::AllItems );
|
||||||
|
|
||||||
|
private:
|
||||||
/**
|
/**
|
||||||
* Applies rules to narrow the collection down to selectable objects, and then heuristics
|
* Applies rules to narrow the collection down to selectable objects, and then heuristics
|
||||||
* to try and narrow it to a single object.
|
* to try and narrow it to a single object.
|
||||||
|
|
|
@ -354,9 +354,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||||
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||||
EE_COLLECTOR collector;
|
EE_COLLECTOR collector;
|
||||||
|
|
||||||
collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
|
selectionTool->CollectHits( collector, aPos, nonFields );
|
||||||
collector.Collect( m_frame->GetScreen(), nonFields, (wxPoint) aPos,
|
|
||||||
m_frame->GetUnit(), m_frame->GetConvert() );
|
|
||||||
|
|
||||||
// Remove unselectable items
|
// Remove unselectable items
|
||||||
for( int i = collector.GetCount() - 1; i >= 0; --i )
|
for( int i = collector.GetCount() - 1; i >= 0; --i )
|
||||||
|
|
Loading…
Reference in New Issue