Items added to a selection for a drag should only be temporary.

After the drag, cancel, or undo, only the originally-selected items
should remain selected.
This commit is contained in:
Jeff Young 2019-12-24 22:12:16 +00:00
parent cd1f3acf49
commit 87e163945e
2 changed files with 12 additions and 1 deletions

View File

@ -117,6 +117,12 @@ protected:
void saveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO_T aType, bool aAppend = false )
{
KICAD_T itemType = aItem->Type();
bool selected = aItem->IsSelected();
// IS_SELECTED flag should not be set on undo items which were added for
// a drag operation.
if( selected && aItem->HasFlag( TEMP_SELECTED ))
aItem->ClearSelected();
if( m_isLibEdit )
{
@ -133,6 +139,9 @@ protected:
else
editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem, aType, aAppend );
}
if( selected && aItem->HasFlag( TEMP_SELECTED ) )
aItem->SetSelected();
}
protected:

View File

@ -234,7 +234,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
{
if( item->IsNew() )
{
if( item->HasFlag(TEMP_SELECTED ) && m_isDragOperation )
if( item->HasFlag( TEMP_SELECTED ) && m_isDragOperation )
{
// Item was added in getConnectedDragItems
saveCopyInUndoList( (SCH_ITEM*) item, UR_NEW, appendUndo );
@ -431,6 +431,8 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
for( EDA_ITEM* item : selection )
item->ClearEditFlags();
m_selectionTool->RemoveItemsFromSel( &m_dragAdditions, QUIET_MODE );
if( restore_state )
{
m_frame->RollbackSchematicFromUndo();