Eeschema: unconnected ends of wire entries should allow auto start wires

This commit is contained in:
Mike Williams 2021-12-30 15:05:32 -05:00 committed by Seth Hillbrand
parent 51d7b49067
commit 7c91cd73e3
2 changed files with 15 additions and 1 deletions

View File

@ -108,6 +108,12 @@ public:
void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; }
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
{
return ( GetPosition() == aPos && IsDanglingStart() )
|| ( GetEnd() == aPos && IsDanglingEnd() );
}
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override;

View File

@ -44,6 +44,7 @@
#include <sch_edit_frame.h>
#include <sch_item.h>
#include <sch_line.h>
#include <sch_bus_entry.h>
#include <sch_junction.h>
#include <sch_marker.h>
#include <sch_sheet.h>
@ -397,7 +398,14 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( ( connection && ( connection->IsNet() || connection->IsUnconnected() ) )
|| collector[0]->Type() == SCH_SYMBOL_T )
{
newEvt = EE_ACTIONS::drawWire.MakeEvent();
// For bus wire entries, we want to autostart a wire or a bus
// depending on what is connected to the other side.
auto entry = static_cast<SCH_BUS_WIRE_ENTRY*>( collector[0] );
if( ( entry != nullptr ) && ( entry->m_connected_bus_item == nullptr ) )
newEvt = EE_ACTIONS::drawBus.MakeEvent();
else
newEvt = EE_ACTIONS::drawWire.MakeEvent();
}
else if( connection && connection->IsBus() )
{