Fix junction logic when splitting two wires.

This commit is contained in:
Jeff Young 2021-02-23 21:39:15 +00:00
parent c0487e5c87
commit 7e2b0e63f1
1 changed files with 4 additions and 8 deletions

View File

@ -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 )