Footprint editor: fix some issues in flip and mirror commands.
more about fixes #4958 https://gitlab.com/kicad/code/kicad/issues/4958
This commit is contained in:
parent
bf445c1a95
commit
6f7d5f5e2b
|
@ -497,26 +497,17 @@ void D_PAD::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
SetLayerSet( FlipLayerMask( m_layerMask ) );
|
||||
|
||||
// Flip the basic shapes, in custom pads
|
||||
FlipPrimitives();
|
||||
FlipPrimitives( aFlipLeftRight );
|
||||
|
||||
m_shapesDirty = true;
|
||||
}
|
||||
|
||||
|
||||
// Flip the basic shapes, in custom pads
|
||||
void D_PAD::FlipPrimitives()
|
||||
// Flip (mirror) the basic shapes (primitives), in custom pads
|
||||
void D_PAD::FlipPrimitives( bool aFlipLeftRight )
|
||||
{
|
||||
for( std::shared_ptr<DRAWSEGMENT>& primitive : m_editPrimitives )
|
||||
primitive->Flip( wxPoint( 0, 0 ), false );
|
||||
|
||||
m_shapesDirty = true;
|
||||
}
|
||||
|
||||
|
||||
void D_PAD::MirrorXPrimitives( int aX )
|
||||
{
|
||||
for( std::shared_ptr<DRAWSEGMENT>& primitive : m_editPrimitives )
|
||||
primitive->Flip( wxPoint( aX, 0 ), true );
|
||||
primitive->Flip( wxPoint( 0, 0 ), aFlipLeftRight );
|
||||
|
||||
m_shapesDirty = true;
|
||||
}
|
||||
|
|
|
@ -277,14 +277,10 @@ public:
|
|||
void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
|
||||
|
||||
/**
|
||||
* Flip the basic shapes, in custom pads
|
||||
* Flip (mirror) the primitives left to right or top to bottom, around the anchor position
|
||||
* in custom pads
|
||||
*/
|
||||
void FlipPrimitives();
|
||||
|
||||
/**
|
||||
* Mirror the primitives about a coordinate
|
||||
*/
|
||||
void MirrorXPrimitives( int aX );
|
||||
void FlipPrimitives( bool aFlipLeftRight );
|
||||
|
||||
/**
|
||||
* Clear the current primitive list and import a basic shape (primitive) list.
|
||||
|
|
|
@ -487,8 +487,8 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
// flip pad's layers
|
||||
m_dummyPad->SetLayerSet( FlipLayerMask( m_dummyPad->GetLayerSet() ) );
|
||||
|
||||
// flip custom pad shapes
|
||||
m_dummyPad->FlipPrimitives();
|
||||
// flip custom pad shapes (up/down)
|
||||
m_dummyPad->FlipPrimitives( false );
|
||||
}
|
||||
|
||||
m_primitives = m_dummyPad->GetPrimitives();
|
||||
|
@ -1376,7 +1376,8 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
|
|||
if( m_isFlipped )
|
||||
{
|
||||
m_currentPad->SetLayerSet( FlipLayerMask( m_currentPad->GetLayerSet() ) );
|
||||
m_currentPad->FlipPrimitives();
|
||||
// flip custom pad shapes (up/down)
|
||||
m_dummyPad->FlipPrimitives( false );
|
||||
}
|
||||
|
||||
m_currentPad->SetLayerSet( m_padMaster->GetLayerSet() );
|
||||
|
|
|
@ -753,15 +753,14 @@ static wxPoint mirrorPointX( const wxPoint& aPoint, const wxPoint& aMirrorPoint
|
|||
|
||||
|
||||
/**
|
||||
* Mirror a pad in the vertical axis passing through a point
|
||||
* Mirror a pad in the vertical axis passing through a point (mirror left to right)
|
||||
*/
|
||||
static void mirrorPadX( D_PAD& aPad, const wxPoint& aMirrorPoint )
|
||||
{
|
||||
wxPoint tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint );
|
||||
|
||||
if( aPad.GetShape() == PAD_SHAPE_CUSTOM )
|
||||
aPad.MirrorXPrimitives( tmpPt.x );
|
||||
aPad.FlipPrimitives( true ); // mirror primitives left to right
|
||||
|
||||
wxPoint tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint );
|
||||
aPad.SetPosition( tmpPt );
|
||||
|
||||
aPad.SetX0( aPad.GetPosition().x );
|
||||
|
|
Loading…
Reference in New Issue