diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index b0c0ee0cd1..004c6612da 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -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( 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( 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( aItem )->RunOnChildren( + [&]( BOARD_ITEM* child ) + { + COMMIT::Stage( child, aChangeType ); + } ); } }