Fix via placement when pressing V before starting to route
When the user presses V to place a via before clicking to start routing,
the via placement intent was being ignored because ToggleViaPlacement()
only works during active routing. The via would only appear if the user
moved the mouse after pressing V.
Add a flag to remember when V is pressed in pre-routing state and enable
via placement after routing starts.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19814
(cherry picked from commit f6a0b6b836)
This commit is contained in:
@@ -209,7 +209,8 @@ ROUTER_TOOL::ROUTER_TOOL() :
|
||||
m_lastTargetLayer( UNDEFINED_LAYER ),
|
||||
m_originalActiveLayer( UNDEFINED_LAYER ),
|
||||
m_inRouterTool( false ),
|
||||
m_inRouteSelected( false )
|
||||
m_inRouteSelected( false ),
|
||||
m_startWithVia( false )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1311,6 +1312,13 @@ void ROUTER_TOOL::performRouting( VECTOR2D aStartPosition )
|
||||
// Set initial cursor
|
||||
setCursor();
|
||||
|
||||
// If the user pressed 'V' before starting to route, enable via placement now
|
||||
if( m_startWithVia )
|
||||
{
|
||||
m_startWithVia = false;
|
||||
handleLayerSwitch( ACT_PlaceThroughVia.MakeEvent(), true );
|
||||
}
|
||||
|
||||
while( TOOL_EVENT* evt = Wait() )
|
||||
{
|
||||
setCursor();
|
||||
@@ -1767,6 +1775,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_router->SetMode( mode );
|
||||
m_cancelled = false;
|
||||
m_startWithVia = false;
|
||||
|
||||
if( aEvent.HasPosition() )
|
||||
m_toolMgr->PrimeTool( aEvent.Position() );
|
||||
@@ -1834,6 +1843,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else if( evt->IsAction( &ACT_PlaceThroughVia ) )
|
||||
{
|
||||
m_startWithVia = true;
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::layerToggle );
|
||||
}
|
||||
else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) )
|
||||
|
||||
@@ -103,6 +103,8 @@ private:
|
||||
|
||||
bool m_inRouterTool; // Re-entrancy guard
|
||||
bool m_inRouteSelected;
|
||||
|
||||
bool m_startWithVia; // User pressed V before routing started
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user