Correct logic errors in pin bounding box calculation.

The name and number are both centred, and either one can be long
enough to be the determining factor for either side of the bounding
box.
This commit is contained in:
Jeff Young 2023-05-31 12:51:56 +01:00
parent f9fd37c4ca
commit 47bba3cbeb
1 changed files with 6 additions and 2 deletions

View File

@ -1319,9 +1319,13 @@ const BOX2I LIB_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNa
// pin name is above pin line // pin name is above pin line
// pin number is below line // pin number is below line
begin.y = std::max( minsizeV, nameTextHeight + PIN_TEXT_OFFSET ); begin.y = std::max( minsizeV, nameTextHeight + PIN_TEXT_OFFSET );
begin.x = std::min( -typeTextLength, m_length - ( numberTextLength / 2) ); begin.x = -typeTextLength;
begin.x = std::min( begin.x, ( m_length - numberTextLength ) / 2 );
begin.x = std::min( begin.x, ( m_length - nameTextLength ) / 2 );
end.x = std::max( m_length, nameTextLength ); end.x = m_length;
end.x = std::max( end.x, ( m_length + nameTextLength ) / 2 );
end.x = std::max( end.x, ( m_length + numberTextLength ) / 2 );
end.y = std::min( -minsizeV, -numberTextHeight - PIN_TEXT_OFFSET ); end.y = std::min( -minsizeV, -numberTextHeight - PIN_TEXT_OFFSET );
} }