Fix arc flipping behaviour.

Also fixes flipping of a dragged selection to be around the anchor
point.

Fixes https://gitlab.com/kicad/code/kicad/issues/6217
This commit is contained in:
Jeff Young 2020-11-01 15:25:42 +00:00
parent 042e5956c2
commit 4e5dd6952e
2 changed files with 18 additions and 4 deletions

View File

@ -4,7 +4,7 @@
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -165,6 +165,10 @@ void PCB_SHAPE::Scale( double aScale )
scalePt( m_BezierC2 ); scalePt( m_BezierC2 );
break; break;
case S_ARC:
scalePt( m_ThirdPoint );
break;
case S_CIRCLE: // ring or circle case S_CIRCLE: // ring or circle
m_End.x = m_Start.x + KiROUND( radius * aScale ); m_End.x = m_Start.x + KiROUND( radius * aScale );
m_End.y = m_Start.y; m_End.y = m_Start.y;
@ -261,6 +265,11 @@ void PCB_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
switch ( m_Shape ) switch ( m_Shape )
{ {
case S_ARC: case S_ARC:
if( aFlipLeftRight )
m_ThirdPoint.x = aCentre.x - ( m_ThirdPoint.x - aCentre.x );
else
m_ThirdPoint.y = aCentre.y - ( m_ThirdPoint.y - aCentre.y );
m_Angle = -m_Angle; m_Angle = -m_Angle;
break; break;

View File

@ -1158,10 +1158,15 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
// Flip around the anchor for footprints, and the bounding box center for board items // Flip around the anchor for footprints, and the bounding box center for board items
VECTOR2I modPoint = EditingModules() ? VECTOR2I( 0, 0 ) : selection.GetCenter(); VECTOR2I modPoint = EditingModules() ? VECTOR2I( 0, 0 ) : selection.GetCenter();
// If only one item selected, flip around the item anchor point, instead // If only one item selected, flip around the selection or item anchor point (instead
// of the bounding box center, to avoid moving the item anchor // of the bounding box center) to avoid moving the item anchor
if( selection.GetSize() == 1 ) if( selection.GetSize() == 1 )
modPoint = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) )->GetPosition(); {
if( selection.HasReferencePoint() )
modPoint = selection.GetReferencePoint();
else
modPoint = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) )->GetPosition();
}
bool leftRight = frame()->Settings().m_FlipLeftRight; bool leftRight = frame()->Settings().m_FlipLeftRight;