diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 87ac84c656..d72b562324 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -211,24 +211,22 @@ bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector& aI switch( each_item.GetType() ) { case WIRE_START_END: - case BUS_START_END: - seg_start = each_item.GetPosition(); - break; - case WIRE_END_END: - if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) ) + if( m_pos == each_item.GetPosition() ) has_wire[0] = true; - - if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_End() ) ) + else if( m_End() == each_item.GetPosition() ) has_wire[1] = true; break; + case BUS_START_END: + seg_start = each_item.GetPosition(); + break; + case BUS_END_END: if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_pos ) ) has_bus[0] = true; - - if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_End() ) ) + else if( IsPointOnSegment( seg_start, each_item.GetPosition(), m_End() ) ) has_bus[1] = true; break; @@ -238,10 +236,8 @@ bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector& aI } } - /** - * A bus-wire entry is connected at both ends if it has a bus and a wire on its - * ends. Otherwise, we connect only one end (in the case of a wire-wire or bus-bus) - */ + // A bus-wire entry is connected at both ends if it has a bus and a wire on its + // ends. Otherwise, we connect only one end (in the case of a wire-wire or bus-bus) if( ( has_wire[0] && has_bus[1] ) || ( has_wire[1] && has_bus[0] ) ) m_isDanglingEnd = m_isDanglingStart = false; else if( has_wire[0] || has_bus[0] ) diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index adcddce95a..9250512f3f 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -473,7 +473,9 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi if( test->IsSelected() || !test->IsConnectable() || !test->CanConnect( aOriginalItem ) ) continue; - switch( test->Type() ) + KICAD_T testType = test->Type(); + + switch( testType ) { case SCH_LINE_T: { @@ -548,10 +550,27 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi { test->SetFlags( TEMP_SELECTED ); aList.push_back( test ); + + // A bus entry needs its wire & label as well + if( testType == SCH_BUS_WIRE_ENTRY_T || testType == SCH_BUS_BUS_ENTRY_T ) + { + std::vector ends; + wxPoint otherEnd; + + test->GetConnectionPoints( ends ); + + if( ends[0] == point ) + otherEnd = ends[1]; + else + otherEnd = ends[0]; + + getConnectedDragItems( (SCH_ITEM*) test, otherEnd, m_dragAdditions ); + } break; } } } + break; default: