Browse Source

Use IsType() for selection testing

Straight Type() comparison breaks for the TYPE_LOCATE values
7.0
Seth Hillbrand 3 years ago
parent
commit
7b1702b5fb
  1. 17
      common/tool/selection.cpp

17
common/tool/selection.cpp

@ -135,7 +135,7 @@ bool SELECTION::HasType( KICAD_T aType ) const
{
for( const EDA_ITEM* item : m_items )
{
if( item->Type() == aType )
if( item->IsType( { aType } ) )
return true;
}
@ -149,7 +149,7 @@ size_t SELECTION::CountType( KICAD_T aType ) const
for( const EDA_ITEM* item : m_items )
{
if( item->Type() == aType )
if( item->IsType( { aType } ) )
count++;
}
@ -183,18 +183,7 @@ bool SELECTION::OnlyContains( std::vector<KICAD_T> aList ) const
return ( std::all_of( m_items.begin(), m_items.end(),
[&]( const EDA_ITEM* r )
{
bool ok = false;
for( const KICAD_T& type : aList )
{
if( r->Type() == type )
{
ok = true;
break;
}
}
return ok;
return r->IsType( aList );
} ) );
}

Loading…
Cancel
Save