mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Try an "add wires" strategy instead of trying to figure out what to pick up and what to anchor.
Fixes: lp:1831199 * https://bugs.launchpad.net/kicad/+bug/1831199
This commit is contained in:
parent
d7774b94fc
commit
1dd1ddf83b
@ -200,10 +200,10 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||||||
//
|
//
|
||||||
for( SCH_ITEM* it = m_frame->GetScreen()->GetDrawItems(); it; it = it->Next() )
|
for( SCH_ITEM* it = m_frame->GetScreen()->GetDrawItems(); it; it = it->Next() )
|
||||||
{
|
{
|
||||||
if( it->IsSelected() )
|
|
||||||
it->SetFlags( STARTPOINT | ENDPOINT | SELECTEDNODE );
|
|
||||||
else
|
|
||||||
it->ClearFlags( STARTPOINT | ENDPOINT | SELECTEDNODE );
|
it->ClearFlags( STARTPOINT | ENDPOINT | SELECTEDNODE );
|
||||||
|
|
||||||
|
if( it->IsSelected() )
|
||||||
|
it->SetFlags( STARTPOINT | ENDPOINT );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_isDragOperation )
|
if( m_isDragOperation )
|
||||||
@ -338,7 +338,6 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
moveItem( item, delta, m_frame->GetToolId() == ID_SCH_DRAG );
|
moveItem( item, delta, m_frame->GetToolId() == ID_SCH_DRAG );
|
||||||
|
|
||||||
updateView( item );
|
updateView( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,23 +501,10 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SCH_COMPONENT_T:
|
case SCH_COMPONENT_T:
|
||||||
case SCH_NO_CONNECT_T:
|
|
||||||
case SCH_JUNCTION_T:
|
|
||||||
if( test->IsConnected( aPoint ) )
|
if( test->IsConnected( aPoint ) )
|
||||||
{
|
{
|
||||||
// Connected to a wire: anchor the connected end of the wire
|
// Add a new wire between the component and the selected item so the selected
|
||||||
if( aOriginalItem->Type() == SCH_LINE_T )
|
// item can be dragged.
|
||||||
{
|
|
||||||
SCH_LINE* originalWire = (SCH_LINE*) aOriginalItem;
|
|
||||||
|
|
||||||
if( originalWire->GetStartPoint() == aPoint )
|
|
||||||
originalWire->ClearFlags( STARTPOINT );
|
|
||||||
else if( originalWire->GetEndPoint() == aPoint )
|
|
||||||
originalWire->ClearFlags( ENDPOINT );
|
|
||||||
}
|
|
||||||
// Connected directly to a component: add a new wire and pick up the end
|
|
||||||
else if( test->Type() == SCH_COMPONENT_T)
|
|
||||||
{
|
|
||||||
SCH_LINE* newWire = new SCH_LINE( aPoint, LAYER_WIRE );
|
SCH_LINE* newWire = new SCH_LINE( aPoint, LAYER_WIRE );
|
||||||
newWire->SetFlags( IS_NEW );
|
newWire->SetFlags( IS_NEW );
|
||||||
m_frame->AddToScreen( newWire, m_frame->GetScreen() );
|
m_frame->AddToScreen( newWire, m_frame->GetScreen() );
|
||||||
@ -526,12 +512,14 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi
|
|||||||
newWire->SetFlags( SELECTEDNODE | STARTPOINT );
|
newWire->SetFlags( SELECTEDNODE | STARTPOINT );
|
||||||
aList.push_back( newWire );
|
aList.push_back( newWire );
|
||||||
}
|
}
|
||||||
// Connected to a no-connect or junction: pick it up
|
break;
|
||||||
else
|
|
||||||
{
|
case SCH_NO_CONNECT_T:
|
||||||
|
case SCH_JUNCTION_T:
|
||||||
|
// Select no-connects and junctions that are connected to items being moved.
|
||||||
|
if( test->IsConnected( aPoint ) )
|
||||||
aList.push_back( test );
|
aList.push_back( test );
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCH_LABEL_T:
|
case SCH_LABEL_T:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user