From 078a01976f988a64a83631a80ffa21fcbf7fc462 Mon Sep 17 00:00:00 2001 From: JamesJCode <13408010-JamesJCode@users.noreply.gitlab.com> Date: Fri, 14 Mar 2025 20:55:44 +0000 Subject: [PATCH] Include child SCH_PINs in SCH_RULE_AREA item caches Fixes https://gitlab.com/kicad/code/kicad/-/issues/20332 --- eeschema/sch_rule_area.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/eeschema/sch_rule_area.cpp b/eeschema/sch_rule_area.cpp index 6800ac312d..bfc30f38d4 100644 --- a/eeschema/sch_rule_area.cpp +++ b/eeschema/sch_rule_area.cpp @@ -227,9 +227,7 @@ void SCH_RULE_AREA::RefreshContainedItemsAndDirectives( assert( labelConnectionPoints.size() == 1 ); if( GetPolyShape().CollideEdge( labelConnectionPoints[0], nullptr, 5 ) ) - { addDirective( label, view ); - } } // If directives have changed, we need to force an update of the contained items connectivity @@ -248,9 +246,7 @@ void SCH_RULE_AREA::RefreshContainedItemsAndDirectives( lineItem->GetLineWidth() ); if( GetPolyShape().Collide( &lineSeg ) ) - { addContainedItem( areaItem ); - } } else if( areaItem->IsType( { SCH_PIN_T, SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T } ) ) @@ -259,13 +255,20 @@ void SCH_RULE_AREA::RefreshContainedItemsAndDirectives( assert( connectionPoints.size() == 1 ); if( GetPolyShape().Collide( connectionPoints[0] ) ) - { addContainedItem( areaItem ); - } } else if( areaItem->IsType( { SCH_SYMBOL_T } ) ) { addContainedItem( areaItem ); + + // Add child pins which are within the rule area + const SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( areaItem ); + + for( SCH_PIN* pin : symbol->GetPins() ) + { + if( GetPolyShape().Collide( pin->GetPosition() ) ) + addContainedItem( pin ); + } } } }