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-07-04 15:48:27 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2016-07-07 15:31:11 +0300
commit67fafc616e350f4e680f85fc423145f837b3c231 (patch)
tree85dd95b49ad6bb472797b0009d5cab2a548c5ee4 /drape_frontend
parentc21f80c1dea70f58c3acc2c8ba0a9235dd590476 (diff)
Set rect event processing fixed.
Diffstat (limited to 'drape_frontend')
-rw-r--r--drape_frontend/navigator.cpp44
-rw-r--r--drape_frontend/navigator.hpp6
-rw-r--r--drape_frontend/user_event_stream.cpp46
3 files changed, 18 insertions, 78 deletions
diff --git a/drape_frontend/navigator.cpp b/drape_frontend/navigator.cpp
index ecaefccea2..3c01342cf1 100644
--- a/drape_frontend/navigator.cpp
+++ b/drape_frontend/navigator.cpp
@@ -26,30 +26,17 @@ Navigator::Navigator()
{
}
-void Navigator::SetFromRect2(m2::AnyRectD const & r)
+void Navigator::SetFromScreen(ScreenBase const & screen)
{
- ScreenBase tmp = m_Screen;
-
- m2::RectD const & worldR = df::GetWorldRect();
-
- tmp.SetFromRect2d(r);
- tmp = ScaleInto(tmp, worldR);
-
- m_Screen = tmp;
-
- if (!m_InAction)
- m_StartScreen = tmp;
+ VisualParams const & p = VisualParams::Instance();
+ SetFromScreen(screen, p.GetTileSize(), p.GetVisualScale());
}
-void Navigator::SetScreen(ScreenBase const & screen)
+void Navigator::SetFromScreen(ScreenBase const & screen, uint32_t tileSize, double visualScale)
{
- m2::RectD const & worldR = df::GetWorldRect();
- ScreenBase tmp = screen;
- tmp = ScaleInto(tmp, worldR);
+ ScreenBase tmp = ScaleInto(screen, df::GetWorldRect());
- VisualParams const & p = VisualParams::Instance();
-
- if (!CheckMaxScale(tmp, p.GetTileSize(), p.GetVisualScale()))
+ if (!CheckMaxScale(tmp, tileSize, visualScale))
{
int const scale = scales::GetUpperStyleScale() - 1;
m2::RectD newRect = df::GetRectForDrawScale(scale, screen.GetOrg());
@@ -75,26 +62,9 @@ void Navigator::SetFromRect(m2::AnyRectD const & r)
void Navigator::SetFromRect(m2::AnyRectD const & r, uint32_t tileSize, double visualScale)
{
- m2::RectD const & worldR = df::GetWorldRect();
-
ScreenBase tmp = m_Screen;
-
tmp.SetFromRect(r);
- tmp = ScaleInto(tmp, worldR);
- if (!CheckMaxScale(tmp, tileSize, visualScale))
- {
- int const scale = scales::GetUpperStyleScale() - 1;
- m2::RectD newRect = df::GetRectForDrawScale(scale, r.Center());
- newRect.Scale(m_Screen.GetScale3d());
- CheckMinMaxVisibleScale(newRect, scale, m_Screen.GetScale3d());
- tmp = m_Screen;
- tmp.SetFromRect(m2::AnyRectD(newRect));
- ASSERT(CheckMaxScale(tmp, tileSize, visualScale), ());
- }
- m_Screen = tmp;
-
- if (!m_InAction)
- m_StartScreen = tmp;
+ SetFromScreen(tmp, tileSize, visualScale);
}
void Navigator::CenterViewport(m2::PointD const & p)
diff --git a/drape_frontend/navigator.hpp b/drape_frontend/navigator.hpp
index 25d9ea0fbb..0155a4dd9f 100644
--- a/drape_frontend/navigator.hpp
+++ b/drape_frontend/navigator.hpp
@@ -18,11 +18,11 @@ class Navigator
public:
Navigator();
- void SetScreen(ScreenBase const & screen);
void SetFromRect(m2::AnyRectD const & r);
- void SetFromRect2(m2::AnyRectD const & r);
- void CenterViewport(m2::PointD const & p);
void SetFromRect(m2::AnyRectD const & r, uint32_t tileSize, double visualScale);
+ void SetFromScreen(ScreenBase const & screen);
+ void SetFromScreen(ScreenBase const & screen, uint32_t tileSize, double visualScale);
+ void CenterViewport(m2::PointD const & p);
void OnSize(int w, int h);
diff --git a/drape_frontend/user_event_stream.cpp b/drape_frontend/user_event_stream.cpp
index 9678e51629..2e983e78f4 100644
--- a/drape_frontend/user_event_stream.cpp
+++ b/drape_frontend/user_event_stream.cpp
@@ -287,7 +287,7 @@ void UserEventStream::ApplyAnimations()
{
ScreenBase screen;
if (m_animationSystem.GetScreen(GetCurrentScreen(), screen))
- m_navigator.SetScreen(screen);
+ m_navigator.SetFromScreen(screen);
Animation::SwitchPerspectiveParams switchPerspective;
if (m_animationSystem.SwitchPerspective(switchPerspective))
@@ -366,9 +366,7 @@ bool UserEventStream::SetScale(m2::PointD const & pxScaleCenter, double factor,
bool UserEventStream::SetCenter(m2::PointD const & center, int zoom, bool isAnim)
{
- ScreenBase const & currentScreen = GetCurrentScreen();
-
- ScreenBase screen = currentScreen;
+ ScreenBase screen = GetCurrentScreen();
if (zoom == kDoNotChangeZoom)
{
GetTargetScreen(screen);
@@ -427,45 +425,17 @@ bool UserEventStream::SetScreen(ScreenBase const & endScreen, bool isAnim)
}
ResetMapPlaneAnimations();
- m_navigator.SetScreen(endScreen);
+ m_navigator.SetFromScreen(endScreen);
return true;
}
bool UserEventStream::SetRect(m2::AnyRectD const & rect, bool isAnim)
{
- //isAnim = false;
- if (isAnim)
- {
- auto onStartHandler = [this](ref_ptr<Animation> animation)
- {
- if (m_listener)
- m_listener->OnAnimationStarted(animation);
- };
-
- m2::AnyRectD const startRect = GetCurrentRect();
- ScreenBase const & screen = GetCurrentScreen();
-
- drape_ptr<Animation> anim = GetSetRectAnimation(screen, startRect, rect);
- if (!df::IsAnimationAllowed(anim->GetDuration(), screen))
- {
- anim.reset();
- double const moveDuration = PositionInterpolator::GetMoveDuration(startRect.GlobalCenter(),
- rect.GlobalCenter(), screen);
- if (moveDuration > kMaxAnimationTimeSec)
- anim = GetPrettyMoveAnimation(screen, startRect, rect);
- }
-
- if (anim != nullptr)
- {
- anim->SetOnStartAction(onStartHandler);
- m_animationSystem.CombineAnimation(move(anim));
- return false;
- }
- }
+ ScreenBase tmp = GetCurrentScreen();
+ tmp.SetFromRects(rect, tmp.PixelRectIn3d());
+ tmp.MatchGandP3d(rect.GlobalCenter(), tmp.PixelRectIn3d().Center());
- ResetMapPlaneAnimations();
- m_navigator.SetFromRect2(rect);
- return true;
+ return SetScreen(tmp, isAnim);
}
bool UserEventStream::InterruptFollowAnimations(bool force)
@@ -551,7 +521,7 @@ bool UserEventStream::SetFollowAndRotate(m2::PointD const & userPos, m2::PointD
}
ResetMapPlaneAnimations();
- m_navigator.SetScreen(screen);
+ m_navigator.SetFromScreen(screen);
return true;
}