Pcbnew: flip command: when flipping only one item, flip it around its anchor instead of its bounding box.

This is the behavior of previous 5.1 version.
Using the bounding box has advantages, but unfortunately in many cases the footprint position is moved.
If a lot of flip commands are made on the same footprint, it is moved far from its initial position.
This commit is contained in:
jean-pierre charras 2019-09-17 10:06:39 +02:00
parent c6889b0065
commit 072ea9a33e
1 changed files with 8 additions and 0 deletions

View File

@ -766,7 +766,15 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
return 0;
updateModificationPoint( selection );
// Use the bounding box center as flip position
VECTOR2I modPoint = 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
if( selection.GetSize() == 1 )
modPoint = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) )->GetPosition();
bool leftRight = frame()->Settings().m_FlipLeftRight;
// When editing modules, all items have the same parent