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

(cherry picked from commit 697056fa7e)
This commit is contained in:
Seth Hillbrand 2022-10-14 16:14:08 -07:00
parent 535982f245
commit 61cfe53be1
1 changed files with 2 additions and 2 deletions

View File

@ -244,7 +244,7 @@ int ALIGN_DISTRIBUTE_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
if( !GetSelections( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
{
return ( left.second.GetBottom() < right.second.GetBottom() );
return ( left.second.GetBottom() > right.second.GetBottom() );
} ) )
{
return 0;
@ -364,7 +364,7 @@ int ALIGN_DISTRIBUTE_TOOL::doAlignRight()
if( !GetSelections( itemsToAlign, locked_items,
[]( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
{
return ( left.second.GetRight() < right.second.GetRight() );
return ( left.second.GetRight() > right.second.GetRight() );
} ) )
{
return 0;