From 567168fffc545936c7a46d74de1e82af9b21b015 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Wed, 16 Feb 2022 09:15:13 -0500 Subject: [PATCH] Schematic: make grabbing whole lines more intuitive Selecting end and midpoint will select whole line. Some changes for orthogonal dragging made this worse than in 6.0. Improves, but does not fully resolve: https://gitlab.com/kicad/code/kicad/-/issues/10860 --- eeschema/sch_line.h | 2 ++ eeschema/tools/ee_selection_tool.cpp | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 87a768d890..819b118a08 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -122,6 +122,8 @@ public: VECTOR2I GetStartPoint() const { return m_start; } void SetStartPoint( const VECTOR2I& aPosition ) { m_start = aPosition; } + VECTOR2I GetMidPoint() const { return ( m_start + m_end ) / 2; } + VECTOR2I GetEndPoint() const { return m_end; } void SetEndPoint( const VECTOR2I& aPosition ) { m_end = aPosition; } diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 13b49a3e24..7fb1928393 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -1270,8 +1270,12 @@ bool EE_SELECTION_TOOL::selectMultiple() line->SetFlags( ENDPOINT ); // If no ends were selected, select whole line (both ends) - if( !line->HasFlag( STARTPOINT ) && !line->HasFlag( ENDPOINT ) ) + // Also select both ends if the selection overlaps the midpoint + if( ( !line->HasFlag( STARTPOINT ) && !line->HasFlag( ENDPOINT ) ) + || selectionRect.Contains( line->GetMidPoint() ) ) + { line->SetFlags( STARTPOINT | ENDPOINT ); + } } anyAdded = true;