void GestureRecognizer::singleTapGesture(WKEventType type, WKArrayRef touchPoints) { switch (type) { case kWKEventTypeTouchStart: stopTapTimers(); m_recognizerFunction = &GestureRecognizer::pinchGesture; m_gestureHandler->handlePinchStarted(createVectorWithWKArray(touchPoints, 2)); break; case kWKEventTypeTouchMove: { IntPoint currentPoint = toIntPoint(getPointAtIndex(touchPoints, 0)); if (exceedsPanThreshold(m_firstPressedPoint, currentPoint)) { stopTapTimers(); m_recognizerFunction = &GestureRecognizer::panGesture; m_gestureHandler->handlePanStarted(currentPoint); } break; } case kWKEventTypeTouchEnd: if (m_tapAndHoldTimer) { ecore_timer_del(m_tapAndHoldTimer); m_tapAndHoldTimer = 0; } if (m_doubleTapTimer) m_recognizerFunction = &GestureRecognizer::doubleTapGesture; else { m_gestureHandler->handleSingleTap(m_firstPressedPoint); m_recognizerFunction = &GestureRecognizer::noGesture; } break; default: ASSERT_NOT_REACHED(); break; } }
void GestureRecognizer::waitForDoubleTap(const NIXTouchEvent& event) { cancelDoubleTapTimerIfNeeded(); switch (event.type) { case kNIXInputEventTypeTouchStart: if (exceedsPanThreshold(event.touchPoints[0], m_firstTouchPoint)) reset(); else m_state = &GestureRecognizer::doubleTapPressed; break; case kNIXInputEventTypeTouchMove: case kNIXInputEventTypeTouchEnd: fail("received TouchMove or TouchEnd when in WaitForDoubleTap state."); break; } }
void GestureRecognizer::doubleTapPressed(const NIXTouchEvent& event) { const NIXTouchPoint& touchPoint = event.touchPoints[0]; switch (event.type) { case kNIXInputEventTypeTouchMove: if (exceedsPanThreshold(touchPoint, m_firstTouchPoint)) setupPanningData(event.timestamp, touchPoint); break; case kNIXInputEventTypeTouchEnd: m_state = &GestureRecognizer::noGesture; m_client->handleDoubleTap(event.timestamp, touchPoint); break; case kNIXInputEventTypeTouchStart: m_state = &GestureRecognizer::pinchInProgress; setupPinchData(event); m_client->handlePinchStarted(event.timestamp); break; } }
void GestureRecognizer::singleTapPressed(const NIXTouchEvent& event) { cancelLongTapTimerIfNeeded(); const NIXTouchPoint& touchPoint = event.touchPoints[0]; switch (event.type) { case kNIXInputEventTypeTouchMove: if (exceedsPanThreshold(touchPoint, m_firstTouchPoint)) setupPanningData(event.timestamp, touchPoint); break; case kNIXInputEventTypeTouchEnd: m_state = &GestureRecognizer::waitForDoubleTap; m_timestamp = event.timestamp; startDoubleTapTimer(); break; case kNIXInputEventTypeTouchStart: m_state = &GestureRecognizer::pinchInProgress; setupPinchData(event); m_client->handlePinchStarted(event.timestamp); break; } }
void GestureRecognizer::doubleTapGesture(WKTouchEventRef eventRef) { WKArrayRef touchPoints = WKTouchEventGetTouchPoints(eventRef); switch (WKTouchEventGetType(eventRef)) { case kWKEventTypeTouchStart: { if (m_doubleTapTimer) { ecore_timer_del(m_doubleTapTimer); m_doubleTapTimer = 0; } size_t numberOfTouchPoints = WKArrayGetSize(touchPoints); if (numberOfTouchPoints == 1) { if (exceedsDoubleTapThreshold(m_firstPressedPoint, toIntPoint(getPointAtIndex(touchPoints, 0)))) m_recognizerFunction = &GestureRecognizer::singleTapGesture; } else { m_recognizerFunction = &GestureRecognizer::pinchGesture; m_gestureHandler->handlePinchStarted(createVectorWithWKArray(touchPoints, 2)); } break; } case kWKEventTypeTouchMove: { IntPoint currentPoint = toIntPoint(getPointAtIndex(touchPoints, 0)); if (exceedsPanThreshold(m_firstPressedPoint, currentPoint)) { m_recognizerFunction = &GestureRecognizer::panGesture; m_gestureHandler->handlePanStarted(currentPoint); } break; } case kWKEventTypeTouchEnd: m_gestureHandler->handleDoubleTap(m_firstPressedPoint); m_recognizerFunction = &GestureRecognizer::noGesture; break; default: ASSERT_NOT_REACHED(); break; } }