Broaden reset-sizes-after-layer-switch algorithm.

Fixes https://gitlab.com/kicad/code/kicad/issues/12576

(cherry picked from commit 40ad5b6de3)
This commit is contained in:
Jeff Young 2022-10-06 15:49:58 +01:00
parent 705570923e
commit 47547713de
2 changed files with 9 additions and 3 deletions

View File

@ -618,10 +618,13 @@ void ROUTER_TOOL::switchLayerOnViaPlacement()
m_router->SwitchLayer( *newLayer );
m_lastTargetLayer = *newLayer;
// NB: track and diff-pair values may have changed if layer-specific rules are in play
updateSizesAfterLayerSwitch( ToLAYER_ID( *newLayer ) );
}
PCB_LAYER_ID targetLayer = ToLAYER_ID( *newLayer );
std::vector<int> nets = m_router->GetCurrentNets();
void ROUTER_TOOL::updateSizesAfterLayerSwitch( PCB_LAYER_ID targetLayer )
{
std::vector<int> nets = m_router->GetCurrentNets();
PNS::SIZES_SETTINGS sizes = m_router->Sizes();
BOARD_DESIGN_SETTINGS& bds = board()->GetDesignSettings();
@ -829,6 +832,7 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia )
if( !aForceVia && m_router && m_router->SwitchLayer( targetLayer ) )
{
updateSizesAfterLayerSwitch( targetLayer );
updateEndItem( aEvent );
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
return 0;
@ -1511,6 +1515,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) )
{
m_router->SwitchLayer( frame->GetActiveLayer() );
updateSizesAfterLayerSwitch( frame->GetActiveLayer() );
updateStartItem( *evt );
}
else if( evt->IsKeyPressed() )

View File

@ -75,6 +75,7 @@ private:
int getStartLayer( const PNS::ITEM* aItem );
void switchLayerOnViaPlacement();
void updateSizesAfterLayerSwitch( PCB_LAYER_ID targetLayer );
int onLayerCommand( const TOOL_EVENT& aEvent );
int onViaCommand( const TOOL_EVENT& aEvent );