Function getTouchGestureFragment

Returns a GestureFragment for the given events. Only "touchmove" events will be considered.

If there are less than 2 such events in the given list of events, returns false.

If the gesture is to be considered terminated, e.g. because there is "touchcancel" in the list, returns null.

Note that by default swipe actions follow the natural direction: swipe up with scroll intent results in direction down and swipe down results in direction up. Drag intent always follows the direction of the gesture.

For zoom intents, which necessarily involves exactly two fingers deltaZ is based on the relative change in distance between the fingers.

  • Parameters

    • events: Event[]
    • Optionaloptions: {
          angleDiffThreshold?: number;
          deltaThreshold?: number;
          dragHoldTime?: number;
          dragNumFingers?: number;
          reverseScroll?: boolean;
      }
      • OptionalangleDiffThreshold?: number
      • OptionaldeltaThreshold?: number

        A change of x or y coordinate less than this is considered insignificant, for the purposes of determining: 1) whether the inferred direction is in one of the four cardinal ones, or otherwise ambiguous; and 2) whether more than two fingers have moved and therefore whether the direction could be zoom or not

      • OptionaldragHoldTime?: number

        If the user presses and holds for at least the given amount of milliseconds before moving the finger(s), gestures other than pinch will be treated as a drag instead of scroll as long as the number of fingers touching the screen is options.dragNumFingers. Default is 500ms.

      • OptionaldragNumFingers?: number

        The number of fingers that could be considered a drag intent. Default is 1.

      • OptionalreverseScroll?: boolean

        If set to true, will disable natural scroll direction.

    Returns null | false | GestureFragment

    false if there are less than 2 "touchmove" events in the list, null if the gesture is terminated, otherwise a GestureFragment.