Update pointEditor after cancelled move.

This commit is contained in:
Jeff Young 2022-11-05 16:36:10 +00:00
parent 5366fa8cee
commit bb618f2d55
2 changed files with 18 additions and 9 deletions

View File

@ -749,26 +749,34 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference )
m_dragging = false;
editFrame->UndoRedoBlock( false );
m_toolMgr->GetTool<DRAWING_TOOL>()->UpdateStatusBar();
if( hasRedrawn3D && restore_state )
editFrame->Update3DView( false, true );
// 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.
// items (after the potential Revert()).
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
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 )
{
m_commit->Revert();
else
m_commit->Push( _( "Drag" ) );
// Mainly for point editor, but there might be other clients that need to adjust to
// reverted state.
m_toolMgr->PostEvent( EVENTS::SelectedItemsMoved );
if( hasRedrawn3D )
editFrame->Update3DView( false, true );
}
else
{
m_commit->Push( _( "Drag" ) );
}
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &orig_items );
m_toolMgr->GetTool<DRAWING_TOOL>()->UpdateStatusBar();
// Remove the dynamic ratsnest from the screen
m_toolMgr->RunAction( PCB_ACTIONS::hideLocalRatsnest, true );

View File

@ -2472,6 +2472,7 @@ void PCB_POINT_EDITOR::setTransitions()
Go( &PCB_POINT_EDITOR::addCorner, PCB_ACTIONS::pointEditorAddCorner.MakeEvent() );
Go( &PCB_POINT_EDITOR::removeCorner, PCB_ACTIONS::pointEditorRemoveCorner.MakeEvent() );
Go( &PCB_POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsModified );
Go( &PCB_POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsMoved );
Go( &PCB_POINT_EDITOR::OnSelectionChange, EVENTS::PointSelectedEvent );
Go( &PCB_POINT_EDITOR::OnSelectionChange, EVENTS::SelectedEvent );
Go( &PCB_POINT_EDITOR::OnSelectionChange, EVENTS::UnselectedEvent );