From a9decb87ff05e7ae7aa2d4d0272d83ba888cfafc Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Mon, 23 May 2016 16:55:24 +0300 Subject: [PATCH] Fixed embedded GUI on updating map style --- drape_frontend/animation/show_hide_animation.cpp | 4 ++-- drape_frontend/animation/show_hide_animation.hpp | 2 +- drape_frontend/frontend_renderer.cpp | 4 ++++ drape_frontend/gui/copyright_label.cpp | 6 ++++++ drape_frontend/gui/layer_render.cpp | 7 +++++-- drape_frontend/gui/ruler_helper.cpp | 5 +++++ drape_frontend/gui/ruler_helper.hpp | 1 + 7 files changed, 24 insertions(+), 5 deletions(-) diff --git a/drape_frontend/animation/show_hide_animation.cpp b/drape_frontend/animation/show_hide_animation.cpp index caf034f83c..7341e51ff1 100644 --- a/drape_frontend/animation/show_hide_animation.cpp +++ b/drape_frontend/animation/show_hide_animation.cpp @@ -37,8 +37,8 @@ private: double m_endT; }; -ShowHideAnimation::ShowHideAnimation(bool isInitialiVisible, double fullDuraction) - : m_state(isInitialiVisible ? STATE_VISIBLE : STATE_INVISIBLE) +ShowHideAnimation::ShowHideAnimation(bool isInitialVisible, double fullDuraction) + : m_state(isInitialVisible ? STATE_VISIBLE : STATE_INVISIBLE) , m_fullDuration(fullDuraction) { } diff --git a/drape_frontend/animation/show_hide_animation.hpp b/drape_frontend/animation/show_hide_animation.hpp index 931c6a00a7..6d1bf503f9 100644 --- a/drape_frontend/animation/show_hide_animation.hpp +++ b/drape_frontend/animation/show_hide_animation.hpp @@ -18,7 +18,7 @@ public: STATE_HIDE_DIRECTION }; - ShowHideAnimation(bool isInitialiVisible, double fullDuraction); + ShowHideAnimation(bool isInitialVisible, double fullDuraction); ~ShowHideAnimation(); void Show(); diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index f16b129da8..faac06dc66 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -1,5 +1,6 @@ #include "drape_frontend/animation/interpolation_holder.hpp" #include "drape_frontend/gui/drape_gui.hpp" +#include "drape_frontend/gui/ruler_helper.hpp" #include "drape_frontend/animation_system.hpp" #include "drape_frontend/framebuffer.hpp" #include "drape_frontend/frontend_renderer.hpp" @@ -359,6 +360,9 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) UpdateDisplacementEnabled(); InvalidateRect(screen.ClipRect()); } + + if (m_guiRenderer->HasWidget(gui::WIDGET_RULER)) + gui::DrapeGui::GetRulerHelper().Invalidate(); break; } diff --git a/drape_frontend/gui/copyright_label.cpp b/drape_frontend/gui/copyright_label.cpp index 1f768080b4..cff77564ab 100644 --- a/drape_frontend/gui/copyright_label.cpp +++ b/drape_frontend/gui/copyright_label.cpp @@ -38,6 +38,12 @@ namespace if (!TBase::Update(screen)) return false; + + if (!DrapeGui::Instance().IsCopyrightActive()) + { + SetIsVisible(false); + return false; + } if (m_animation == nullptr) m_animation.reset(new df::OpacityAnimation(kCopyrightHideTime, kCopyrightVisibleTime, 1.0f, 0.0f)); diff --git a/drape_frontend/gui/layer_render.cpp b/drape_frontend/gui/layer_render.cpp index 3282fc89ca..c2521dd38b 100644 --- a/drape_frontend/gui/layer_render.cpp +++ b/drape_frontend/gui/layer_render.cpp @@ -32,8 +32,11 @@ void LayerRenderer::Build(ref_ptr mng) void LayerRenderer::Render(ref_ptr mng, ScreenBase const & screen) { - DrapeGui::GetRulerHelper().ResetTextDirtyFlag(); - DrapeGui::GetRulerHelper().Update(screen); + if (HasWidget(gui::WIDGET_RULER)) + { + DrapeGui::GetRulerHelper().ResetTextDirtyFlag(); + DrapeGui::GetRulerHelper().Update(screen); + } for (TRenderers::value_type & r : m_renderers) r.second->Render(screen, mng); } diff --git a/drape_frontend/gui/ruler_helper.cpp b/drape_frontend/gui/ruler_helper.cpp index eae097865f..5fb830f14a 100644 --- a/drape_frontend/gui/ruler_helper.cpp +++ b/drape_frontend/gui/ruler_helper.cpp @@ -153,6 +153,11 @@ bool RulerHelper::IsVisible(ScreenBase const & screen) const return !gui.IsCopyrightActive() && df::GetDrawTileScale(screen) >= VISIBLE_RULER_BOTTOM_SCALE; } +void RulerHelper::Invalidate() +{ + SetTextDirty(); +} + float RulerHelper::GetRulerHalfHeight() const { float const kRulerHalfHeight = 1.0f; diff --git a/drape_frontend/gui/ruler_helper.hpp b/drape_frontend/gui/ruler_helper.hpp index a1a484df63..5ed7fa2111 100644 --- a/drape_frontend/gui/ruler_helper.hpp +++ b/drape_frontend/gui/ruler_helper.hpp @@ -16,6 +16,7 @@ public: void Update(ScreenBase const & screen); bool IsVisible(ScreenBase const & screen) const; + void Invalidate(); float GetRulerHalfHeight() const; float GetRulerPixelLength() const;