From f73039cb185b928bfcf0b5bc833ce790432c428c Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 25 Feb 2021 16:21:33 -0800 Subject: [PATCH] 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 --- eeschema/sch_screen.cpp | 21 +++++++-------------- eeschema/sch_text.cpp | 3 +++ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 87854e477a..064cd9d73a 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -490,16 +490,14 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer ) SCH_SHEET_PIN* sheetPin = GetSheetPin( aPosition ); - if( sheetPin && SCH_CONNECTION::MightBeBusLabel( sheetPin->GetText() ) - && sheetPin->IsConnected( aPosition ) ) + if( sheetPin && sheetPin->IsConnected( aPosition ) ) { return true; } SCH_TEXT* label = GetLabel( aPosition ); - if( label && SCH_CONNECTION::MightBeBusLabel( label->GetText() ) - && label->IsConnected( aPosition ) && label->Type() != SCH_LABEL_T ) + if( label && label->IsConnected( aPosition ) ) { return true; } @@ -515,13 +513,10 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer ) case LAYER_WIRE: { - if( GetItem( aPosition, Mils2iu( 6 ), SCH_BUS_WIRE_ENTRY_T) ) + if( GetItem( aPosition, 1, SCH_BUS_WIRE_ENTRY_T) ) return true; - if( GetItem( aPosition, Mils2iu( 6 ), SCH_BUS_BUS_ENTRY_T) ) - return true; - - if( GetItem( aPosition, Schematic()->Settings().m_JunctionSize, SCH_JUNCTION_T ) ) + if( GetItem( aPosition, 1, SCH_JUNCTION_T ) ) return true; if( GetPin( aPosition, NULL, true ) ) @@ -530,18 +525,16 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer ) if( GetWire( aPosition ) ) return true; - SCH_TEXT* label = GetLabel( aPosition ); + SCH_TEXT* label = GetLabel( aPosition, 1 ); - if( label && !SCH_CONNECTION::MightBeBusLabel( label->GetText() ) - && label->IsConnected( aPosition ) && label->Type() != SCH_LABEL_T ) + if( label && label->IsConnected( aPosition ) ) { return true; } SCH_SHEET_PIN* sheetPin = GetSheetPin( aPosition ); - if( sheetPin && sheetPin->IsConnected( aPosition ) - && !SCH_CONNECTION::MightBeBusLabel( sheetPin->GetText() ) ) + if( sheetPin && sheetPin->IsConnected( aPosition ) ) { return true; } diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index e3ac7fa6a6..a7aab148e5 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -810,6 +810,9 @@ const EDA_RECT SCH_LABEL::GetBoundingBox() const rect.Normalize(); } + // Labels have a position point that is outside of the TextBox + rect.Merge( GetPosition() ); + return rect; }