pcbnew: switching track posture may not work on first attempt

If you drag a track out and connect to a pad then press the hotkey
to switch the track posture it may not switch because the track
posture selected when the pad was reached is different than the one
that the mouse trail placer drew. As the aspect switching is done
in the mouse trail placer it does not know that the line placer
already override the track.

To correct this, in LINE_PLACER::FlipPosture() if the aspect is not
currently manually forced then copy the current aspect from the
line placer to m_mouseTrailPlacer before calling the FlipPosture()
method of m_mouseTrailPlacer. This will only be done once per
dragging session as once the aspect is manually forced it remains
manually forced. This seems to fix the issue with no undesirable
side effects.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/12369
This commit is contained in:
Steve Bollinger 2023-05-11 23:35:21 +00:00 committed by Seth Hillbrand
parent 89aae88e96
commit 85f4f0d6c8
1 changed files with 10 additions and 0 deletions

View File

@ -1247,6 +1247,16 @@ const ITEM_SET LINE_PLACER::Traces()
void LINE_PLACER::FlipPosture()
{
// In order to fix issue 12369 get the current line placer first direction
// and copy it to the mouse trail tracer, as the current placer may have
// changed the route.
if( m_mouseTrailTracer.IsManuallyForced() == false && m_currentTrace.SegmentCount() > 0 )
{
DIRECTION_45 firstDirection( m_currentTrace.CSegment( 0 ) );
m_mouseTrailTracer.SetDefaultDirections( firstDirection, DIRECTION_45::UNDEFINED );
}
m_mouseTrailTracer.FlipPosture();
}