Schematic: ortho line drag bend lines should respect grid overrides

This commit is contained in:
Mike Williams 2023-08-21 10:42:02 -04:00
parent 8b79ab708a
commit 4e763cd9f2
3 changed files with 6 additions and 4 deletions

View File

@ -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;

View File

@ -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 );

View File

@ -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