From b792a3f3f576b5dc99f98b1336125ba7dd60cab1 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 15 Jul 2022 12:03:11 -0700 Subject: [PATCH] Add angle display to line drawing Helpful to see what angle you are at when setting graphic lines --- common/preview_items/two_point_assistant.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/common/preview_items/two_point_assistant.cpp b/common/preview_items/two_point_assistant.cpp index 7664236959..7e9d997da5 100644 --- a/common/preview_items/two_point_assistant.cpp +++ b/common/preview_items/two_point_assistant.cpp @@ -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 ) {