Manual cherry-pick of ba630971af.

This commit is contained in:
Jeff Young 2022-10-19 13:31:16 +01:00
parent 1bf1620157
commit f6bdd40c30
1 changed files with 9 additions and 9 deletions

View File

@ -1111,6 +1111,15 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference, bool aRe
// Discard reference point when selection is "dropped" onto the board
selection.ClearReferencePoint();
// Unselect all items to clear selection flags and then re-select the originally selected
// items.
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
// In the case where the original items are temporary, we don't want to reselect
// as the items may be invalidated by the Revert above
if( !restore_state || aReselect )
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &orig_items );
// TODO: there's an encapsulation leak here: this commit often has more than just the move
// in it; for instance it might have a paste, append board, etc. as well.
if( restore_state )
@ -1121,15 +1130,6 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference, bool aRe
// Remove the dynamic ratsnest from the screen
m_toolMgr->RunAction( PCB_ACTIONS::hideDynamicRatsnest, true );
// Unselect all items to clear selection flags and then re-select the originally selected
// items.
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
// In the case where the original items are temporary, we don't want to reselect
// as the items may be invalidated by the Revert above
if( !restore_state || aReselect )
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &orig_items );
editFrame->PopTool( tool );
editFrame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );