Correctly sort positions for default align

When not aligning under mouse cursor, choose the X-most element where X
is top/bottom/left/right.  Previous sorting was not correct for two
directions

Fixes https://gitlab.com/kicad/code/kicad/issues/12627
This commit is contained in:
Seth Hillbrand 2022-10-14 16:14:08 -07:00
parent 5c974f8cd0
commit 697056fa7e
1 changed files with 2 additions and 2 deletions

View File

@ -245,7 +245,7 @@ int ALIGN_DISTRIBUTE_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
if( !GetSelections( itemsToAlign, locked_items,
[]( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetBottom() < right.second.GetBottom() );
return ( left.second.GetBottom() > right.second.GetBottom() );
} ) )
{
return 0;
@ -365,7 +365,7 @@ int ALIGN_DISTRIBUTE_TOOL::doAlignRight()
if( !GetSelections( itemsToAlign, locked_items,
[]( const std::pair<BOARD_ITEM*, BOX2I> left, const std::pair<BOARD_ITEM*, BOX2I> right)
{
return ( left.second.GetRight() < right.second.GetRight() );
return ( left.second.GetRight() > right.second.GetRight() );
} ) )
{
return 0;