Fix asserts.

This commit is contained in:
Jeff Young 2022-02-23 23:47:55 +00:00
parent 8ef4ef8d96
commit f076d07e9e
2 changed files with 23 additions and 14 deletions

View File

@ -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 ) );
}

View File

@ -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;
}
}
}