diff --git a/eeschema/ee_collectors.cpp b/eeschema/ee_collectors.cpp index d50e9f3857..9c3f5fc331 100644 --- a/eeschema/ee_collectors.cpp +++ b/eeschema/ee_collectors.cpp @@ -152,9 +152,11 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co bool sheetsVisited = false; bool globalLabelsVisited = false; - for( const KICAD_T* filter = aFilterList; *filter != EOT; ++filter ) + EE_RTREE& items = aScreen->Items(); + + for( const KICAD_T *filter = aFilterList; *filter != EOT; ++filter ) { - for( SCH_ITEM* item : aScreen->Items().OfType( *filter ) ) + for( SCH_ITEM *item : items.Overlapping( *filter, aPos, m_Threshold ) ) { if( *filter == SCH_SYMBOL_T || *filter == SCH_LOCATE_ANY_T ) symbolsVisited = true; @@ -171,19 +173,19 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co if( !symbolsVisited ) { - for( SCH_ITEM* item : aScreen->Items().OfType( SCH_SYMBOL_T ) ) + for( SCH_ITEM *item : items.Overlapping( SCH_SYMBOL_T, aPos, m_Threshold ) ) item->Visit( m_inspector, nullptr, m_scanTypes ); } if( !sheetsVisited ) { - for( SCH_ITEM* item : aScreen->Items().OfType( SCH_SHEET_T ) ) + for( SCH_ITEM *item : items.Overlapping( SCH_SHEET_T, aPos, m_Threshold ) ) item->Visit( m_inspector, nullptr, m_scanTypes ); } if( !globalLabelsVisited ) { - for( SCH_ITEM* item : aScreen->Items().OfType( SCH_GLOBAL_LABEL_T ) ) + for( SCH_ITEM *item : items.Overlapping( SCH_GLOBAL_LABEL_T, aPos, m_Threshold ) ) item->Visit( m_inspector, nullptr, m_scanTypes ); } }