diff --git a/pcbnew/connectivity/connectivity_items.cpp b/pcbnew/connectivity/connectivity_items.cpp index a39d2adfd6..96d88c9665 100644 --- a/pcbnew/connectivity/connectivity_items.cpp +++ b/pcbnew/connectivity/connectivity_items.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KICAD, a free EDA CAD application. * * Copyright (C) 2016-2018 CERN - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * * @author Tomasz Wlostowski * @@ -265,12 +265,20 @@ bool CN_ANCHOR::IsDangling() const if( m_item->AnchorCount() == 1 ) return connected_count < minimal_count; - // Only items with multiple anchors might have additional items connected that we - // should ignore for this calculation. + // Items with multiple anchors have usually items connected to each anchor. + // We want only the item count of this anchor point + connected_count = 0; for( auto item : m_item->ConnectedItems() ) { - if( !item->Parent()->HitTest( wxPoint( Pos().x, Pos().y ) ) ) - connected_count--; + if( item->Parent()->Type() == PCB_ZONE_AREA_T ) + { + ZONE_CONTAINER* zone = static_cast( item->Parent() ); + + if( zone->HitTestFilledArea( wxPoint( Pos().x, Pos().y ) ) ) + connected_count++; + } + else if( item->Parent()->HitTest( wxPoint( Pos().x, Pos().y ) ) ) + connected_count++; } return connected_count < minimal_count;