Make sure that a tool never exits with autopan or capture.

Fixes https://gitlab.com/kicad/code/kicad/issues/8459
This commit is contained in:
Jeff Young 2021-05-21 14:53:32 +01:00
parent 4a77a4080d
commit 0d8a9a1091
3 changed files with 12 additions and 0 deletions

View File

@ -2055,7 +2055,9 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
if( evt->IsCancelInteractive() )
{
if( polyGeomMgr.IsPolygonInProgress() )
{
cleanup();
}
else
{
m_frame->PopTool( tool );
@ -2198,6 +2200,8 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
m_controls->ForceCursorPosition( false );
controls()->SetAutoPan( false );
m_controls->CaptureCursor( false );
return 0;
}

View File

@ -121,7 +121,9 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
break;
}
else if( newItem )
{
cleanup();
}
else
{
frame()->PopTool( aTool );
@ -258,6 +260,8 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
view()->Remove( &preview );
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
controls()->SetAutoPan( false );
controls()->CaptureCursor( false );
}

View File

@ -252,7 +252,9 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
if( evt->IsCancelInteractive() )
{
if( originSet )
{
clearRuler();
}
else
{
frame()->PopTool( tool );
@ -328,6 +330,8 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
view.Remove( &ruler );
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
controls.SetAutoPan( false );
controls.CaptureCursor( false );
return 0;
}