static status cancelPopupGesture(PopupGesture g, EventObj ev) { assign(g, current, NIL); assign(g, context, NIL); return cancelGesture((Gesture)g, ev); }
void TapAndHoldDetector::initGesture( const Positions& positions ) { cancelGesture(); if( !positions.empty( )) { _touchStartPos = positions; _tapAndHoldTimer.start(); } }
void DoubleTapDetector::initGesture(const Positions& positions) { if (!_canBeDoubleTap) { // adding initial points if (positions.size() > _touchStartPos.size()) { if (_touchStartPos.empty()) _startGesture(positions); else _touchStartPos = positions; return; } // all points released, decide if potential double tap or abort if (positions.empty()) { _canBeDoubleTap = _doubleTapTimer.isActive(); if (!_canBeDoubleTap) cancelGesture(); } return; } // points pressed again, check for double tap if (positions.size() == _touchStartPos.size() && !MathUtils::hasMoved(positions, _touchStartPos, _doubleTapThresholdPx)) { emit doubleTap(MathUtils::computeCenter(_touchStartPos), _touchStartPos.size()); _doubleTapTimer.stop(); } // all points released, reset everything for next detection if (positions.empty()) cancelGesture(); }
void TapAndHoldDetector::_cancelGestureIfMoved( const Positions& positions ) { if( MathUtils::hasMoved( positions, _touchStartPos, _moveThresholdPx )) cancelGesture(); }