Ensure sheets are deterministically sorted

Even if a sheet exists at the same x/y coordinate as another, the sort
needs to ensure a deterministic ordering
This commit is contained in:
Seth Hillbrand 2021-08-20 08:31:01 -07:00
parent c80efb0f98
commit 09be1a8c78
1 changed files with 6 additions and 0 deletions

View File

@ -962,7 +962,13 @@ void SCH_SCREEN::GetSheets( std::vector<SCH_ITEM*>* aItems ) const
[]( EDA_ITEM* a, EDA_ITEM* b ) -> bool
{
if( a->GetPosition().x == b->GetPosition().x )
{
// Ensure deterministic sort
if( a->GetPosition().y == b->GetPosition().y )
return a->m_Uuid < b->m_Uuid;
return a->GetPosition().y < b->GetPosition().y;
}
else
return a->GetPosition().x < b->GetPosition().x;
} );