Always select whole lines with greedy selection.

Fixes https://gitlab.com/kicad/code/kicad/issues/10869
This commit is contained in:
Jeff Young 2022-10-10 20:16:54 +01:00
parent 83310659fd
commit cb20a39693
1 changed files with 46 additions and 44 deletions

View File

@ -1255,13 +1255,13 @@ bool EE_SELECTION_TOOL::selectMultiple()
* Left > Right : Select objects that are fully enclosed by selection
* Right > Left : Select objects that are crossed by selection
*/
bool isWindowSelection = width >= 0;
bool isGreedy = width < 0;
if( view->IsMirroredX() )
isWindowSelection = !isWindowSelection;
isGreedy = !isGreedy;
m_frame->GetCanvas()->SetCurrentCursor( isWindowSelection ? KICURSOR::SELECT_WINDOW
: KICURSOR::SELECT_LASSO );
m_frame->GetCanvas()->SetCurrentCursor( isGreedy ? KICURSOR::SELECT_LASSO
: KICURSOR::SELECT_WINDOW );
if( evt->IsCancelInteractive() || evt->IsActivate() )
{
@ -1336,7 +1336,9 @@ bool EE_SELECTION_TOOL::selectMultiple()
bool anyAdded = false;
bool anySubtracted = false;
auto selectItem = [&]( EDA_ITEM* aItem )
auto selectItem =
[&]( EDA_ITEM* aItem )
{
EDA_ITEM_FLAGS flags = 0;
@ -1345,10 +1347,10 @@ bool EE_SELECTION_TOOL::selectMultiple()
{
SCH_LINE* line = (SCH_LINE*) aItem;
if( selectionRect.Contains( line->GetStartPoint() ) )
if( selectionRect.Contains( line->GetStartPoint() ) || isGreedy )
flags |= STARTPOINT;
if( selectionRect.Contains( line->GetEndPoint() ) )
if( selectionRect.Contains( line->GetEndPoint() ) || isGreedy )
flags |= ENDPOINT;
@ -1384,7 +1386,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
if( m_frame->GetRenderSettings()->m_ShowPinsElectricalType )
item->SetFlags( SHOW_ELEC_TYPE );
if( Selectable( item ) && item->HitTest( selectionRect, isWindowSelection ) )
if( Selectable( item ) && item->HitTest( selectionRect, !isGreedy ) )
{
item->SetFlags( CANDIDATE );
flaggedItems.push_back( item );
@ -1401,7 +1403,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
if( Selectable( item )
&& !item->GetParent()->HasFlag( CANDIDATE )
&& item->HitTest( selectionRect, isWindowSelection ) )
&& item->HitTest( selectionRect, !isGreedy ) )
{
selectItem( item );
}