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;