Stage group children when staging group.

Many operations such as move, rotate, etc. are applied directly to the
group's children, so it's the children that need staging.

Fixes https://gitlab.com/kicad/code/kicad/issues/13999
This commit is contained in:
Jeff Young 2023-02-28 14:19:48 +00:00
parent 7256a51e8e
commit 0ff8ba1d8c
1 changed files with 25 additions and 3 deletions

View File

@ -91,10 +91,32 @@ COMMIT& BOARD_COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType )
child->SetFlags( IS_MODIFIED_CHILD );
} );
}
else if( FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( aItem->GetParent() ) )
else if( aItem->GetParent() && aItem->GetParent()->Type() == PCB_FOOTPRINT_T )
{
aItem->SetFlags( IS_MODIFIED_CHILD );
aItem = fp;
if( aItem->Type() == PCB_GROUP_T )
{
static_cast<PCB_GROUP*>( aItem )->RunOnChildren(
[&]( BOARD_ITEM* child )
{
child->SetFlags( IS_MODIFIED_CHILD );
} );
}
else
{
aItem->SetFlags( IS_MODIFIED_CHILD );
}
aItem = aItem->GetParent();
}
else if( aItem->Type() == PCB_GROUP_T )
{
// Many operations on group (move, rotate, etc.) are applied directly to their
// children, so it's the children that must be staged.
static_cast<PCB_GROUP*>( aItem )->RunOnChildren(
[&]( BOARD_ITEM* child )
{
COMMIT::Stage( child, aChangeType );
} );
}
}