Schematic: handle aligning unaligned sheet pins in aligned sheet
Also fix a rounding bug. Fixes: https://gitlab.com/kicad/code/kicad/-/issues/15050
This commit is contained in:
parent
5b335f1c4e
commit
22c609fb7b
|
@ -104,8 +104,8 @@ VECTOR2I GRID_HELPER::AlignGrid( const VECTOR2I& aPoint, const VECTOR2D& aGrid,
|
||||||
VECTOR2I GRID_HELPER::computeNearest( const VECTOR2I& aPoint, const VECTOR2I& aGrid,
|
VECTOR2I GRID_HELPER::computeNearest( const VECTOR2I& aPoint, const VECTOR2I& aGrid,
|
||||||
const VECTOR2I& aOffset ) const
|
const VECTOR2I& aOffset ) const
|
||||||
{
|
{
|
||||||
return VECTOR2I( KiROUND( ( aPoint.x - aOffset.x ) / aGrid.x ) * aGrid.x + aOffset.x,
|
return VECTOR2I( KiROUND( (double) ( aPoint.x - aOffset.x ) / aGrid.x ) * aGrid.x + aOffset.x,
|
||||||
KiROUND( ( aPoint.y - aOffset.y ) / aGrid.y ) * aGrid.y + aOffset.y );
|
KiROUND( (double) ( aPoint.y - aOffset.y ) / aGrid.y ) * aGrid.y + aOffset.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1687,7 +1687,7 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
SCH_ITEM* schItem = static_cast<SCH_ITEM*>( item );
|
SCH_ITEM* schItem = static_cast<SCH_ITEM*>( item );
|
||||||
std::vector<VECTOR2I> connections = schItem->GetConnectionPoints();
|
std::vector<VECTOR2I> connections = schItem->GetConnectionPoints();
|
||||||
EDA_ITEMS drag_items{ item };
|
EDA_ITEMS drag_items;
|
||||||
|
|
||||||
for( const VECTOR2I& point : connections )
|
for( const VECTOR2I& point : connections )
|
||||||
getConnectedDragItems( &commit, schItem, point, drag_items );
|
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 ) )
|
if( most_common != VECTOR2I( 0, 0 ) )
|
||||||
{
|
{
|
||||||
|
doMoveItem( item, most_common );
|
||||||
|
|
||||||
for( EDA_ITEM* dragItem : drag_items )
|
for( EDA_ITEM* dragItem : drag_items )
|
||||||
{
|
{
|
||||||
if( dragItem->GetParent() && dragItem->GetParent()->IsSelected() )
|
if( dragItem->GetParent() && dragItem->GetParent()->IsSelected() )
|
||||||
|
|
Loading…
Reference in New Issue