Fix bug in JunctionNeeded and selection around adding/removing junctions.
When checking for 3 or more connections, at least one of them must be a pin. Otherwise we need to fall down to the next check which also ensures that at least one of them is not parallel. Fixes: lp:1841458 * https://bugs.launchpad.net/kicad/+bug/1841458
This commit is contained in:
parent
f204208667
commit
7ad98b8a7d
|
@ -138,6 +138,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
|
|||
SCH_ITEM* item = NULL;
|
||||
SCH_ITEM* secondItem = NULL;
|
||||
PICKED_ITEMS_LIST itemList;
|
||||
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
|
||||
|
||||
if( aScreen == nullptr )
|
||||
aScreen = GetScreen();
|
||||
|
@ -215,7 +216,12 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
|
|||
remove_item( item );
|
||||
remove_item( secondItem );
|
||||
itemList.PushItem( ITEM_PICKER( line, UR_NEW ) );
|
||||
|
||||
AddToScreen( line, aScreen );
|
||||
|
||||
if( line->IsSelected() )
|
||||
selectionTool->AddItemToSel( line, true /*quiet mode*/ );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -230,8 +236,13 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
|
|||
secondItem = item->Next();
|
||||
|
||||
if( item->GetEditFlags() & STRUCT_DELETED )
|
||||
{
|
||||
if( item->IsSelected() )
|
||||
selectionTool->RemoveItemFromSel( item, true /*quiet mode*/ );
|
||||
|
||||
RemoveFromScreen( item, aScreen );
|
||||
}
|
||||
}
|
||||
|
||||
if( itemList.GetCount() )
|
||||
SaveCopyInUndoList( itemList, UR_DELETED, true );
|
||||
|
@ -331,6 +342,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
|
|||
{
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
PICKED_ITEMS_LIST itemList;
|
||||
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
|
||||
|
||||
auto remove_item = [ & ]( SCH_ITEM* aItem ) -> void
|
||||
{
|
||||
|
@ -372,7 +384,12 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
|
|||
remove_item( item );
|
||||
remove_item( secondItem );
|
||||
itemList.PushItem( ITEM_PICKER( line, UR_NEW ) );
|
||||
|
||||
AddToScreen( line );
|
||||
|
||||
if( line->IsSelected() )
|
||||
selectionTool->AddItemToSel( line, true /*quiet mode*/ );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -386,8 +403,13 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
|
|||
nextitem = item->Next();
|
||||
|
||||
if( item->GetEditFlags() & STRUCT_DELETED )
|
||||
{
|
||||
if( item->IsSelected() )
|
||||
selectionTool->RemoveItemFromSel( item, true /*quiet mode*/ );
|
||||
|
||||
RemoveFromScreen( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -408,7 +408,7 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew )
|
|||
//
|
||||
|
||||
// If there are three or more endpoints
|
||||
if( pin_count + end_count[0] > 2 )
|
||||
if( pin_count && pin_count + end_count[0] > 2 )
|
||||
return true;
|
||||
|
||||
// If there is at least one segment that ends on a non-parallel line or
|
||||
|
|
Loading…
Reference in New Issue