Add create-wire logic to labels.

Fixes https://gitlab.com/kicad/code/kicad/issues/11768

(cherry picked from commit 29900cad34)
This commit is contained in:
Jeff Young 2022-06-10 21:52:23 +01:00
parent 0f882d91e5
commit 0580fc6819
1 changed files with 22 additions and 0 deletions

View File

@ -637,7 +637,9 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoin
newWire = new SCH_LINE( aPoint, LAYER_BUS );
}
else
{
newWire = new SCH_LINE( aPoint, LAYER_WIRE );
}
newWire->SetFlags( IS_NEW );
m_frame->AddToScreen( newWire, m_frame->GetScreen() );
@ -685,6 +687,26 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoin
}
}
}
else if( test->IsConnected( aPoint ) && !newWire )
{
// Add a new wire between the label and the selected item so the selected item
// can be dragged.
if( test->GetLayer() == LAYER_BUS_JUNCTION
|| aOriginalItem->GetLayer() == LAYER_BUS )
{
newWire = new SCH_LINE( aPoint, LAYER_BUS );
}
else
{
newWire = new SCH_LINE( aPoint, LAYER_WIRE );
}
newWire->SetFlags( IS_NEW );
m_frame->AddToScreen( newWire, m_frame->GetScreen() );
newWire->SetFlags( SELECTED_BY_DRAG | STARTPOINT );
aList.push_back( newWire );
}
break;