diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2012-10-08 15:54:51 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:44:51 +0300 |
commit | e19ff2ec3a00b814a5f3f8a7c2edc1e70ac3ef8a (patch) | |
tree | 257992d02b50e5d6faf47ed57e97534828b9c79d /map/compass_arrow.cpp | |
parent | 155a2cdd41a1d24d63b7587e75b6a526e35414d7 (diff) |
changes to CompassArrow according to code review.
Diffstat (limited to 'map/compass_arrow.cpp')
-rw-r--r-- | map/compass_arrow.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/map/compass_arrow.cpp b/map/compass_arrow.cpp index b580fc6fd4..c1bb3672a1 100644 --- a/map/compass_arrow.cpp +++ b/map/compass_arrow.cpp @@ -1,6 +1,6 @@ #include "compass_arrow.hpp" + #include "framework.hpp" -#include "rotate_screen_task.hpp" #include "../anim/controller.hpp" @@ -25,11 +25,9 @@ CompassArrow::CompassArrow(Params const & p) m_angle = 0; } -void CompassArrow::setAngle(double angle) +void CompassArrow::SetAngle(double angle) { m_angle = angle; - m_drawM = math::Shift(math::Rotate(math::Identity<double, 3>(), m_angle), pivot() * visualScale()); - setIsDirtyRect(true); } @@ -39,11 +37,10 @@ vector<m2::AnyRectD> const & CompassArrow::boundRects() const { double k = visualScale(); - m2::PointD pv = pivot() * k; double halfW = m_arrowWidth / 2.0 * k; double halfH = m_arrowHeight / 2.0 * k; - m_boundRects[0] = m2::AnyRectD(pv, + m_boundRects[0] = m2::AnyRectD(pivot(), -math::pi / 2 + m_angle, m2::RectD(-halfW, -halfH, halfW, halfH)); @@ -59,7 +56,14 @@ void CompassArrow::draw(yg::gl::OverlayRenderer * r, if (isVisible()) { checkDirtyDrawing(); - m_displayList->draw(m_drawM * m); + + math::Matrix<double, 3, 3> drawM = math::Shift( + math::Rotate( + math::Identity<double, 3>(), + m_angle), + pivot()); + + m_displayList->draw(drawM * m); } } @@ -107,8 +111,6 @@ void CompassArrow::cache() cacheScreen->drawPath(outlinePts, sizeof(outlinePts) / sizeof(m2::PointD), 0, cacheScreen->skin()->mapPenInfo(outlinePenInfo), depth()); - m_drawM = math::Shift(math::Rotate(math::Identity<double, 3>(), m_angle), pivot() * k); - cacheScreen->setDisplayList(0); cacheScreen->endFrame(); @@ -121,15 +123,6 @@ void CompassArrow::purge() m_displayList.reset(); } -void CompassArrow::StopAnimation() -{ - if (m_rotateScreenTask - && !m_rotateScreenTask->IsEnded() - && !m_rotateScreenTask->IsCancelled()) - m_rotateScreenTask->Cancel(); - m_rotateScreenTask.reset(); -} - bool CompassArrow::onTapEnded(m2::PointD const & pt) { anim::Controller * animController = m_framework->GetAnimController(); @@ -150,8 +143,13 @@ bool CompassArrow::onTapEnded(m2::PointD const & pt) return true; } +unsigned CompassArrow::GetArrowHeight() const +{ + return m_arrowHeight; +} + bool CompassArrow::hitTest(m2::PointD const & pt) const { double rad = max(m_arrowWidth / 2, m_arrowHeight / 2); - return pt.Length(pivot() * visualScale()) < rad * visualScale(); + return pt.Length(pivot()) < rad * visualScale(); } |