diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2016-08-06 04:10:32 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-08-18 17:06:29 +0300 |
commit | 3b522c524f5a3f3125e10675451a2c5429afee52 (patch) | |
tree | cef6732fa0c7079d4e4f24698ac452dd360501dc /drape_frontend | |
parent | b9d212427c51e2e0c36829eb79edeee32b5ca985 (diff) |
Fixed tapping in follow-and-rotate mode
Diffstat (limited to 'drape_frontend')
-rw-r--r-- | drape_frontend/user_event_stream.cpp | 19 | ||||
-rw-r--r-- | drape_frontend/user_event_stream.hpp | 2 |
2 files changed, 16 insertions, 5 deletions
diff --git a/drape_frontend/user_event_stream.cpp b/drape_frontend/user_event_stream.cpp index cd13b1ba52..afb6c7ce86 100644 --- a/drape_frontend/user_event_stream.cpp +++ b/drape_frontend/user_event_stream.cpp @@ -204,7 +204,6 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChanged, bool e.m_followAndRotate.m_azimuth, e.m_followAndRotate.m_preferredZoomLevel, e.m_followAndRotate.m_autoScale, e.m_followAndRotate.m_isAnim, e.m_followAndRotate.m_isAutoScale); - TouchCancel(m_touches); break; case UserEvent::EVENT_AUTO_PERSPECTIVE: SetAutoPerspective(e.m_autoPerspective.m_isAutoPerspective); @@ -607,11 +606,16 @@ bool UserEventStream::TouchDown(array<Touch, 2> const & touches) return isMapTouch; } +bool UserEventStream::CheckDrag(array<Touch, 2> const & touches, double threshold) const +{ + return m_startDragOrg.SquareLength(touches[0].m_location) > threshold; +} + bool UserEventStream::TouchMove(array<Touch, 2> const & touches, double timestamp) { if (m_listener) m_listener->OnTouchMapAction(); - + double const kDragThreshold = my::sq(VisualParams::Instance().GetDragThreshold()); size_t touchCount = GetValidTouchesCount(touches); bool isMapTouch = true; @@ -621,7 +625,7 @@ bool UserEventStream::TouchMove(array<Touch, 2> const & touches, double timestam case STATE_EMPTY: if (touchCount == 1) { - if (m_startDragOrg.SquareLength(touches[0].m_location) > kDragThreshold) + if (CheckDrag(touches, kDragThreshold)) BeginDrag(touches[0], timestamp); else isMapTouch = false; @@ -647,14 +651,19 @@ bool UserEventStream::TouchMove(array<Touch, 2> const & touches, double timestam isMapTouch = false; break; case STATE_TAP_DETECTION: + if (CheckDrag(touches, kDragThreshold)) + CancelTapDetector(); + else + EndTapDetector(touches[0]); + break; case STATE_WAIT_DOUBLE_TAP: - if (m_startDragOrg.SquareLength(touches[0].m_location) > kDragThreshold) + if (CheckDrag(touches, kDragThreshold)) CancelTapDetector(); else isMapTouch = false; break; case STATE_WAIT_DOUBLE_TAP_HOLD: - if (m_startDragOrg.SquareLength(touches[0].m_location) > kDragThreshold) + if (CheckDrag(touches, kDragThreshold)) StartDoubleTapAndHold(touches[0]); break; case STATE_DOUBLE_TAP_HOLD: diff --git a/drape_frontend/user_event_stream.hpp b/drape_frontend/user_event_stream.hpp index 0e1be71778..9889d5ba7a 100644 --- a/drape_frontend/user_event_stream.hpp +++ b/drape_frontend/user_event_stream.hpp @@ -349,6 +349,8 @@ private: void ResetMapPlaneAnimations(); bool InterruptFollowAnimations(bool force); + bool CheckDrag(array<Touch, 2> const & touches, double threshold) const; + list<UserEvent> m_events; mutable mutex m_lock; |