Footprint editor: fix broken mirroring of custom pad shapes.

Fixes #8649
https://gitlab.com/kicad/code/kicad/issues/8649
This commit is contained in:
jean-pierre charras 2021-06-23 16:30:47 +02:00
parent b3c1e0330a
commit c9cc824761
4 changed files with 8 additions and 9 deletions

View File

@ -377,7 +377,7 @@ public:
wxString oldPath = aConfig->GetPath(); wxString oldPath = aConfig->GetPath();
NETCLASSES::const_iterator nc = m_Pt_param->begin(); NETCLASSES::const_iterator nc = m_Pt_param->begin();
for( int index = 0; index <= m_Pt_param->GetCount(); ++index ) for( size_t index = 0; index <= m_Pt_param->GetCount(); ++index )
{ {
wxString path = ""; wxString path = "";
NETCLASSPTR netclass; NETCLASSPTR netclass;

View File

@ -481,15 +481,15 @@ void D_PAD::FlipPrimitives()
} }
void D_PAD::MirrorXPrimitives( int aX ) void D_PAD::MirrorXPrimitives()
{ {
// Mirror custom shapes // Mirror custom shapes
for( unsigned ii = 0; ii < m_basicShapes.size(); ++ii ) for( unsigned ii = 0; ii < m_basicShapes.size(); ++ii )
{ {
PAD_CS_PRIMITIVE& primitive = m_basicShapes[ii]; PAD_CS_PRIMITIVE& primitive = m_basicShapes[ii];
MIRROR( primitive.m_Start.x, aX ); MIRROR( primitive.m_Start.x, 0 );
MIRROR( primitive.m_End.x, aX ); MIRROR( primitive.m_End.x, 0 );
primitive.m_ArcAngle = -primitive.m_ArcAngle; primitive.m_ArcAngle = -primitive.m_ArcAngle;
switch( primitive.m_Shape ) switch( primitive.m_Shape )

View File

@ -336,11 +336,10 @@ public:
void FlipPrimitives(); void FlipPrimitives();
/** /**
* Mirror the primitives about a coordinate * Mirror the primitives around the vertical axis. Primitive coordinates are
* * relative to the pad, and are not absolute
* @param aX the x coordinate about which to mirror
*/ */
void MirrorXPrimitives( int aX ); void MirrorXPrimitives();
/** /**
* Import to the basic shape list * Import to the basic shape list

View File

@ -761,7 +761,7 @@ static void mirrorPadX( D_PAD& aPad, const wxPoint& aMirrorPoint )
wxPoint tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint ); wxPoint tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint );
if( aPad.GetShape() == PAD_SHAPE_CUSTOM ) if( aPad.GetShape() == PAD_SHAPE_CUSTOM )
aPad.MirrorXPrimitives( tmpPt.x ); aPad.MirrorXPrimitives();
aPad.SetPosition( tmpPt ); aPad.SetPosition( tmpPt );