Flip Start0 etc. when in ModEdit.

ModEdit and PCBNew use Start0/End0/etc. differently so care must
be taken when flipping.

Fixes: lp:1845402
* https://bugs.launchpad.net/kicad/+bug/1845402
This commit is contained in:
Jeff Young 2019-10-01 11:01:40 +01:00
parent 9339afcc26
commit b58df5e777
2 changed files with 16 additions and 11 deletions

View File

@ -283,7 +283,7 @@ EDA_ITEM* EDGE_MODULE::Clone() const
void EDGE_MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
{
wxPoint pt;
wxPoint pt( 0, 0 );
switch( GetShape() )
{
@ -293,16 +293,21 @@ void EDGE_MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
default:
case S_SEGMENT:
case S_CURVE:
// If Start0 and Start are equal (ie: ModEdit), then flip both sets around the
// centre point.
if( m_Start == m_Start0 )
pt = aCentre;
if( aFlipLeftRight )
{
MIRROR( m_Start.x, aCentre.x );
MIRROR( m_End.x, aCentre.x );
MIRROR( m_BezierC1.x, aCentre.x );
MIRROR( m_BezierC2.x, aCentre.x );
MIRROR( m_Start0.x, 0 );
MIRROR( m_End0.x, 0 );
MIRROR( m_Bezier0_C1.x, 0 );
MIRROR( m_Bezier0_C2.x, 0 );
MIRROR( m_Start0.x, pt.x );
MIRROR( m_End0.x, pt.x );
MIRROR( m_Bezier0_C1.x, pt.x );
MIRROR( m_Bezier0_C2.x, pt.x );
}
else
{
@ -310,10 +315,10 @@ void EDGE_MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
MIRROR( m_End.y, aCentre.y );
MIRROR( m_BezierC1.y, aCentre.y );
MIRROR( m_BezierC2.y, aCentre.y );
MIRROR( m_Start0.y, 0 );
MIRROR( m_End0.y, 0 );
MIRROR( m_Bezier0_C1.y, 0 );
MIRROR( m_Bezier0_C2.y, 0 );
MIRROR( m_Start0.y, pt.y );
MIRROR( m_End0.y, pt.y );
MIRROR( m_Bezier0_C1.y, pt.y );
MIRROR( m_Bezier0_C2.y, pt.y );
}
RebuildBezierToSegmentsPointsList( m_Width );

View File

@ -767,8 +767,8 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
updateModificationPoint( selection );
// Use the bounding box center as flip position
VECTOR2I modPoint = selection.GetCenter();
// Flip around the anchor for footprints, and the bounding box center for board items
VECTOR2I modPoint = EditingModules() ? VECTOR2I( 0, 0 ) : selection.GetCenter();
// If only one item selected, flip around the item anchor point, instead
// of the bounding box center, to avoid moving the item anchor