From 61cfe53be1375837cd9358c9c483317143c90264 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 14 Oct 2022 16:14:08 -0700 Subject: [PATCH] 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 697056fa7e84abf5665565c85d3fa422ea54703e) --- pcbnew/tools/placement_tool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/placement_tool.cpp b/pcbnew/tools/placement_tool.cpp index 9b798dbc01..18ea6ddf32 100644 --- a/pcbnew/tools/placement_tool.cpp +++ b/pcbnew/tools/placement_tool.cpp @@ -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;