Expand autoplace collision search to include potential field locations

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9762
This commit is contained in:
Jon Evans 2021-11-25 07:47:53 -05:00
parent bba00fa74c
commit 9f6910f1e6
1 changed files with 19 additions and 10 deletions

View File

@ -275,7 +275,15 @@ protected:
{
wxCHECK_RET( m_screen, "getPossibleCollisions() with null m_screen" );
for( SCH_ITEM* item : m_screen->Items().Overlapping( m_symbol->GetBodyAndPinsBoundingBox() ) )
EDA_RECT symbolBox = m_symbol->GetBodyAndPinsBoundingBox();
std::vector<SIDE_AND_NPINS> sides = getPreferredSides();
for( SIDE_AND_NPINS& side : sides )
{
EDA_RECT box( fieldBoxPlacement( side ), m_fbox_size );
box.Merge( symbolBox );
for( SCH_ITEM* item : m_screen->Items().Overlapping( box ) )
{
if( SCH_SYMBOL* candidate = dynamic_cast<SCH_SYMBOL*>( item ) )
{
@ -292,6 +300,7 @@ protected:
aItems.push_back( item );
}
}
}
/**
* Filter a list of possible colliders to include only those that actually collide