diff --git a/common/tool/grid_helper.cpp b/common/tool/grid_helper.cpp index f01718e2aa..46906c60bb 100644 --- a/common/tool/grid_helper.cpp +++ b/common/tool/grid_helper.cpp @@ -104,8 +104,8 @@ VECTOR2I GRID_HELPER::AlignGrid( const VECTOR2I& aPoint, const VECTOR2D& aGrid, VECTOR2I GRID_HELPER::computeNearest( const VECTOR2I& aPoint, const VECTOR2I& aGrid, const VECTOR2I& aOffset ) const { - return VECTOR2I( KiROUND( ( aPoint.x - aOffset.x ) / aGrid.x ) * aGrid.x + aOffset.x, - KiROUND( ( aPoint.y - aOffset.y ) / aGrid.y ) * aGrid.y + aOffset.y ); + return VECTOR2I( KiROUND( (double) ( aPoint.x - aOffset.x ) / aGrid.x ) * aGrid.x + aOffset.x, + KiROUND( (double) ( aPoint.y - aOffset.y ) / aGrid.y ) * aGrid.y + aOffset.y ); } diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index 60c70b3ea2..0952228c86 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -1687,7 +1687,7 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent ) { SCH_ITEM* schItem = static_cast( item ); std::vector connections = schItem->GetConnectionPoints(); - EDA_ITEMS drag_items{ item }; + EDA_ITEMS drag_items; for( const VECTOR2I& point : connections ) getConnectedDragItems( &commit, schItem, point, drag_items ); @@ -1711,6 +1711,8 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent ) if( most_common != VECTOR2I( 0, 0 ) ) { + doMoveItem( item, most_common ); + for( EDA_ITEM* dragItem : drag_items ) { if( dragItem->GetParent() && dragItem->GetParent()->IsSelected() )