← Back to team overview

kicad-developers team mailing list archive

[PATCH 4/5] Schematic Cleanup: Introduce shorthand for rhs line/junction tests

 

---
 eeschema/sch_screen.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index 182bba7..52e86f1 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -449,7 +449,12 @@ bool SCH_SCREEN::SchematicCleanUp()
             if( testItem == item )
                 continue;
 
-            if( lhs_isLine && ( testItem->Type() == SCH_LINE_T ) )
+            const auto rhs_type = testItem->Type();
+
+            const bool rhs_isLine = ( rhs_type == SCH_LINE_T );
+            const bool rhs_isJunction = (rhs_type == SCH_JUNCTION_T );
+
+            if( lhs_isLine && rhs_isLine )
             {
                 SCH_LINE* line = (SCH_LINE*) item;
 
@@ -462,7 +467,7 @@ bool SCH_SCREEN::SchematicCleanUp()
                     modified = true;
                 }
             }
-            else if ( ( lhs_isJunction && ( testItem->Type() == SCH_JUNCTION_T ) ) )
+            else if ( lhs_isJunction && rhs_isJunction )
             {
                 if ( testItem->HitTest( item->GetPosition() ) )
                 {

Follow ups

References