Prevent multiple single-point line solutions

Suggested by @rivimey, we test the case where both lines return singular
point lines and prevent them leaking into our drag solution

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

(cherry picked from commit 38a4894d92)
This commit is contained in:
Seth Hillbrand 2022-01-29 07:05:34 -08:00
parent 2900910cdd
commit ad84b62b63
1 changed files with 12 additions and 4 deletions

View File

@ -504,12 +504,19 @@ bool DRAGGER::tryWalkaround( NODE* aNode, LINE& aOrig, LINE& aWalk )
WALKAROUND::RESULT wr = walkaround.Route( aWalk );
if( wr.statusCcw == WALKAROUND::DONE && wr.statusCw == WALKAROUND::DONE )
{
aWalk = ( wr.lineCw.CLine().Length() < wr.lineCcw.CLine().Length() ? wr.lineCw :
wr.lineCcw );
ok = true;
if( wr.lineCw.CLine().PointCount() > 1
&& wr.lineCw.CLine().Length() < wr.lineCcw.CLine().Length() )
{
aWalk = wr.lineCw;
ok = true;
}
else if( wr.lineCcw.CLine().PointCount() > 1 )
{
aWalk = wr.lineCcw;
ok = true;
}
}
else if( wr.statusCw == WALKAROUND::DONE && wr.lineCw.CLine().PointCount() > 1 )
{
@ -521,6 +528,7 @@ bool DRAGGER::tryWalkaround( NODE* aNode, LINE& aOrig, LINE& aWalk )
aWalk = wr.lineCcw;
ok = true;
}
return ok;
}