Fix a few more cases of picking up wrong mouse positions

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7745
This commit is contained in:
Jon Evans 2021-03-03 20:09:24 -05:00
parent 24e375742b
commit 1fc399fa31
2 changed files with 10 additions and 6 deletions

View File

@ -592,8 +592,9 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
getViewControls()->ShowCursor( true );
cursorPos = aEvent.IsPrime() ? (wxPoint) aEvent.Position()
: (wxPoint) controls->GetMousePosition();
cursorPos = static_cast<wxPoint>( aEvent.HasPosition() ?
aEvent.Position() :
controls->GetMousePosition() );
std::string tool = aEvent.GetCommandStr().get();
m_frame->PushTool( tool );

View File

@ -701,7 +701,9 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) );
VECTOR2I cursorPos = evt->IsPrime() ? evt->Position() : m_controls->GetMousePosition();
VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() : m_controls->GetMousePosition();
cursorPos = grid.BestSnapAnchor( cursorPos, nullptr );
m_controls->ForceCursorPosition( true, cursorPos );
@ -1920,9 +1922,10 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
LSET layers( m_frame->GetActiveLayer() );
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->Modifier( MD_ALT ) );
VECTOR2I cursorPos = grid.BestSnapAnchor( evt->IsPrime() ? evt->Position()
: m_controls->GetMousePosition(),
layers );
VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() : m_controls->GetMousePosition();
cursorPos = grid.BestSnapAnchor( cursorPos, layers );
m_controls->ForceCursorPosition( true, cursorPos );
if( ( sourceZone && sourceZone->GetHV45() ) || constrainAngle || evt->Modifier( MD_CTRL ) )