Make sure rectangles are "right-side-up".

Fixes https://gitlab.com/kicad/code/kicad/issues/6023
This commit is contained in:
Jeff Young 2020-10-17 14:46:45 +01:00
parent a981ffe8c7
commit 4355e91a41
1 changed files with 6 additions and 2 deletions

View File

@ -369,8 +369,12 @@ void D_PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
&& corners.CPoint( 2 ).y == corners.CPoint( 3 ).y
&& corners.CPoint( 4 ).x == corners.CPoint( 0 ).x )
{
VECTOR2I size = corners.CPoint( 2 ) - corners.CPoint( 0 );
add( new SHAPE_RECT( corners.CPoint( 0 ), size.x, size.y ) );
int width = std::abs( corners.CPoint( 2 ).x - corners.CPoint( 0 ).x );
int height = std::abs( corners.CPoint( 2 ).y - corners.CPoint( 0 ).y );
VECTOR2I pos( std::min( corners.CPoint( 2 ).x, corners.CPoint( 0 ).x ),
std::min( corners.CPoint( 2 ).y, corners.CPoint( 0 ).y ) );
add( new SHAPE_RECT( pos, width, height ) );
}
else
{