Fix some layer visibility behavior
This commit is contained in:
parent
050489d719
commit
cc5c5010f0
|
@ -305,9 +305,9 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin
|
|||
long visibleLayers = myframe->GetVisibleLayers();
|
||||
|
||||
if( isVisible )
|
||||
visibleLayers |= 1 << aLayer;
|
||||
visibleLayers |= 1 << ( aLayer - GERBVIEW_LAYER_ID_START );
|
||||
else
|
||||
visibleLayers &= ~( 1 << aLayer );
|
||||
visibleLayers &= ~( 1 << ( aLayer - GERBVIEW_LAYER_ID_START ) );
|
||||
|
||||
myframe->SetVisibleLayers( visibleLayers );
|
||||
|
||||
|
|
|
@ -677,7 +677,23 @@ bool GERBVIEW_FRAME::IsElementVisible( GERBVIEW_LAYER_ID aItemIdVisible ) const
|
|||
|
||||
long GERBVIEW_FRAME::GetVisibleLayers() const
|
||||
{
|
||||
return -1; // TODO
|
||||
long layerMask = 0;
|
||||
|
||||
if( auto canvas = GetGalCanvas() )
|
||||
{
|
||||
// NOTE: This assumes max 32 drawlayers!
|
||||
for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
|
||||
{
|
||||
if( canvas->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( i ) ) )
|
||||
layerMask |= ( 1 << i );
|
||||
}
|
||||
|
||||
return layerMask;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue