[graphics] altered straight text element to allow shifting labels horizontally

This commit is contained in:
Darafei Praliaskouski 2013-05-02 19:24:57 +03:00 committed by Alex Zolotarev
parent 9c64dd0f43
commit 941389134e
3 changed files with 8 additions and 7 deletions

View file

@ -126,12 +126,7 @@ namespace graphics
auxRes.push_back(auxVisText());
for (int i = 0; i < auxRes.size(); ++i)
{
m_glyphLayouts.push_back(GlyphLayout(p.m_glyphCache, p.m_auxFontDesc, m2::PointD(0, 0), auxRes[i], graphics::EPosCenter));
m2::RectD r = m_glyphLayouts.back().boundRects().back().GetGlobalRect();
allElemWidth = max(r.SizeX(), allElemWidth);
allElemHeight += r.SizeY();
}
}
double curShift = allElemHeight / 2;

View file

@ -378,7 +378,13 @@ void Drawer::Draw(di::FeatureInfo const & fi)
else
textPosition = graphics::EPosAbove;
}
if (pRule->GetCaption(0)->has_offset_x())
{
if (pRule->GetCaption(0)->offset_x() > 0)
textPosition = graphics::EPosRight;
else
textPosition = graphics::EPosLeft;
}
// draw area text
if (isArea/* && isN*/)

View file

@ -172,7 +172,7 @@ namespace di
if (keys[i].m_type == drule::caption)
if (m_rules[i].m_rule->GetCaption(0) != 0)
hasCaptionWithoutOffset = !m_rules[i].m_rule->GetCaption(0)->has_offset_y();
hasCaptionWithoutOffset = !(m_rules[i].m_rule->GetCaption(0)->has_offset_y() || m_rules[i].m_rule->GetCaption(0)->has_offset_x());
}
// placing a text on the path