Drag & Fillet Tracks: Ignore mouse up / click events until move / drag
Ensures that any click/mouse up events generated after clicking "OK" in the "Override locks" dialog are ignored. Fixes https://gitlab.com/kicad/code/kicad/-/issues/8123
This commit is contained in:
parent
ce8132bf4f
commit
04ff8cde5e
|
@ -1661,6 +1661,8 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
|||
// Send an initial movement to prime the collision detection
|
||||
m_router->Move( p, nullptr );
|
||||
|
||||
bool hasMouseMoved = false;
|
||||
|
||||
while( TOOL_EVENT* evt = Wait() )
|
||||
{
|
||||
setCursor();
|
||||
|
@ -1671,6 +1673,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
|
||||
{
|
||||
hasMouseMoved = true;
|
||||
updateEndItem( *evt );
|
||||
m_router->Move( m_endSnapPoint, m_endItem );
|
||||
|
||||
|
@ -1719,7 +1722,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
}
|
||||
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
|
||||
else if( hasMouseMoved && ( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ))
|
||||
{
|
||||
updateEndItem( *evt );
|
||||
m_router->FixRoute( m_endSnapPoint, m_endItem );
|
||||
|
|
|
@ -512,6 +512,8 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
|
|||
int cSegTanEndSide = cSegTanEnd.Side( theArc->GetMid() );
|
||||
int cSegChordSide = cSegChord.Side( theArc->GetMid() );
|
||||
|
||||
bool hasMouseMoved = false;
|
||||
|
||||
// Start the tool loop
|
||||
//====================
|
||||
while( TOOL_EVENT* evt = Wait() )
|
||||
|
@ -578,7 +580,11 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
|
|||
getView()->Update( theArc );
|
||||
|
||||
//Handle events
|
||||
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||
if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
|
||||
{
|
||||
hasMouseMoved = true;
|
||||
}
|
||||
else if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||
{
|
||||
restore_state = true; // Canceling the tool means that items have to be restored
|
||||
break; // Finish
|
||||
|
@ -588,8 +594,9 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent )
|
|||
restore_state = true; // Perform undo locally
|
||||
break; // Finish
|
||||
}
|
||||
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT )
|
||||
|| evt->IsDblClick( BUT_LEFT ) )
|
||||
else if( hasMouseMoved
|
||||
&& ( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT )
|
||||
|| evt->IsDblClick( BUT_LEFT ) ) )
|
||||
{
|
||||
break; // Finish
|
||||
}
|
||||
|
@ -1180,7 +1187,7 @@ int EDIT_TOOL::FilletTracks( const TOOL_EVENT& aEvent )
|
|||
aCollector.Remove( item );
|
||||
}
|
||||
},
|
||||
!m_dragging /* prompt user regarding locked items */ );
|
||||
true /* prompt user regarding locked items */ );
|
||||
|
||||
if( selection.Size() < 2 )
|
||||
{
|
||||
|
@ -1223,8 +1230,7 @@ int EDIT_TOOL::FilletTracks( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PCB_TRACK* track = dyn_cast<PCB_TRACK*>( *it );
|
||||
|
||||
if( !track || track->Type() != PCB_TRACE_T || track->IsLocked()
|
||||
|| track->GetLength() == 0 )
|
||||
if( !track || track->Type() != PCB_TRACE_T || track->GetLength() == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue