Gerber viewer: move layer colors with layers

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/10600
This commit is contained in:
Mike Williams 2022-07-25 13:37:54 -04:00
parent 1460442a80
commit 75ed6b3ce7
1 changed files with 10 additions and 0 deletions

View File

@ -524,6 +524,8 @@ void GERBVIEW_FRAME::SortLayersByX2Attributes()
void GERBVIEW_FRAME::RemapLayers( std::unordered_map<int, int> remapping )
{
std::unordered_map<int, COLOR4D> newColors;
ReFillLayerWidget();
syncLayerBox( true );
@ -533,9 +535,17 @@ void GERBVIEW_FRAME::RemapLayers( std::unordered_map<int, int> remapping )
{
view_remapping[ GERBER_DRAW_LAYER( entry.first ) ] = GERBER_DRAW_LAYER( entry.second );
view_remapping[ GERBER_DCODE_LAYER( entry.first ) ] = GERBER_DCODE_LAYER( entry.second );
newColors[entry.second] = GetLayerColor( GERBER_DRAW_LAYER( entry.first ) );
}
GetCanvas()->GetView()->ReorderLayerData( view_remapping );
for( const std::pair<const int, COLOR4D>& entry : newColors )
{
m_LayersManager->SetLayerColor( entry.first, entry.second );
SetLayerColor( GERBER_DRAW_LAYER( entry.first ), entry.second );
}
GetCanvas()->Refresh();
}