Fix wire endings both too small and too large

Junctions should only be wire endings when ending directly on the wire.
This is the requirement for netlisting, so we need to follow it in the
auto-end as well.

SCH_LABEL needs to allow ending because any wire that touches the label
will be connected, so there's a use case for this.  However, the
bounding box for local labels did not include their connection point, so
we increase that box a bit.  Note that this might have the opposite
effect to https://gitlab.com/kicad/code/kicad/-/issues/7689

Fixes https://gitlab.com/kicad/code/kicad/issues/7714
This commit is contained in:
Seth Hillbrand 2021-02-25 16:21:33 -08:00
parent c15a9e60d4
commit f73039cb18
2 changed files with 10 additions and 14 deletions

View File

@ -490,16 +490,14 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
SCH_SHEET_PIN* sheetPin = GetSheetPin( aPosition ); SCH_SHEET_PIN* sheetPin = GetSheetPin( aPosition );
if( sheetPin && SCH_CONNECTION::MightBeBusLabel( sheetPin->GetText() ) if( sheetPin && sheetPin->IsConnected( aPosition ) )
&& sheetPin->IsConnected( aPosition ) )
{ {
return true; return true;
} }
SCH_TEXT* label = GetLabel( aPosition ); SCH_TEXT* label = GetLabel( aPosition );
if( label && SCH_CONNECTION::MightBeBusLabel( label->GetText() ) if( label && label->IsConnected( aPosition ) )
&& label->IsConnected( aPosition ) && label->Type() != SCH_LABEL_T )
{ {
return true; return true;
} }
@ -515,13 +513,10 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
case LAYER_WIRE: case LAYER_WIRE:
{ {
if( GetItem( aPosition, Mils2iu( 6 ), SCH_BUS_WIRE_ENTRY_T) ) if( GetItem( aPosition, 1, SCH_BUS_WIRE_ENTRY_T) )
return true; return true;
if( GetItem( aPosition, Mils2iu( 6 ), SCH_BUS_BUS_ENTRY_T) ) if( GetItem( aPosition, 1, SCH_JUNCTION_T ) )
return true;
if( GetItem( aPosition, Schematic()->Settings().m_JunctionSize, SCH_JUNCTION_T ) )
return true; return true;
if( GetPin( aPosition, NULL, true ) ) if( GetPin( aPosition, NULL, true ) )
@ -530,18 +525,16 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
if( GetWire( aPosition ) ) if( GetWire( aPosition ) )
return true; return true;
SCH_TEXT* label = GetLabel( aPosition ); SCH_TEXT* label = GetLabel( aPosition, 1 );
if( label && !SCH_CONNECTION::MightBeBusLabel( label->GetText() ) if( label && label->IsConnected( aPosition ) )
&& label->IsConnected( aPosition ) && label->Type() != SCH_LABEL_T )
{ {
return true; return true;
} }
SCH_SHEET_PIN* sheetPin = GetSheetPin( aPosition ); SCH_SHEET_PIN* sheetPin = GetSheetPin( aPosition );
if( sheetPin && sheetPin->IsConnected( aPosition ) if( sheetPin && sheetPin->IsConnected( aPosition ) )
&& !SCH_CONNECTION::MightBeBusLabel( sheetPin->GetText() ) )
{ {
return true; return true;
} }

View File

@ -810,6 +810,9 @@ const EDA_RECT SCH_LABEL::GetBoundingBox() const
rect.Normalize(); rect.Normalize();
} }
// Labels have a position point that is outside of the TextBox
rect.Merge( GetPosition() );
return rect; return rect;
} }