EDIT_TOOL::doMoveSelection(): avoid calling PushTool() and, just after,PopTool()

for the *same* event: TOOLS_HOLDER::PopTool() does not work fine in this case.
This commit is contained in:
jean-pierre charras 2023-04-26 12:40:44 +02:00
parent f7f52d77e4
commit 2f392352b5
1 changed files with 2 additions and 6 deletions

View File

@ -283,8 +283,6 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, const wxString& aCommi
wxString status; wxString status;
size_t itemIdx = 0; size_t itemIdx = 0;
editFrame->PushTool( aEvent );
// Be sure that there is at least one item that we can modify. If nothing was selected before, // Be sure that there is at least one item that we can modify. If nothing was selected before,
// try looking for the stuff under mouse cursor (i.e. KiCad old-style hover selection) // try looking for the stuff under mouse cursor (i.e. KiCad old-style hover selection)
PCB_SELECTION& selection = m_selectionTool->RequestSelection( PCB_SELECTION& selection = m_selectionTool->RequestSelection(
@ -298,10 +296,7 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, const wxString& aCommi
!m_isFootprintEditor && cfg->m_AllowFreePads ); !m_isFootprintEditor && cfg->m_AllowFreePads );
if( m_dragging || selection.Empty() ) if( m_dragging || selection.Empty() )
{
editFrame->PopTool( aEvent );
return 0; return 0;
}
LSET item_layers = selection.GetSelectionLayers(); LSET item_layers = selection.GetSelectionLayers();
bool is_hover = selection.IsHover(); // N.B. This must be saved before the second call bool is_hover = selection.IsHover(); // N.B. This must be saved before the second call
@ -324,11 +319,12 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, const wxString& aCommi
if( selection.Empty() ) if( selection.Empty() )
{ {
editFrame->PopTool( aEvent );
return 0; return 0;
} }
editFrame->PushTool( aEvent );
Activate(); Activate();
// Must be done after Activate() so that it gets set into the correct context // Must be done after Activate() so that it gets set into the correct context
controls->ShowCursor( true ); controls->ShowCursor( true );
controls->SetAutoPan( true ); controls->SetAutoPan( true );