RULER_ITEM: fix incorrect position of the shadow text shape (round 3).

Depending on the text orientation, the shadow shape position was incorrect.
This commit is contained in:
jean-pierre charras 2023-06-23 12:49:11 +02:00
parent 1698fb6608
commit 965aaa217c
1 changed files with 8 additions and 2 deletions

View File

@ -198,13 +198,19 @@ void drawTicksAlongLine( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECT
{
labelAttrs.m_Halign = GR_TEXT_H_ALIGN_LEFT;
labelAttrs.m_Angle = labelAngle;
labelOffset.x -= shadowXoffset;
// Adjust the text position of the shadow shape:
labelOffset.x -= shadowXoffset * labelAttrs.m_Angle.Cos();;
labelOffset.y += shadowXoffset * labelAttrs.m_Angle.Sin();;
}
else
{
labelAttrs.m_Halign = GR_TEXT_H_ALIGN_RIGHT;
labelAttrs.m_Angle = labelAngle + ANGLE_180;
labelOffset.x += shadowXoffset;
// Adjust the text position of the shadow shape:
labelOffset.x += shadowXoffset * labelAttrs.m_Angle.Cos();;
labelOffset.y -= shadowXoffset * labelAttrs.m_Angle.Sin();;
}
BOX2D viewportD = aView->GetViewport();