From d7ddc62d7ebb46b55b362a4c85f91db76c6e6acf Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 2 Feb 2021 17:19:25 +0000 Subject: [PATCH] Fix mouse warping and dialog placement for layer switcher. Fixes https://gitlab.com/kicad/code/kicad/issues/2607 --- pcbnew/router/router_tool.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 2e521ac8e5..0c7c9b9a1a 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -750,13 +750,16 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia ) // ask the user for a target layer if( selectLayer ) { - wxPoint dlgPosition = wxGetMousePosition(); + wxPoint endPoint = (wxPoint) view()->ToScreen( m_endSnapPoint ); + endPoint = frame()->GetCanvas()->ClientToScreen( endPoint ); + + controls()->WarpCursor( endPoint ); targetLayer = frame()->SelectLayer( static_cast( currentLayer ), - LSET::AllNonCuMask(), dlgPosition ); + LSET::AllNonCuMask(), endPoint ); - // Reset the cursor to the position where the event occurred - controls()->SetCursorPosition( aEvent.HasPosition() ? aEvent.Position() : dlgPosition ); + // Reset the cursor to the end of the track + controls()->SetCursorPosition( m_endSnapPoint ); } }