Class GestureDirector

java.lang.Object
react.Slot<Object>
playn.scene.Touch.Listener
tripleplay.gesture.GestureDirector
All Implemented Interfaces:
react.Reactor.RListener, react.SignalView.Listener<Object>, react.ValueView.Listener<Object>

public class GestureDirector extends Touch.Listener
Resolves user touch input in terms of a set of Gestures that are registered with this director. May either be used as a standalone listener on a layer, or along with a set of other regions in a given layer via GestureRegionDirector. Will only consider touches that start within the defined bounds, but if it is given touch events that end outside of the bounds, but started inside the bounds it will react to them.
  • Field Details

    • bounds

      public final pythagoras.f.IRectangle bounds
  • Constructor Details

    • GestureDirector

      public GestureDirector(Platform plat, pythagoras.f.IRectangle bounds, Timer timer)
  • Method Details

    • add

      public GestureDirector add(Gesture<?> gesture)
      Adds a gesture to the set considered during each user interaction. Returns this director for chaining.
    • remove

      public boolean remove(Gesture<?> gesture)
      Removes the given gesture from the set considered during each user interaction. Returns false if that gesture was not found.
    • touchInBounds

      public boolean touchInBounds(Touch.Interaction iact)
    • trackingTouch

      public boolean trackingTouch(Touch.Event touch)
    • greedyGesture

      public react.ValueView<Gesture<?>> greedyGesture()
    • pauseDelay

      public int pauseDelay()
      Returns the number of milliseconds to wait after the last touch event to transition the current gestures to PAUSE.
    • setPauseDelay

      public GestureDirector setPauseDelay(int value)
      Sets the number of milliseconds to wait after the last touch even to transition the current guestures to PAUSE. The default is 500 (half a second).
      Returns:
      this GestureDirector for call chaining.
    • onStart

      public void onStart(Touch.Interaction iact)
      Overrides:
      onStart in class Touch.Listener
    • onMove

      public void onMove(Touch.Interaction iact)
      Overrides:
      onMove in class Touch.Listener
    • onEnd

      public void onEnd(Touch.Interaction iact)
      Overrides:
      onEnd in class Touch.Listener
    • onCancel

      public void onCancel(Touch.Interaction iact)
      Overrides:
      onCancel in class Touch.Listener