Don't exit group when the cancel went to another tool.

Also fixes a bug where the group border didn't get updated immediately
on enter/exit.

Fixes https://gitlab.com/kicad/code/kicad/issues/12669
This commit is contained in:
Jeff Young 2022-10-18 17:52:27 +01:00
parent 1964087960
commit 403cc50e7c
1 changed files with 13 additions and 9 deletions

View File

@ -447,16 +447,17 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
m_disambiguateTimer.Stop(); m_disambiguateTimer.Stop();
m_frame->FocusOnItem( nullptr ); m_frame->FocusOnItem( nullptr );
if( m_enteredGroup ) if( !GetSelection().Empty() )
{
ExitGroup();
ClearSelection();
}
else if( !GetSelection().Empty() )
{ {
ClearSelection(); ClearSelection();
} }
else if( evt->FirstResponder() == this && evt->GetCommandId() == (int) WXK_ESCAPE ) else if( evt->FirstResponder() == this && evt->GetCommandId() == (int) WXK_ESCAPE )
{
if( m_enteredGroup )
{
ExitGroup();
}
else
{ {
BOARD_INSPECTION_TOOL* controller = m_toolMgr->GetTool<BOARD_INSPECTION_TOOL>(); BOARD_INSPECTION_TOOL* controller = m_toolMgr->GetTool<BOARD_INSPECTION_TOOL>();
@ -464,6 +465,7 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
controller->ClearHighlight( *evt ); controller->ClearHighlight( *evt );
} }
} }
}
else else
{ {
evt->SetPassEvent(); evt->SetPassEvent();
@ -514,6 +516,7 @@ void PCB_SELECTION_TOOL::EnterGroup()
} ); } );
m_enteredGroupOverlay.Add( m_enteredGroup ); m_enteredGroupOverlay.Add( m_enteredGroup );
view()->Update( &m_enteredGroupOverlay );
} }
@ -531,6 +534,7 @@ void PCB_SELECTION_TOOL::ExitGroup( bool aSelectGroup )
m_enteredGroupOverlay.Clear(); m_enteredGroupOverlay.Clear();
m_enteredGroup = nullptr; m_enteredGroup = nullptr;
view()->Update( &m_enteredGroupOverlay );
} }