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
This commit is contained in:
Jeff Young 2022-02-26 15:55:21 +00:00
parent 0e00ca31ea
commit 89c14f01f7
1 changed files with 4 additions and 3 deletions

View File

@ -546,18 +546,19 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
{ {
if( grid.GetUseGrid() ) if( grid.GetUseGrid() )
{ {
// VECTOR2I gridPt = grid.BestSnapAnchor( pos, {}, { item } ); VECTOR2I gridPt = grid.BestSnapAnchor( pos, {}, { item } );
VECTOR2I last = m_editedPoint->GetPosition(); VECTOR2I last = m_editedPoint->GetPosition();
VECTOR2I delta = pos - last; VECTOR2I delta = pos - last;
VECTOR2I deltaGrid = gridPt - grid.BestSnapAnchor( last, {}, { item } );
if( abs( delta.x ) > grid.GetGrid().x / 2 ) 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 else
pos.x = last.x; pos.x = last.x;
if( abs( delta.y ) > grid.GetGrid().y / 2 ) 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 else
pos.y = last.y; pos.y = last.y;
} }