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
(cherry picked from commit 8c4c3b7e5e0c37d797ae0b4cda731d03c72b1e23)
This commit is contained in:
John Beard 2025-08-03 20:35:15 +08:00
parent 1bb42bcb59
commit 026280780c

View File

@ -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<STATUS_TEXT_POPUP> statusPopup;
wxString status;
size_t itemIdx = 0;
@ -653,7 +654,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() );