D_PAD::BuildEffectiveShapes(): fix incorrect rect shape size for rect pads

rotated by +-90 deg
Noticeable in PnS router.

Fixes #4771
https://gitlab.com/kicad/code/kicad/issues/4771
This commit is contained in:
jean-pierre charras 2020-07-01 15:27:20 +02:00
parent 7b042f4a75
commit 3993181de5
2 changed files with 8 additions and 2 deletions

View File

@ -63,7 +63,7 @@ void ZOOM_MENU::update()
const std::vector<double>& zoomList = m_parent->config()->m_Window.zoom_factors; const std::vector<double>& zoomList = m_parent->config()->m_Window.zoom_factors;
for( int i = 0; i < zoomList.size(); ++i ) for( size_t i = 0; i < zoomList.size(); ++i )
{ {
// Search for a value near the current zoom setting: // Search for a value near the current zoom setting:
double rel_error = std::fabs( zoomList[i] - zoom ) / zoom; double rel_error = std::fabs( zoomList[i] - zoom ) / zoom;

View File

@ -253,11 +253,17 @@ void D_PAD::BuildEffectiveShapes() const
break; break;
case PAD_SHAPE_RECT: case PAD_SHAPE_RECT:
if( (int) m_Orient % 900 == 0 ) if( m_Orient == 0 || m_Orient == 1800 )
{ {
add( new SHAPE_RECT( shapePos - m_Size / 2, m_Size.x, m_Size.y ) ); add( new SHAPE_RECT( shapePos - m_Size / 2, m_Size.x, m_Size.y ) );
break; break;
} }
else if( m_Orient == 900 || m_Orient == -900 )
{
wxSize rot_size( m_Size.y, m_Size.x );
add( new SHAPE_RECT( shapePos - rot_size / 2, rot_size.x, rot_size.y ) );
break;
}
// Not at a cartesian angle; fall through to general case // Not at a cartesian angle; fall through to general case
KI_FALLTHROUGH; KI_FALLTHROUGH;