From 7e2b0e63f19e5cef2eef6194aa0bbfe00a999646 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 23 Feb 2021 21:39:15 +0000 Subject: [PATCH] Fix junction logic when splitting two wires. --- eeschema/sch_screen.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 246bf6e3be..aae8234024 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -422,12 +422,14 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew ) for( int i : { WIRES, BUSES } ) { bool removed_overlapping = false; - bool mid_point = false; for( auto line = lines[i].begin(); line < lines[i].end(); line++ ) { + /// A line with a midpoint should be counted as two endpoints for this calculation + /// because the junction will split the line into two if there is another item + /// present at the point. if( !(*line)->IsEndPoint( aPosition ) ) - mid_point = true; + end_count[i] += 2; else end_count[i]++; @@ -443,12 +445,6 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew ) } } - /// A line with a midpoint should be counted as two endpoints for this calculation - /// because the junction will split the line into two if there is another item - /// present at the point. - if( mid_point ) - end_count[i] += 2; - ///Overlapping lines that point in the same direction should not be counted /// as extra end_points. if( removed_overlapping )