Move: Ignore mouse up and click events until a mouse move / drag event

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8123
This commit is contained in:
Roberto Fernandez Bautista 2021-04-05 15:11:14 +01:00 committed by Jeff Young
parent 09b2db3139
commit 211fd65c23
1 changed files with 8 additions and 1 deletions

View File

@ -793,6 +793,8 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
TOOL_EVENT* evt = &aEvent;
VECTOR2I prevPos;
bool hasMouseMoved = false;
// Prime the pump
m_toolMgr->RunAction( ACTIONS::refreshPreview );
@ -804,6 +806,9 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) );
if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
hasMouseMoved = true;
if( evt->IsAction( &PCB_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT )
|| evt->IsAction( &ACTIONS::refreshPreview )
|| evt->IsAction( &PCB_ACTIONS::moveWithReference ) )
@ -985,8 +990,10 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
break; // finish -- we moved exactly, so we are finished
}
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
else if( hasMouseMoved && ( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
{
// Ignore mouse up and click events until we receive at least one mouse move or
// mouse drag event
break; // finish
}
else