Package arc.input

Interface GestureDetector.GestureListener

All Known Implementing Classes:
DesktopInput, InputHandler, MapView, MobileInput
Enclosing class:
GestureDetector

public static interface GestureDetector.GestureListener
Register an instance of this class with a GestureDetector to receive gestures such as taps, long presses, flings, panning or pinch zooming. Each method returns a boolean indicating if the event should be handed to the next listener (false to hand it to the next listener, true otherwise).
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    fling(float velocityX, float velocityY, KeyCode button)
    Called when the user dragged a finger over the screen and lifted it.
    default boolean
    longPress(float x, float y)
     
    default boolean
    pan(float x, float y, float deltaX, float deltaY)
    Called when the user drags a finger over the screen.
    default boolean
    panStop(float x, float y, int pointer, KeyCode button)
    Called when no longer panning.
    default boolean
    pinch(Vec2 initialPointer1, Vec2 initialPointer2, Vec2 pointer1, Vec2 pointer2)
    Called when a user performs a pinch zoom gesture.
    default void
    Called when no longer pinching.
    default boolean
    tap(float x, float y, int count, KeyCode button)
    Called when a tap occured.
    default boolean
    touchDown(float x, float y, int pointer, KeyCode button)
     
    default boolean
    zoom(float initialDistance, float distance)
    Called when the user performs a pinch zoom gesture.
  • Method Details

    • touchDown

      default boolean touchDown(float x, float y, int pointer, KeyCode button)
    • tap

      default boolean tap(float x, float y, int count, KeyCode button)
      Called when a tap occured. A tap happens if a touch went down on the screen and was lifted again without moving outside of the tap square. The tap square is a rectangular area around the initial touch position as specified on construction time of the GestureDetector.
      Parameters:
      count - the number of taps.
    • longPress

      default boolean longPress(float x, float y)
    • fling

      default boolean fling(float velocityX, float velocityY, KeyCode button)
      Called when the user dragged a finger over the screen and lifted it. Reports the last known velocity of the finger in pixels per second.
      Parameters:
      velocityX - velocity on x in seconds
      velocityY - velocity on y in seconds
    • pan

      default boolean pan(float x, float y, float deltaX, float deltaY)
      Called when the user drags a finger over the screen.
      Parameters:
      deltaX - the difference in pixels to the last drag event on x.
      deltaY - the difference in pixels to the last drag event on y.
    • panStop

      default boolean panStop(float x, float y, int pointer, KeyCode button)
      Called when no longer panning.
    • zoom

      default boolean zoom(float initialDistance, float distance)
      Called when the user performs a pinch zoom gesture. The original distance is the distance in pixels when the gesture started.
      Parameters:
      initialDistance - distance between fingers when the gesture started.
      distance - current distance between fingers.
    • pinch

      default boolean pinch(Vec2 initialPointer1, Vec2 initialPointer2, Vec2 pointer1, Vec2 pointer2)
      Called when a user performs a pinch zoom gesture. Reports the initial positions of the two involved fingers and their current positions.
    • pinchStop

      default void pinchStop()
      Called when no longer pinching.