Repair Rotate on PCB_GENERATOR items.

This commit is contained in:
Jeff Young 2023-10-19 23:34:41 +01:00
parent c4a9703f81
commit 68a5753c80
2 changed files with 25 additions and 8 deletions

View File

@ -129,7 +129,23 @@ public:
m_end += aMoveVector;
}
const BOX2I GetBoundingBox() const override { return getRectShape().BBox(); }
void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override
{
RotatePoint( m_origin, aRotCentre, aAngle );
RotatePoint( m_end, aRotCentre, aAngle );
PCB_GROUP::Rotate( aRotCentre, aAngle );
if( m_baseLine )
m_baseLine->Rotate( aAngle, aRotCentre );
if( m_baseLineCoupled )
m_baseLineCoupled->Rotate( aAngle, aRotCentre );
}
const BOX2I GetBoundingBox() const override
{
return getRectShape().BBox();
}
void ViewGetLayers( int aLayers[], int& aCount ) const override
{

View File

@ -1756,12 +1756,13 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
commit->Modify( item );
// If rotating a group, record position of all the descendants for undo
if( item->Type() == PCB_GROUP_T )
if( item->Type() == PCB_GROUP_T || item->Type() == PCB_GENERATOR_T )
{
static_cast<PCB_GROUP*>( item )->RunOnDescendants( [&]( BOARD_ITEM* bItem )
{
commit->Modify( bItem );
});
static_cast<PCB_GROUP*>( item )->RunOnDescendants(
[&]( BOARD_ITEM* bItem )
{
commit->Modify( bItem );
});
}
}
@ -2042,7 +2043,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
{
commit->Modify( boardItem );
if( boardItem->Type() == PCB_GROUP_T )
if( boardItem->Type() == PCB_GROUP_T || boardItem->Type() == PCB_GENERATOR_T )
{
static_cast<PCB_GROUP*>( boardItem )->RunOnDescendants(
[&]( BOARD_ITEM* descendant )
@ -2387,7 +2388,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
{
commit.Modify( boardItem );
if( boardItem->Type() == PCB_GROUP_T )
if( boardItem->Type() == PCB_GROUP_T || boardItem->Type() == PCB_GENERATOR_T )
{
PCB_GROUP* group = static_cast<PCB_GROUP*>( boardItem );