Bug fixes for paste margins on custom-shaped pads.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15125
This commit is contained in:
Jeff Young 2023-09-03 20:43:20 +01:00
parent c2057ba1bc
commit 60419f542a
2 changed files with 17 additions and 5 deletions

View File

@ -1322,7 +1322,7 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
if( m_previewPad->GetShape() == PAD_SHAPE::CUSTOM ) if( m_previewPad->GetShape() == PAD_SHAPE::CUSTOM )
{ {
// allow 0-sized anchor pads pad_size = m_previewPad->GetBoundingBox().GetSize();
} }
else if( m_previewPad->GetShape() == PAD_SHAPE::CIRCLE ) else if( m_previewPad->GetShape() == PAD_SHAPE::CIRCLE )
{ {

View File

@ -922,11 +922,14 @@ VECTOR2I PAD::GetSolderPasteMargin() const
pad_margin.y = margin + KiROUND( m_size.y * mratio ); pad_margin.y = margin + KiROUND( m_size.y * mratio );
// ensure mask have a size always >= 0 // ensure mask have a size always >= 0
if( pad_margin.x < -m_size.x / 2 ) if( m_padShape != PAD_SHAPE::CUSTOM )
pad_margin.x = -m_size.x / 2; {
if( pad_margin.x < -m_size.x / 2 )
pad_margin.x = -m_size.x / 2;
if( pad_margin.y < -m_size.y / 2 ) if( pad_margin.y < -m_size.y / 2 )
pad_margin.y = -m_size.y / 2; pad_margin.y = -m_size.y / 2;
}
return pad_margin; return pad_margin;
} }
@ -1652,6 +1655,15 @@ void PAD::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
outline.Inflate( aClearance, SHAPE_POLY_SET::ROUND_ALL_CORNERS, aMaxError ); outline.Inflate( aClearance, SHAPE_POLY_SET::ROUND_ALL_CORNERS, aMaxError );
outline.Fracture( SHAPE_POLY_SET::PM_FAST ); outline.Fracture( SHAPE_POLY_SET::PM_FAST );
} }
else if( aClearance < 0 )
{
// Negative clearances are primarily for drawing solder paste layer, so we don't
// worry ourselves overly about which side the error is on.
// aClearance is negative so this is actually a deflate
outline.Inflate( aClearance, SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS, aMaxError );
outline.Fracture( SHAPE_POLY_SET::PM_FAST );
}
aBuffer.Append( outline ); aBuffer.Append( outline );
break; break;