From f1376396c2351b5a6edab2a090682a9ae6acfb87 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 24 Sep 2023 19:01:22 +0100 Subject: [PATCH] Use original event position if it's available. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15623 (cherry picked from commit e962615407d0f3fb1ffe5952d987ba468efbd111) --- pcbnew/tools/pcb_viewer_tools.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/pcb_viewer_tools.cpp b/pcbnew/tools/pcb_viewer_tools.cpp index 464660a2e3..cfafcb571a 100644 --- a/pcbnew/tools/pcb_viewer_tools.cpp +++ b/pcbnew/tools/pcb_viewer_tools.cpp @@ -239,7 +239,8 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent ) setCursor(); grid.SetSnap( !evt->Modifier( MD_SHIFT ) ); 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 ); if( evt->IsCancelInteractive() )