mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Pcbnew, Flip rectangle shape: Keep its anchor position after flipping.
Previously, it was flipped using the shape anchor position. But for this shape, the anchor (top left corner)) is reinitialized after flipping, so flipping twice moves the shape. Now the rectangle center is used as reference position to flip the shape Fixes https://gitlab.com/kicad/code/kicad/-/issues/18797
This commit is contained in:
parent
164ff0b870
commit
50d5c6a437
@ -2270,8 +2270,21 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
|
||||
|
||||
// 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
|
||||
// but only if the item is not a PCB_SHAPE with SHAPE_T::RECTANGLE shape, because
|
||||
// for this shape the flip transform swap start and end coordinates and move the shape.
|
||||
// So using the center of the shape is better (the shape does not move)
|
||||
if( selection.GetSize() == 1 )
|
||||
refPt = selection.GetReferencePoint();
|
||||
{
|
||||
EDA_ITEM* item = static_cast<EDA_ITEM*>( selection.GetItem( 0 ) );
|
||||
|
||||
if( item->IsBOARD_ITEM() )
|
||||
{
|
||||
EDA_SHAPE* boardItem = dynamic_cast<EDA_SHAPE*>( item );
|
||||
|
||||
if( !boardItem || boardItem->GetShape() != SHAPE_T::RECTANGLE )
|
||||
refPt = selection.GetReferencePoint();
|
||||
}
|
||||
}
|
||||
|
||||
const FLIP_DIRECTION flipDirection = frame()->GetPcbNewSettings()->m_FlipDirection;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user