Warp after context menu only if actively drawing.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11080

(cherry picked from commit 1a7152d3eb)
This commit is contained in:
Jeff Young 2024-02-15 18:06:54 +00:00 committed by Roberto Fernandez Bautista
parent e68cd04d48
commit e7f18e7eab
3 changed files with 22 additions and 0 deletions

View File

@ -882,6 +882,9 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_RIGHT ) )
{
if( !text )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu( selection() );
}
else if( evt->IsClick( BUT_LEFT ) )
@ -1179,6 +1182,9 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_RIGHT ) )
{
if( !dimension )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu( selection() );
}
else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
@ -1976,6 +1982,9 @@ bool DRAWING_TOOL::drawShape( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
}
else if( evt->IsClick( BUT_RIGHT ) )
{
if( !graphic )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu( selection() );
}
else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
@ -2411,6 +2420,9 @@ bool DRAWING_TOOL::drawArc( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
}
else if( evt->IsClick( BUT_RIGHT ) )
{
if( !graphic )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu( selection() );
}
else if( evt->IsAction( &PCB_ACTIONS::incWidth ) )
@ -2663,6 +2675,9 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_RIGHT ) )
{
if( !started )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu( selection() );
}
// events that lock in nodes

View File

@ -675,6 +675,10 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
restore_state = true; // Canceling the tool means that items have to be restored
break; // Finish
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu( selection );
}
else if( evt->IsAction( &ACTIONS::undo ) || evt->IsAction( &ACTIONS::doDelete ) )
{
restore_state = true; // Perform undo locally

View File

@ -348,8 +348,11 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
m_frame->GetCanvas()->ForceRefresh();
if( !selectionCancelled )
{
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu( m_selection );
}
}
else if( evt->IsDblClick( BUT_LEFT ) )
{
m_disambiguateTimer.Stop();