Warp back from context menu before running command.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19560
This commit is contained in:
Jeff Young 2025-06-16 10:57:14 +01:00
parent 6471db70cd
commit 74bf678d99
3 changed files with 22 additions and 0 deletions

View File

@ -1011,6 +1011,16 @@ void TOOL_MANAGER::DispatchContextMenu( const TOOL_EVENT& aEvent )
}
void TOOL_MANAGER::WarpAfterContextMenu()
{
if( m_viewControls && m_warpMouseAfterContextMenu )
m_viewControls->WarpMouseCursor( m_menuCursor, true, false );
// Don't warp again when the menu is closed
m_warpMouseAfterContextMenu = false;
}
TOOL_MANAGER::ID_LIST::iterator TOOL_MANAGER::finishTool( TOOL_STATE* aState )
{
auto it = std::find( m_activeTools.begin(), m_activeTools.end(), aState->theTool->GetId() );

View File

@ -517,6 +517,15 @@ public:
m_warpMouseAfterContextMenu = false;
}
/**
* Normally we warp the mouse after the context menu action runs. This works fine for
* something like the properties dialog, where you can continue drawing after the warp.
* However, if the menu command itself is a drawing action (such as "Attempt Finish",
* it will run before the warp (ie: from the position the command was in on the context
* menu). This call allows an action to perform the warp before it is run.
*/
void WarpAfterContextMenu();
/**
* Handle context menu related events.
*/

View File

@ -1337,6 +1337,9 @@ void ROUTER_TOOL::performRouting( VECTOR2D aStartPosition )
}
else if( evt->IsAction( &PCB_ACTIONS::routerAttemptFinish ) )
{
if( m_toolMgr->IsContextMenuActive() )
m_toolMgr->WarpAfterContextMenu();
bool* autoRouted = evt->Parameter<bool*>();
if( m_router->Finish() )