forked from organicmaps/organicmaps
bug fixes for PathTextElement panning.
This commit is contained in:
parent
7fc6aacaf9
commit
1349084d0e
3 changed files with 55 additions and 19 deletions
|
@ -329,21 +329,23 @@ namespace yg
|
|||
{
|
||||
if (m_metrics[i].m_width != 0)
|
||||
{
|
||||
map<double, m2::AARectD>::iterator it = rects.find(m_entries[i].m_angle.val());
|
||||
ang::AngleD const & a = m_entries[i].m_angle;
|
||||
|
||||
map<double, m2::AARectD>::iterator it = rects.find(a.val());
|
||||
|
||||
m2::AARectD symRectAA(
|
||||
m_entries[i].m_pt.Move(m_metrics[i].m_height, -m_entries[i].m_angle.cos(), m_entries[i].m_angle.sin()), //< moving by angle = m_entries[i].m_angle - math::pi / 2
|
||||
m_entries[i].m_angle,
|
||||
m_entries[i].m_pt.Move(m_metrics[i].m_height + m_metrics[i].m_yOffset, -a.cos(), a.sin()), //< moving by angle = m_entries[i].m_angle - math::pi / 2
|
||||
a,
|
||||
m2::RectD(m_metrics[i].m_xOffset,
|
||||
m_metrics[i].m_yOffset,
|
||||
0,
|
||||
m_metrics[i].m_xOffset + m_metrics[i].m_width,
|
||||
m_metrics[i].m_yOffset + m_metrics[i].m_height
|
||||
m_metrics[i].m_height
|
||||
));
|
||||
|
||||
if (it == rects.end())
|
||||
rects[m_entries[i].m_angle.val()] = symRectAA;
|
||||
rects[a.val()] = symRectAA;
|
||||
else
|
||||
rects[m_entries[i].m_angle.val()].Add(symRectAA);
|
||||
rects[a.val()].Add(symRectAA);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,25 +57,59 @@ namespace yg
|
|||
bool doAppend = false;
|
||||
|
||||
(*it)->setIsNeedRedraw(false);
|
||||
(*it)->setIsFrozen(false);
|
||||
(*it)->setIsFrozen(true);
|
||||
|
||||
bool hasInside = false;
|
||||
bool hasOutside = false;
|
||||
|
||||
for (int i = 0; i < aaLimitRects.size(); ++i)
|
||||
{
|
||||
if (aaRect.IsRectInside(aaLimitRects[i]))
|
||||
bool isPartInsideRect = aaRect.IsRectInside(aaLimitRects[i]);
|
||||
|
||||
if (isPartInsideRect)
|
||||
{
|
||||
(*it)->setIsNeedRedraw(false);
|
||||
(*it)->setIsFrozen(true);
|
||||
doAppend = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
if (aaRect.IsIntersect(aaLimitRects[i]))
|
||||
if (hasOutside)
|
||||
{
|
||||
(*it)->setIsFrozen(true);
|
||||
/// intersecting
|
||||
(*it)->setIsNeedRedraw(true);
|
||||
doAppend = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
hasInside = true;
|
||||
doAppend = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
bool isRectInsidePart = aaLimitRects[i].IsRectInside(aaRect);
|
||||
|
||||
if (isRectInsidePart)
|
||||
{
|
||||
doAppend = true;
|
||||
break;
|
||||
}
|
||||
|
||||
bool isPartIntersectRect = aaRect.IsIntersect(aaLimitRects[i]);
|
||||
|
||||
if (isPartIntersectRect)
|
||||
{
|
||||
/// intersecting
|
||||
(*it)->setIsNeedRedraw(true);
|
||||
doAppend = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/// the last case remains here - part rect is outside big rect
|
||||
if (hasInside)
|
||||
{
|
||||
(*it)->setIsNeedRedraw(true);
|
||||
doAppend = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
hasOutside = true;
|
||||
}
|
||||
|
||||
if (doAppend)
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace yg
|
|||
{
|
||||
m_boundRects = m_glyphLayout.boundRects();
|
||||
for (unsigned i = 0; i < m_boundRects.size(); ++i)
|
||||
m_boundRects[i] = m2::Inflate(m_boundRects[i], m2::PointD(10, 2));
|
||||
m_boundRects[i] = m2::Inflate(m_boundRects[i], m2::PointD(10, 10));
|
||||
// m_boundRects[i].m2::Inflate(m2::PointD(40, 2)); //< to create more sparse street names structure
|
||||
setIsDirtyRect(false);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ namespace yg
|
|||
|
||||
if (desc.m_isMasked)
|
||||
{
|
||||
if ((m_glyphLayout.firstVisible() != 0) || (m_glyphLayout.lastVisible() != visText().size()))
|
||||
if (!isVisible())
|
||||
return;
|
||||
|
||||
drawTextImpl(m_glyphLayout, screen, m, desc, yg::maxDepth - 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue