From 8c4c3b7e5e0c37d797ae0b4cda731d03c72b1e23 Mon Sep 17 00:00:00 2001 From: John Beard Date: Sun, 3 Aug 2025 20:35:15 +0800 Subject: [PATCH] Pcbnew: when moving, select move origin by mouse, not cursor Selecting the origin fby the cursor position makes it impossible to select a item further from a grid point than another. This is especially noticeable when selecting pins while using large grids Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10471 --- pcbnew/tools/edit_tool_move_fct.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/edit_tool_move_fct.cpp b/pcbnew/tools/edit_tool_move_fct.cpp index 0ca47c8035..f97f3f7993 100644 --- a/pcbnew/tools/edit_tool_move_fct.cpp +++ b/pcbnew/tools/edit_tool_move_fct.cpp @@ -301,6 +301,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit BOARD* board = editFrame->GetBoard(); KIGFX::VIEW_CONTROLS* controls = getViewControls(); VECTOR2I originalCursorPos = controls->GetCursorPosition(); + VECTOR2I originalMousePos = controls->GetMousePosition(); std::unique_ptr statusPopup; wxString status; size_t itemIdx = 0; @@ -656,7 +657,9 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit } } - m_cursor = grid.BestDragOrigin( originalCursorPos, sel_items, + // Use the mouse position over cursor, as otherwise large grids will allow only + // snapping to items that are closest to grid points + m_cursor = grid.BestDragOrigin( originalMousePos, sel_items, grid.GetSelectionGrid( selection ), &m_selectionTool->GetFilter() );