Cancel preceeding command if Move was called to place it.
Fixes https://gitlab.com/kicad/code/kicad/issues/5252
This commit is contained in:
parent
d3d90ddb67
commit
2bf4fcae2a
|
@ -379,6 +379,7 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference )
|
|||
}
|
||||
|
||||
bool restore_state = false;
|
||||
bool fromOtherCommand = false;
|
||||
VECTOR2I totalMovement;
|
||||
GRID_HELPER grid( m_toolMgr, editFrame->GetMagneticItemsSettings() );
|
||||
TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
|
||||
|
@ -483,6 +484,9 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference )
|
|||
m_commit->Modify( bItem );
|
||||
});
|
||||
}
|
||||
|
||||
if( item->IsNew() )
|
||||
fromOtherCommand = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -615,9 +619,25 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference )
|
|||
|
||||
// If canceled, we need to remove the dynamic ratsnest from the screen
|
||||
if( restore_state )
|
||||
{
|
||||
m_commit->Revert();
|
||||
|
||||
if( fromOtherCommand )
|
||||
{
|
||||
PICKED_ITEMS_LIST* undo = editFrame->PopCommandFromUndoList();
|
||||
|
||||
if( undo )
|
||||
{
|
||||
editFrame->PutDataInPreviousState( undo, false );
|
||||
undo->ClearListAndDeleteItems();
|
||||
delete undo;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_commit->Push( _( "Drag" ) );
|
||||
}
|
||||
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::hideDynamicRatsnest, true );
|
||||
|
||||
|
|
Loading…
Reference in New Issue