Use original event position if it's available.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15623

(cherry picked from commit e962615407)
This commit is contained in:
Jeff Young 2023-09-24 19:01:22 +01:00
parent 4eb9281f4d
commit f1376396c2
1 changed files with 2 additions and 1 deletions

View File

@ -239,7 +239,8 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
setCursor(); setCursor();
grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( view.GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() ); grid.SetUseGrid( view.GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
const VECTOR2I cursorPos = grid.BestSnapAnchor( controls.GetMousePosition(), nullptr ); VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() : controls.GetMousePosition();
cursorPos = grid.BestSnapAnchor( cursorPos, nullptr );
controls.ForceCursorPosition( true, cursorPos ); controls.ForceCursorPosition( true, cursorPos );
if( evt->IsCancelInteractive() ) if( evt->IsCancelInteractive() )