Fixed tapping in follow-and-rotate mode

This commit is contained in:
r.kuznetsov 2016-08-05 18:10:32 -07:00 committed by Vladimir Byko-Ianko
parent b9d212427c
commit 3b522c524f
2 changed files with 16 additions and 5 deletions

View file

@ -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:

View file

@ -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;