From 5cad4ad8d09f2da181aa948d71ea75e18d8fe956 Mon Sep 17 00:00:00 2001
From: JamesJCode <13408010-JamesJCode@users.noreply.gitlab.com>
Date: Fri, 10 Jan 2025 11:23:56 +0000
Subject: [PATCH] Multichannel: Don't include footprints outside of reference
 area

---
 pcbnew/tools/multichannel_tool.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pcbnew/tools/multichannel_tool.cpp b/pcbnew/tools/multichannel_tool.cpp
index 578c9943fd..59eabc00df 100644
--- a/pcbnew/tools/multichannel_tool.cpp
+++ b/pcbnew/tools/multichannel_tool.cpp
@@ -883,6 +883,10 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( TMATCH::COMPONENT_MATCHES& aMatche
                 continue;
             }
 
+            // Ignore footprints outside of the rule area
+            if( !refFP->GetEffectiveShape( refFP->GetLayer() )->Collide( &refPoly, 0 ) )
+                continue;
+
             if( targetFP->IsLocked() && !aOpts.m_includeLockedItems )
                 continue;