Add angle display to line drawing

Helpful to see what angle you are at when setting graphic lines
This commit is contained in:
Seth Hillbrand 2022-07-15 12:03:11 -07:00
parent bed38d2fc8
commit b792a3f3f5
1 changed files with 8 additions and 3 deletions

View File

@ -62,9 +62,12 @@ void TWO_POINT_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
if( m_constructMan.IsReset() )
return;
const VECTOR2I origin = m_constructMan.GetOrigin();
const VECTOR2I end = m_constructMan.GetEnd();
const VECTOR2I radVec = end - origin;
const VECTOR2I origin = m_constructMan.GetOrigin();
const VECTOR2I end = m_constructMan.GetEnd();
const VECTOR2I radVec = end - origin;
// Ensures that +90° is up and -90° is down in pcbnew
const EDA_ANGLE deltaAngle( VECTOR2I( radVec.x, -radVec.y ) );
if( radVec.x == 0 && radVec.y == 0 )
{
@ -78,6 +81,8 @@ void TWO_POINT_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
if( m_shape == GEOM_SHAPE::SEGMENT )
{
cursorStrings.push_back( DimensionLabel( "l", radVec.EuclideanNorm(), m_units ) );
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), deltaAngle.AsDegrees(),
EDA_UNITS::DEGREES ) );
}
else if( m_shape == GEOM_SHAPE::RECT )
{