router: consider mouse drag event a valid route start/end event

L-clicks during routing operation while the mouse is moving (even slightly) were ignored, which was annoying to some users (myself included). Now the router
always fixes the track upon mouse click.
This commit is contained in:
Tomasz Wlostowski 2022-06-03 23:11:34 +02:00
parent eaee610fd9
commit 0bd7f603a3
2 changed files with 8 additions and 2 deletions

View File

@ -310,7 +310,13 @@ void TOOL_BASE::updateEndItem( const TOOL_EVENT& aEvent )
m_gridHelper->SetSnap( !aEvent.Modifier( MD_SHIFT ) );
controls()->ForceCursorPosition( false );
VECTOR2I mousePos = controls()->GetMousePosition();
VECTOR2I mousePos;
if( ! aEvent.IsDrag() )
mousePos = controls()->GetMousePosition();
else
mousePos = aEvent.DragOrigin();
if( m_router->Settings().Mode() != RM_MarkObstacles &&
( m_router->GetCurrentNets().empty() || m_router->GetCurrentNets().front() < 0 ) )

View File

@ -1186,7 +1186,7 @@ void ROUTER_TOOL::performRouting()
updateEndItem( *evt );
m_router->Move( m_endSnapPoint, m_endItem );
}
else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &PCB_ACTIONS::routeSingleTrack ) )
else if( evt->IsClick( BUT_LEFT ) || evt->IsDrag( BUT_LEFT ) || evt->IsAction( &PCB_ACTIONS::routeSingleTrack ) )
{
updateEndItem( *evt );
bool needLayerSwitch = m_router->IsPlacingVia();