|
|
@ -45,7 +45,7 @@ FP_TEXT::FP_TEXT( FOOTPRINT* aParentFootprint, TEXT_TYPE text_type ) : |
|
|
|
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent ); |
|
|
|
|
|
|
|
m_Type = text_type; |
|
|
|
m_keepUpright = true; |
|
|
|
SetKeepUpright( true ); |
|
|
|
|
|
|
|
// Set text thickness to a default value
|
|
|
|
SetTextThickness( Millimeter2iu( DEFAULT_TEXT_WIDTH ) ); |
|
|
@ -110,19 +110,20 @@ bool FP_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void FP_TEXT::KeepUpright( double aOldOrientation, double aNewOrientation ) |
|
|
|
void FP_TEXT::KeepUpright( const EDA_ANGLE& aOldOrientation, const EDA_ANGLE& aNewOrientation ) |
|
|
|
{ |
|
|
|
if( !IsKeepUpright() ) |
|
|
|
return; |
|
|
|
|
|
|
|
double newAngle = GetTextAngle().AsTenthsOfADegree() + aNewOrientation; |
|
|
|
NORMALIZE_ANGLE_POS( newAngle ); |
|
|
|
bool needsFlipped = newAngle >= 1800.0; |
|
|
|
EDA_ANGLE newAngle = GetTextAngle() + aNewOrientation; |
|
|
|
newAngle.Normalize(); |
|
|
|
|
|
|
|
bool needsFlipped = newAngle >= ANGLE_180; |
|
|
|
|
|
|
|
if( needsFlipped ) |
|
|
|
{ |
|
|
|
SetHorizJustify( static_cast<GR_TEXT_H_ALIGN_T>( -GetHorizJustify() ) ); |
|
|
|
SetTextAngle( GetTextAngle().AsTenthsOfADegree() + 1800.0 ); |
|
|
|
SetTextAngle( GetTextAngle() + ANGLE_180 ); |
|
|
|
SetDrawCoord(); |
|
|
|
} |
|
|
|
} |
|
|
@ -247,7 +248,7 @@ EDA_ANGLE FP_TEXT::GetDrawRotation() const |
|
|
|
if( parentFootprint ) |
|
|
|
rotation += parentFootprint->GetOrientation(); |
|
|
|
|
|
|
|
if( m_keepUpright ) |
|
|
|
if( IsKeepUpright() ) |
|
|
|
{ |
|
|
|
// Keep angle between 0 .. 90 deg. Otherwise the text is not easy to read
|
|
|
|
while( rotation > ANGLE_90 ) |
|
|
|