From 8fab2d8ca301ee779673d2596e4d9ed1810d7739 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 7 Aug 2025 08:25:04 -0700 Subject: [PATCH] Disable snap when moving with keyboard Keyboard movement is for precision control, so avoid snapping behavior Fixes https://gitlab.com/kicad/code/kicad/-/issues/21235 (cherry picked from commit 9e326c29dbacfdf5dc6dc6e4a1909abe6fc5eaf7) --- pcbnew/tools/edit_tool_move_fct.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pcbnew/tools/edit_tool_move_fct.cpp b/pcbnew/tools/edit_tool_move_fct.cpp index 2b73e9aa64..457f494de3 100644 --- a/pcbnew/tools/edit_tool_move_fct.cpp +++ b/pcbnew/tools/edit_tool_move_fct.cpp @@ -493,16 +493,13 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit if( controls->GetSettings().m_lastKeyboardCursorPositionValid ) { - long action = controls->GetSettings().m_lastKeyboardCursorCommand; - - // The arrow keys are by definition SINGLE AXIS. Do not allow the other - // axis to be snapped to the grid. - if( action == ACTIONS::CURSOR_LEFT || action == ACTIONS::CURSOR_RIGHT ) - m_cursor.y = prevPos.y; - else if( action == ACTIONS::CURSOR_UP || action == ACTIONS::CURSOR_DOWN ) - m_cursor.x = prevPos.x; + grid.SetSnap( false ); + grid.SetUseGrid( false ); } + m_cursor = grid.BestSnapAnchor( mousePos, layers, + grid.GetSelectionGrid( selection ), sel_items ); + if( !selection.HasReferencePoint() ) originalPos = m_cursor;