eeschema: move part by a point on the grid (lp:1563587)

This commit is contained in:
Chris Pavlina 2016-03-30 14:19:32 -04:00
parent fd3835eb4f
commit 5ff3bbb96e
1 changed files with 9 additions and 1 deletions

View File

@ -796,7 +796,15 @@ void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC )
aItem->SetStoredPos( wxPoint( 0,0 ) ); aItem->SetStoredPos( wxPoint( 0,0 ) );
} }
else else
aItem->SetStoredPos( GetCrossHairPosition() - aItem->GetPosition() ); {
// Round the point under the cursor to a multiple of the grid
wxPoint cursorpos = GetCrossHairPosition() - aItem->GetPosition();
wxPoint gridsize = GetScreen()->GetGridSize();
cursorpos.x = ( cursorpos.x / gridsize.x ) * gridsize.x;
cursorpos.y = ( cursorpos.y / gridsize.y ) * gridsize.y;
aItem->SetStoredPos( cursorpos );
}
OnModify(); OnModify();