Fix mouse warping and dialog placement for layer switcher.

Fixes https://gitlab.com/kicad/code/kicad/issues/2607
This commit is contained in:
Jeff Young 2021-02-02 17:19:25 +00:00
parent b8e97bb6b6
commit d7ddc62d7e
1 changed files with 7 additions and 4 deletions

View File

@ -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<PCB_LAYER_ID>( 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 );
}
}