diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index 4e7eaa3e80..2b5aecab6f 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -184,6 +184,22 @@ COLOR4D SCH_JUNCTION::GetColor() const } +int SCH_JUNCTION::GetDiameter() const +{ + int diameter = m_diameter; + + if( diameter == 0 ) + diameter = Schematic()->Settings().m_JunctionSize; + + NETCLASSPTR netclass = NetClass(); + + if( netclass ) + diameter = std::max( diameter, KiROUND( netclass->GetWireWidth() * 1.7 ) ); + + return std::max( diameter, 1 ); +} + + bool SCH_JUNCTION::HitTest( const wxPoint& aPosition, int aAccuracy ) const { EDA_RECT rect = GetBoundingBox(); diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h index cf1e826a6c..9fc56a46c2 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -97,7 +97,7 @@ public: wxPoint GetPosition() const override { return m_pos; } void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; } - int GetDiameter() const { return m_diameter; } + int GetDiameter() const; void SetDiameter( int aDiameter ) { m_diameter = aDiameter; } COLOR4D GetColor() const; diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 6e39fc97a6..1aee3bd2bb 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -1179,10 +1179,7 @@ void SCH_PAINTER::draw( SCH_JUNCTION *aJct, int aLayer ) COLOR4D color = getRenderColor( aJct, aJct->GetLayer(), drawingShadows ); - int junctionSize = m_schSettings.m_JunctionSize / 2.0; - - if( aJct->GetDiameter() != 0 ) - junctionSize = aJct->GetDiameter() / 2; + int junctionSize = aJct->GetDiameter() / 2; m_gal->SetIsStroke( drawingShadows ); m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );