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

Method TouchDown

libs/drape_frontend/user_event_stream.cpp:763–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761}
762
763bool UserEventStream::TouchDown(std::array<Touch, 2> const & touches)
764{
765 size_t touchCount = GetValidTouchesCount(touches);
766 bool isMapTouch = true;
767
768 // Interrupt kinetic scroll on touch down.
769 m_animationSystem.FinishAnimations(Animation::Type::KineticScroll, false /* rewind */, true /* finishAll */);
770
771 if (touchCount == 1)
772 {
773 if (!DetectDoubleTap(touches[0]))
774 {
775 if (m_state == STATE_EMPTY)
776 {
777 if (!TryBeginFilter(touches[0]))
778 {
779 BeginTapDetector();
780 m_startDragOrg = touches[0].m_location;
781 }
782 else
783 {
784 isMapTouch = false;
785 }
786 }
787 }
788 }
789 else if (touchCount == 2)
790 {
791 switch (m_state)
792 {
793 case STATE_EMPTY: BeginTwoFingersTap(touches[0], touches[1]); break;
794 case STATE_FILTER:
795 CancelFilter(touches[0]);
796 BeginScale(touches[0], touches[1]);
797 break;
798 case STATE_TAP_DETECTION:
799 case STATE_WAIT_DOUBLE_TAP:
800 case STATE_WAIT_DOUBLE_TAP_HOLD:
801 CancelTapDetector();
802 BeginTwoFingersTap(touches[0], touches[1]);
803 break;
804 case STATE_DOUBLE_TAP_HOLD:
805 EndDoubleTapAndHold(touches[0]);
806 BeginScale(touches[0], touches[1]);
807 break;
808 case STATE_DRAG:
809 isMapTouch = EndDrag(touches[0], true /* cancelled */);
810 BeginScale(touches[0], touches[1]);
811 break;
812 default: break;
813 }
814 }
815
816 UpdateTouches(touches);
817 return isMapTouch;
818}
819
820bool UserEventStream::CheckDrag(std::array<Touch, 2> const & touches, double threshold) const

Callers

nothing calls this directly

Calls 2

GetValidTouchesCountFunction · 0.85
FinishAnimationsMethod · 0.80

Tested by

no test coverage detected