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

Fixes https://gitlab.com/kicad/code/kicad/issues/12576
This commit is contained in:
Jeff Young 2022-10-06 15:49:58 +01:00
parent 6927e75eae
commit 40ad5b6de3
2 changed files with 9 additions and 3 deletions

View File

@ -655,10 +655,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();
@ -875,6 +878,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;
@ -1679,6 +1683,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

@ -76,6 +76,7 @@ private:
int getStartLayer( const PNS::ITEM* aItem );
void switchLayerOnViaPlacement();
void updateSizesAfterLayerSwitch( PCB_LAYER_ID targetLayer );
bool getNearestRatnestAnchor( VECTOR2I& aPoint, LAYER_RANGE& aLayers );
int onLayerCommand( const TOOL_EVENT& aEvent );