diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2015-05-25 11:43:37 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:48:16 +0300 |
commit | aefd4e49a34b81ca9b8589e83e5c445cb9539f21 (patch) | |
tree | 8dd601628022e258ee9b8ebf192ecfa3baad31e3 /map/information_display.cpp | |
parent | 97e3dbbd2153b62d60ffe9281f2890d98956a2d4 (diff) |
Corrections after Yuri R comments.
Diffstat (limited to 'map/information_display.cpp')
-rw-r--r-- | map/information_display.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/map/information_display.cpp b/map/information_display.cpp index ac8ba8f21b..49254f1e0e 100644 --- a/map/information_display.cpp +++ b/map/information_display.cpp @@ -287,28 +287,28 @@ void InformationDisplay::ResetRouteMatchingInfo() void InformationDisplay::SetWidgetPivot(WidgetType widget, m2::PointD const & pivot) { - ASSERT(m_ruler, ()); + auto const setPivotFn = [](shared_ptr<gui::Element> e, m2::PointD const & point) + { + if (e) + e->setPivot(point); + }; + switch(widget) { case WidgetType::Ruler: - if (m_ruler) - m_ruler->setPivot(pivot); + setPivotFn(m_ruler, pivot); return; case WidgetType::CopyrightLabel: - if (m_copyrightLabel) - m_copyrightLabel->setPivot(pivot); + setPivotFn(m_copyrightLabel, pivot); return; case WidgetType::CountryStatusDisplay: - if (m_countryStatusDisplay) - m_countryStatusDisplay->setPivot(pivot); + setPivotFn(m_countryStatusDisplay, pivot); return; case WidgetType::CompassArrow: - if (m_compassArrow) - m_compassArrow->setPivot(pivot); + setPivotFn(m_compassArrow, pivot); return; - case WidgetType::DebugLable: - if (m_debugLabel) - m_debugLabel->setPivot(pivot); + case WidgetType::DebugLabel: + setPivotFn(m_debugLabel, pivot); return; default: ASSERT(false, ()); @@ -321,11 +321,13 @@ m2::PointD InformationDisplay::GetWidgetSize(WidgetType widget) const switch(widget) { case WidgetType::Ruler: - boundRect = m_ruler->GetBoundRect(); + if (m_ruler) + boundRect = m_ruler->GetBoundRect(); break; case WidgetType::CompassArrow: - return m_compassArrow->GetPixelSize(); - case WidgetType::DebugLable: + if (m_compassArrow) + return m_compassArrow->GetPixelSize(); + case WidgetType::DebugLabel: case WidgetType::CountryStatusDisplay: case WidgetType::CopyrightLabel: default: |