diff --git a/pcbnew/fp_text.cpp b/pcbnew/fp_text.cpp index bbf967c63e..503e6c4afd 100644 --- a/pcbnew/fp_text.cpp +++ b/pcbnew/fp_text.cpp @@ -32,6 +32,7 @@ #include #include #include +#include FP_TEXT::FP_TEXT( FOOTPRINT* aParentFootprint, TEXT_TYPE text_type ) : BOARD_ITEM( aParentFootprint, PCB_FP_TEXT_T ), @@ -360,6 +361,8 @@ void FP_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const { constexpr double HIDE = (double)std::numeric_limits::max(); + RENDER_SETTINGS* renderSettings = aView->GetPainter()->GetSettings(); + COLOR4D backgroundColor = renderSettings->GetLayerColor( LAYER_PCB_BACKGROUND ); if( !aView ) return 0.0; @@ -370,13 +373,23 @@ double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const return HIDE; // Handle Render tab switches - if( ( m_Type == TEXT_is_VALUE || GetText() == wxT( "${VALUE}" ) ) - && !aView->IsLayerVisible( LAYER_MOD_VALUES ) ) - return HIDE; + if( m_Type == TEXT_is_VALUE || GetText() == wxT( "${VALUE}" ) ) + { + if( !aView->IsLayerVisible( LAYER_MOD_VALUES ) + || renderSettings->GetLayerColor( LAYER_MOD_VALUES ) == backgroundColor ) + { + return HIDE; + } + } - if( ( m_Type == TEXT_is_REFERENCE || GetText() == wxT( "${REFERENCE}" ) ) - && !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) ) - return HIDE; + if( m_Type == TEXT_is_REFERENCE || GetText() == wxT( "${REFERENCE}" ) ) + { + if( !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) + || renderSettings->GetLayerColor( LAYER_MOD_REFERENCES ) == backgroundColor ) + { + return HIDE; + } + } if( !IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) ) return HIDE;