Update track, via and pad clearances for the current layer.

Fixes https://gitlab.com/kicad/code/kicad/issues/5797
This commit is contained in:
Jeff Young 2020-09-27 21:32:42 +01:00
parent 09ab269770
commit db1d3ea710
2 changed files with 25 additions and 8 deletions

View File

@ -1012,8 +1012,29 @@ void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
m_appearancePanel->OnLayerChanged();
m_toolManager->RunAction( PCB_ACTIONS::layerChanged ); // notify other tools
GetCanvas()->SetFocus(); // allow capture of hotkeys
GetCanvas()->SetFocus(); // allow capture of hotkeys
GetCanvas()->SetHighContrastLayer( aLayer );
// Clearances could be layer-dependent so redraw them when the active layer is changed
if( GetDisplayOptions().m_DisplayPadIsol )
{
GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT,
[]( KIGFX::VIEW_ITEM* aItem ) -> bool
{
return dynamic_cast<D_PAD*>( aItem ) != nullptr;
});
}
// Clearances could be layer-dependent so redraw them when the active layer is changed
if( GetDisplayOptions().m_ShowTrackClearanceMode == PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS )
{
GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT,
[]( KIGFX::VIEW_ITEM* aItem ) -> bool
{
return dynamic_cast<TRACK*>( aItem ) != nullptr;
});
}
GetCanvas()->Refresh();
}

View File

@ -529,12 +529,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
if( ( m_pcbSettings.m_clearance & clearanceFlags ) == clearanceFlags )
{
int clearance;
if( m_pcbSettings.m_hiContrastEnabled )
clearance = aTrack->GetClearance( m_pcbSettings.GetActiveLayer() );
else
clearance = aTrack->GetClearance( ToLAYER_ID( aLayer ) );
int clearance = aTrack->GetClearance( m_pcbSettings.GetActiveLayer() );
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
m_gal->SetIsFill( false );
@ -941,7 +936,8 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m_gal->SetIsStroke( true );
m_gal->SetIsFill( false );
m_gal->SetStrokeColor( color );
int clearance = aPad->GetClearance( aPad->GetLayer() );
int clearance = aPad->GetClearance( m_pcbSettings.GetActiveLayer() );
const std::shared_ptr<SHAPE_COMPOUND> shapes =
std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );