From 89c14f01f7597dcbef5f9955f907ec952d3b1d91 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 26 Feb 2022 15:55:21 +0000 Subject: [PATCH] Repair algorithm to avoid slow movement issue. This goes back to the previous code for this one part. Fixes https://gitlab.com/kicad/code/kicad/issues/10976 --- pcbnew/tools/pcb_point_editor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index f6a42d35d5..f525e0f321 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -546,18 +546,19 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) { if( grid.GetUseGrid() ) { - // VECTOR2I gridPt = grid.BestSnapAnchor( pos, {}, { item } ); + VECTOR2I gridPt = grid.BestSnapAnchor( pos, {}, { item } ); VECTOR2I last = m_editedPoint->GetPosition(); VECTOR2I delta = pos - last; + VECTOR2I deltaGrid = gridPt - grid.BestSnapAnchor( last, {}, { item } ); if( abs( delta.x ) > grid.GetGrid().x / 2 ) - pos.x = last.x + ( grid.GetGrid().x * sign( delta.x ) ); + pos.x = last.x + deltaGrid.x; else pos.x = last.x; if( abs( delta.y ) > grid.GetGrid().y / 2 ) - pos.y = last.y + ( grid.GetGrid().y * sign( delta.y ) ); + pos.y = last.y + deltaGrid.y; else pos.y = last.y; }