Eeschema: Simplify GetItem
Avoids calling HitTest on each item when it is not needed
This commit is contained in:
parent
8bb9084ea9
commit
62fe78f08c
|
@ -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() )
|
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) )
|
if( (aType == SCH_FIELD_T) && (item->Type() == SCH_COMPONENT_T) )
|
||||||
{
|
{
|
||||||
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
||||||
|
@ -239,7 +236,8 @@ SCH_ITEM* SCH_SCREEN::GetItem( const wxPoint& aPosition, int aAccuracy, KICAD_T
|
||||||
if( label )
|
if( label )
|
||||||
return (SCH_ITEM*) 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;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue