Browse Source

Eeschema: Simplify GetItem

Avoids calling HitTest on each item when it is not needed
pull/5/merge
Seth Hillbrand 8 years ago
parent
commit
62fe78f08c
  1. 6
      eeschema/sch_screen.cpp

6
eeschema/sch_screen.cpp

@ -215,9 +215,6 @@ SCH_ITEM* SCH_SCREEN::GetItem( const wxPoint& aPosition, int aAccuracy, KICAD_T
{
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
if( item->HitTest( aPosition, aAccuracy ) && (aType == NOT_USED) )
return item;
if( (aType == SCH_FIELD_T) && (item->Type() == SCH_COMPONENT_T) )
{
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
@ -239,7 +236,8 @@ SCH_ITEM* SCH_SCREEN::GetItem( const wxPoint& aPosition, int aAccuracy, KICAD_T
if( label )
return (SCH_ITEM*) label;
}
else if( (item->Type() == aType) && item->HitTest( aPosition, aAccuracy ) )
else if( ( ( item->Type() == aType ) || ( aType == NOT_USED ) )
&& item->HitTest( aPosition, aAccuracy ) )
{
return item;
}

Loading…
Cancel
Save