Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2016-11-25 16:09:55 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2016-11-25 16:55:47 +0300
commit12a05922687cddcef06ed84e15ad43683fba5b7f (patch)
treefce8d37d3458737dd4cb9f0974576af2a888446f /drape_frontend
parent248c8ed9ff17f3ec1ab31a67fd97aacd7de2d183 (diff)
Show the ruler only during scaling.
Diffstat (limited to 'drape_frontend')
-rw-r--r--drape_frontend/gui/ruler.cpp2
-rw-r--r--drape_frontend/gui/ruler_helper.cpp14
-rw-r--r--drape_frontend/gui/ruler_helper.hpp4
3 files changed, 18 insertions, 2 deletions
diff --git a/drape_frontend/gui/ruler.cpp b/drape_frontend/gui/ruler.cpp
index 541ccb8733..e24bfd5cdb 100644
--- a/drape_frontend/gui/ruler.cpp
+++ b/drape_frontend/gui/ruler.cpp
@@ -51,7 +51,7 @@ public:
: TBase(id, anchor, pivot)
, m_isAppearing(isAppearing)
, m_isVisibleAtEnd(true)
- , m_animation(false, 0.4)
+ , m_animation(false, 0.2)
{
}
diff --git a/drape_frontend/gui/ruler_helper.cpp b/drape_frontend/gui/ruler_helper.cpp
index e3bdbe0b54..e60a50fe9c 100644
--- a/drape_frontend/gui/ruler_helper.cpp
+++ b/drape_frontend/gui/ruler_helper.cpp
@@ -29,6 +29,8 @@ static int const MinUnitValue = -1;
static int const MaxUnitValue = numeric_limits<int>::max() - 1;
static int const InvalidUnitValue = MaxUnitValue + 1;
+static double const kHideDelaySeconds = 1.0;
+
struct UnitValue
{
char const * m_s;
@@ -113,6 +115,14 @@ RulerHelper::RulerHelper()
void RulerHelper::Update(ScreenBase const & screen)
{
+ if (m_lastScale != screen.GetScale())
+ {
+ if (!IsVisible(screen))
+ SetTextDirty();
+ m_lastScale = screen.GetScale();
+ m_hideTimer.Reset();
+ }
+
m2::PointD pivot = screen.PixelRect().Center();
int const minPxWidth = my::rounds(MinPixelWidth * df::VisualParams::Instance().GetVisualScale());
m2::PointD pt1 = screen.PtoG(pivot);
@@ -150,7 +160,9 @@ void RulerHelper::Update(ScreenBase const & screen)
bool RulerHelper::IsVisible(ScreenBase const & screen) const
{
DrapeGui & gui = DrapeGui::Instance();
- return !gui.IsCopyrightActive() && df::GetDrawTileScale(screen) >= VISIBLE_RULER_BOTTOM_SCALE;
+ return !gui.IsCopyrightActive() &&
+ (df::GetDrawTileScale(screen) >= VISIBLE_RULER_BOTTOM_SCALE) &&
+ (m_hideTimer.ElapsedSeconds() < kHideDelaySeconds);
}
void RulerHelper::Invalidate()
diff --git a/drape_frontend/gui/ruler_helper.hpp b/drape_frontend/gui/ruler_helper.hpp
index 5ed7fa2111..a30d6f0db6 100644
--- a/drape_frontend/gui/ruler_helper.hpp
+++ b/drape_frontend/gui/ruler_helper.hpp
@@ -2,6 +2,8 @@
#include "drape_frontend/animation/show_hide_animation.hpp"
+#include "base/timer.hpp"
+
#include "std/string.hpp"
class ScreenBase;
@@ -38,6 +40,8 @@ private:
bool m_isTextDirty;
mutable bool m_dirtyTextRequested;
int m_currentDrawScale = 0;
+ my::Timer m_hideTimer;
+ double m_lastScale = 0.0;
};
}