diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 0f84d13037..ab99fa3d0a 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -199,12 +199,7 @@ bool isEdge( const PNS::ITEM* aItem ) { const BOARD_ITEM *parent = aItem->Parent(); - if( parent ) - { - return parent->GetLayer() == Edge_Cuts || parent->GetLayer () == Margin; - } - - return false; + return parent && ( parent->IsOnLayer( Edge_Cuts ) || parent->IsOnLayer( Margin ) ); } diff --git a/pcbnew/tools/pcb_grid_helper.cpp b/pcbnew/tools/pcb_grid_helper.cpp index 90f29d663a..85cffa4775 100644 --- a/pcbnew/tools/pcb_grid_helper.cpp +++ b/pcbnew/tools/pcb_grid_helper.cpp @@ -520,15 +520,29 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos for( PAD* pad : footprint->Pads() ) { - // Getting pads from the footprint requires re-checking that the pad is shown - if( ( aFrom || m_magneticSettings->pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS ) - && pad->GetBoundingBox().Contains( wxPoint( aRefPos.x, aRefPos.y ) ) - && view->IsVisible( pad ) - && ( !isHighContrast || activeLayers.count( pad->GetLayer() ) ) - && pad->ViewGetLOD( pad->GetLayer(), view ) < view->GetScale() ) + if( !aFrom && m_magneticSettings->pads != MAGNETIC_OPTIONS::CAPTURE_ALWAYS ) + continue; + + if( !view->IsVisible( pad ) || !pad->GetBoundingBox().Contains( aRefPos ) ) + continue; + + // Getting pads from a footprint requires re-checking that the pads are shown + bool onActiveLayer = !isHighContrast; + bool isLODVisible = false; + + for( PCB_LAYER_ID layer : pad->GetLayerSet().Seq() ) { - handlePadShape( pad ); - break; + if( !onActiveLayer && activeLayers.count( layer ) ) + onActiveLayer = true; + + if( !isLODVisible && pad->ViewGetLOD( layer, view ) < view->GetScale() ) + isLODVisible = true; + + if( onActiveLayer && isLODVisible ) + { + handlePadShape( pad ); + break; + } } }