Handle hidden text changing layers when native layer toggled.
Fixes: lp:1553459 * https://bugs.launchpad.net/kicad/+bug/1553459
This commit is contained in:
parent
8904b2e046
commit
a75ead5efd
|
@ -465,16 +465,16 @@ const BOX2I TEXTE_MODULE::ViewBBox() const
|
|||
|
||||
void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
if( !IsVisible() ) // Hidden text
|
||||
aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
|
||||
//else if( IsFrontLayer( m_Layer ) )
|
||||
//aLayers[0] = LAYER_MOD_TEXT_FR;
|
||||
//else if( IsBackLayer( m_Layer ) )
|
||||
//aLayers[0] = LAYER_MOD_TEXT_BK;
|
||||
else
|
||||
aLayers[0] = GetLayer();
|
||||
PCB_LAYER_ID nativeLayer = GetLayer();
|
||||
|
||||
aCount = 1;
|
||||
|
||||
if( IsVisible() )
|
||||
aLayers[0] = nativeLayer;
|
||||
else if ( GetBoard()->IsLayerVisible( nativeLayer ) )
|
||||
aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
|
||||
else
|
||||
aCount = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <pcb_display_options.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <layer_widget.h>
|
||||
#include <class_text_mod.h>
|
||||
#include <widgets/indicator_icon.h>
|
||||
#include <macros.h>
|
||||
#include <menus_helpers.h>
|
||||
|
@ -654,7 +655,18 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal
|
|||
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
|
||||
|
||||
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 )
|
||||
myframe->GetCanvas()->Refresh();
|
||||
|
|
Loading…
Reference in New Issue