Replace previous hidden text commit with a LOD-based one.

This commit is contained in:
Jeff Young 2018-03-15 10:59:59 +00:00
parent e14a7c928c
commit d9d9a54aa8
2 changed files with 10 additions and 20 deletions

View File

@ -465,16 +465,12 @@ const BOX2I TEXTE_MODULE::ViewBBox() const
void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
{ {
PCB_LAYER_ID nativeLayer = GetLayer(); if( IsVisible() )
aLayers[0] = GetLayer();
else
aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
aCount = 1; aCount = 1;
if( IsVisible() )
aLayers[0] = nativeLayer;
else if ( GetBoard()->IsLayerVisible( nativeLayer ) )
aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
else
aCount = 0;
} }
@ -485,6 +481,11 @@ unsigned int TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
if( !aView ) if( !aView )
return 0; return 0;
// Hidden text gets put on the LAYER_MOD_TEXT_INVISIBLE for rendering, but
// should only render if its native layer is visible.
if( !aView->IsLayerVisible( GetLayer() ) )
return HIDE;
// Handle Render tab switches // Handle Render tab switches
if( ( m_Type == TEXT_is_VALUE || m_Text == wxT( "%V" ) ) if( ( m_Type == TEXT_is_VALUE || m_Text == wxT( "%V" ) )
&& !aView->IsLayerVisible( LAYER_MOD_VALUES ) ) && !aView->IsLayerVisible( LAYER_MOD_VALUES ) )

View File

@ -655,18 +655,7 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas(); EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas ) if( galCanvas )
{ galCanvas->GetView()->SetLayerVisible( aLayer, isVisible );
KIGFX::VIEW* view = galCanvas->GetView();
view->SetLayerVisible( aLayer, isVisible );
// Special case hidden text which can move back and forth from the hidden layer.
view->UpdateAllItemsConditionally( KIGFX::LAYERS, []( KIGFX::VIEW_ITEM* aItem )
{
TEXTE_MODULE* modText = dynamic_cast<TEXTE_MODULE*>( aItem );
return( modText && !modText->IsVisible() );
} );
}
if( isFinal ) if( isFinal )
myframe->GetCanvas()->Refresh(); myframe->GetCanvas()->Refresh();