diff --git a/eeschema/tools/ee_grid_helper.cpp b/eeschema/tools/ee_grid_helper.cpp index ee438e0a2b..d7420574d2 100644 --- a/eeschema/tools/ee_grid_helper.cpp +++ b/eeschema/tools/ee_grid_helper.cpp @@ -351,7 +351,7 @@ GRID_HELPER_GRIDS EE_GRID_HELPER::GetSelectionGrid( const EE_SELECTION& aSelecti } -GRID_HELPER_GRIDS EE_GRID_HELPER::GetItemGrid( const SCH_ITEM* aItem ) +GRID_HELPER_GRIDS EE_GRID_HELPER::GetItemGrid( const SCH_ITEM* aItem ) const { if( !aItem ) return GRID_CURRENT; diff --git a/eeschema/tools/ee_grid_helper.h b/eeschema/tools/ee_grid_helper.h index c85dfe1bbc..d70ec78fd7 100644 --- a/eeschema/tools/ee_grid_helper.h +++ b/eeschema/tools/ee_grid_helper.h @@ -70,7 +70,7 @@ public: using GRID_HELPER::GetGrid; GRID_HELPER_GRIDS GetSelectionGrid( const EE_SELECTION& aItem ); - GRID_HELPER_GRIDS GetItemGrid( const SCH_ITEM* aItem ); + GRID_HELPER_GRIDS GetItemGrid( const SCH_ITEM* aItem ) const; VECTOR2I BestDragOrigin( const VECTOR2I& aMousePos, GRID_HELPER_GRIDS aGrid, const EE_SELECTION& aItems ); diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index 0952228c86..a92953eccc 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -279,6 +279,8 @@ void SCH_MOVE_TOOL::orthoLineDrag( SCH_COMMIT* aCommit, SCH_LINE* line, const VE // put wires between it and its original endpoint. else if( foundAttachment && line->IsOrthogonal() ) { + VECTOR2D lineGrid = grid.GetGridSize( grid.GetItemGrid( line ) ); + // The bend counter handles a group of wires all needing their offset one grid movement // further out from each other to not overlap. The absolute value stuff finds the // direction of the line and hence the the bend increment on that axis @@ -286,9 +288,9 @@ void SCH_MOVE_TOOL::orthoLineDrag( SCH_COMMIT* aCommit, SCH_LINE* line, const VE unsigned int yMoveBit = splitDelta.y != 0; int xLength = abs( unselectedEnd.x - selectedEnd.x ); int yLength = abs( unselectedEnd.y - selectedEnd.y ); - int xMove = ( xLength - ( xBendCount * grid.GetGrid().x ) ) + int xMove = ( xLength - ( xBendCount * lineGrid.x ) ) * sign( selectedEnd.x - unselectedEnd.x ); - int yMove = ( yLength - ( yBendCount * grid.GetGrid().y ) ) + int yMove = ( yLength - ( yBendCount * lineGrid.y ) ) * sign( selectedEnd.y - unselectedEnd.y ); // Create a new wire ending at the unselected end, we'll move the new wire's start