forked from organicmaps/organicmaps
added hitTest and roughHitTest to OverlayElement.
This commit is contained in:
parent
6e40c5c9d6
commit
18fbed10e6
2 changed files with 18 additions and 0 deletions
|
@ -139,4 +139,20 @@ namespace yg
|
|||
}
|
||||
return m_roughBoundRect;
|
||||
}
|
||||
|
||||
bool OverlayElement::hitTest(m2::PointD const & pt) const
|
||||
{
|
||||
vector<m2::AnyRectD> const & rects = boundRects();
|
||||
|
||||
for (vector<m2::AnyRectD>::const_iterator it = rects.begin(); it != rects.end(); ++it)
|
||||
if (it->IsPointInside(pt))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OverlayElement::roughHitTest(m2::PointD const & pt) const
|
||||
{
|
||||
return roughBoundRect().IsPointInside(pt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,8 @@ namespace yg
|
|||
void setIsVisible(bool flag);
|
||||
|
||||
m2::RectD const & roughBoundRect() const;
|
||||
bool hitTest(m2::PointD const & pt) const;
|
||||
bool roughHitTest(m2::PointD const & pt) const;
|
||||
|
||||
virtual void offset(m2::PointD const & offs);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue