More push/pop tool issues

We need to pop the move tool off when it doesn't find anything to act on
so that the pushed tools under it on the stack can re-activate

Fixes https://gitlab.com/kicad/code/kicad/issues/13114
This commit is contained in:
Seth Hillbrand 2022-12-12 12:55:44 -08:00
parent 3144459939
commit 4fe35d0df1
1 changed files with 8 additions and 2 deletions

View File

@ -290,6 +290,8 @@ 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(
@ -303,7 +305,10 @@ 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
@ -325,9 +330,10 @@ 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