Schematic: select connections working for multiple selection

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/11022
This commit is contained in:
Mike Williams 2023-08-03 11:27:29 -04:00
parent 22c609fb7b
commit 457e58d0d5
1 changed files with 22 additions and 15 deletions

View File

@ -1571,30 +1571,37 @@ int EE_SELECTION_TOOL::SelectConnection( const TOOL_EVENT& aEvent )
if( m_selection.Empty() )
return 0;
SCH_LINE* line = (SCH_LINE*) m_selection.Front();
unsigned done = false;
m_frame->GetScreen()->ClearDrawingState();
std::set<SCH_ITEM*> conns = m_frame->GetScreen()->MarkConnections( line, false );
for( SCH_ITEM* item : conns )
for( EDA_ITEM* selItem : m_selection.GetItems() )
{
if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T,
SCH_ITEM_LOCATE_GRAPHIC_LINE_T } )
&& !item->IsSelected() )
if( selItem->Type() != SCH_LINE_T )
continue;
SCH_LINE* line = static_cast<SCH_LINE*>( selItem );
std::set<SCH_ITEM*> conns = m_frame->GetScreen()->MarkConnections( line, false );
for( SCH_ITEM* item : conns )
{
done = true;
if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T,
SCH_ITEM_LOCATE_GRAPHIC_LINE_T } )
&& !item->IsSelected() )
{
done = true;
}
select( item );
}
select( item );
}
if( !done )
{
conns = m_frame->GetScreen()->MarkConnections( line, true );
if( !done )
{
conns = m_frame->GetScreen()->MarkConnections( line, true );
for( SCH_ITEM* item : conns )
select( item );
for( SCH_ITEM* item : conns )
select( item );
}
}
if( m_selection.GetSize() > 1 )