Expand autoplace collision search to include potential field locations
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9762
This commit is contained in:
parent
bba00fa74c
commit
9f6910f1e6
|
@ -275,21 +275,30 @@ protected:
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_screen, "getPossibleCollisions() with null m_screen" );
|
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 )
|
||||||
{
|
{
|
||||||
if( SCH_SYMBOL* candidate = dynamic_cast<SCH_SYMBOL*>( item ) )
|
EDA_RECT box( fieldBoxPlacement( side ), m_fbox_size );
|
||||||
|
box.Merge( symbolBox );
|
||||||
|
|
||||||
|
for( SCH_ITEM* item : m_screen->Items().Overlapping( box ) )
|
||||||
{
|
{
|
||||||
if( candidate == m_symbol )
|
if( SCH_SYMBOL* candidate = dynamic_cast<SCH_SYMBOL*>( item ) )
|
||||||
continue;
|
{
|
||||||
|
if( candidate == m_symbol )
|
||||||
|
continue;
|
||||||
|
|
||||||
std::vector<SCH_FIELD*> fields;
|
std::vector<SCH_FIELD*> fields;
|
||||||
candidate->GetFields( fields, /* aVisibleOnly */ true );
|
candidate->GetFields( fields, /* aVisibleOnly */ true );
|
||||||
|
|
||||||
for( SCH_FIELD* field : fields )
|
for( SCH_FIELD* field : fields )
|
||||||
aItems.push_back( field );
|
aItems.push_back( field );
|
||||||
|
}
|
||||||
|
|
||||||
|
aItems.push_back( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
aItems.push_back( item );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue