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
This commit is contained in:
Seth Hillbrand 2022-01-29 07:05:34 -08:00
parent c2707f3cc0
commit 38a4894d92
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 ); WALKAROUND::RESULT wr = walkaround.Route( aWalk );
if( wr.statusCcw == WALKAROUND::DONE && wr.statusCw == WALKAROUND::DONE ) if( wr.statusCcw == WALKAROUND::DONE && wr.statusCw == WALKAROUND::DONE )
{ {
aWalk = ( wr.lineCw.CLine().Length() < wr.lineCcw.CLine().Length() ? wr.lineCw : if( wr.lineCw.CLine().PointCount() > 1
wr.lineCcw ); && wr.lineCw.CLine().Length() < wr.lineCcw.CLine().Length() )
ok = true; {
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 ) 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; aWalk = wr.lineCcw;
ok = true; ok = true;
} }
return ok; return ok;
} }