Don't allow degenerate arcs when dragging editing handles.
Fixes: lp:1839536 * https://bugs.launchpad.net/kicad/+bug/1839536
This commit is contained in:
parent
ab283174df
commit
885497ec1f
|
@ -468,15 +468,23 @@ void LIB_ARC::CalcEdit( const wxPoint& aPosition )
|
||||||
double chordAfter = sq( v.x ) + sq( v.y );
|
double chordAfter = sq( v.x ) + sq( v.y );
|
||||||
double ratio = chordAfter / chordBefore;
|
double ratio = chordAfter / chordBefore;
|
||||||
|
|
||||||
m_Radius = KiROUND( sqrt( m_Radius * m_Radius * ratio ) );
|
if( ratio > 0 )
|
||||||
|
{
|
||||||
|
m_Radius = int( sqrt( m_Radius * m_Radius * ratio ) ) + 1;
|
||||||
|
m_Radius = std::max( m_Radius, int( sqrt( chordAfter ) / 2 ) + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
m_Radius = KiROUND( ( GetLineLength( m_ArcStart, aPosition )
|
{
|
||||||
+ GetLineLength( m_ArcEnd, aPosition ) ) / 2.0 );
|
double chordA = GetLineLength( m_ArcStart, aPosition );
|
||||||
|
double chordB = GetLineLength( m_ArcEnd, aPosition );
|
||||||
|
m_Radius = int( ( chordA + chordB ) / 2.0 ) + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate center based on start, end, and radius
|
// Calculate center based on start, end, and radius
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue