MCPcopy Create free account
hub / github.com/comaps/comaps / TouchMove

Method TouchMove

libs/drape_frontend/user_event_stream.cpp:825–897  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

823}
824
825bool UserEventStream::TouchMove(std::array<Touch, 2> const & touches)
826{
827 size_t const touchCount = GetValidTouchesCount(touches);
828 bool isMapTouch = true;
829
830 switch (m_state)
831 {
832 case STATE_EMPTY:
833 if (touchCount == 1)
834 if (CheckDrag(touches, m_dragThreshold))
835 BeginDrag(touches[0]);
836 else
837 isMapTouch = false;
838 else
839 BeginScale(touches[0], touches[1]);
840 break;
841 case STATE_TAP_TWO_FINGERS:
842 if (touchCount == 2)
843 {
844 float const threshold = static_cast<float>(m_dragThreshold);
845 if (m_twoFingersTouches[0].SquaredLength(touches[0].m_location) > threshold ||
846 m_twoFingersTouches[1].SquaredLength(touches[1].m_location) > threshold)
847 {
848 BeginScale(touches[0], touches[1]);
849 }
850 else
851 isMapTouch = false;
852 }
853 break;
854 case STATE_FILTER:
855 ASSERT_EQUAL(touchCount, 1, ());
856 isMapTouch = false;
857 break;
858 case STATE_TAP_DETECTION:
859 case STATE_WAIT_DOUBLE_TAP:
860 if (CheckDrag(touches, m_dragThreshold))
861 CancelTapDetector();
862 else
863 isMapTouch = false;
864 break;
865 case STATE_WAIT_DOUBLE_TAP_HOLD:
866 if (CheckDrag(touches, m_dragThreshold))
867 StartDoubleTapAndHold(touches[0]);
868 break;
869 case STATE_DOUBLE_TAP_HOLD: UpdateDoubleTapAndHold(touches[0]); break;
870 case STATE_DRAG:
871 if (touchCount > 1)
872 {
873 ASSERT_EQUAL(GetValidTouchesCount(m_touches), 1, ());
874 EndDrag(m_touches[0], true /* cancelled */);
875 }
876 else
877 {
878 Drag(touches[0]);
879 }
880 break;
881 case STATE_SCALE:
882 if (touchCount < 2)

Callers

nothing calls this directly

Calls 4

GetValidTouchesCountFunction · 0.85
ScaleFunction · 0.85
ASSERTFunction · 0.85
SquaredLengthMethod · 0.80

Tested by

no test coverage detected