Class GestureRegionDirector

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

public class GestureRegionDirector extends Touch.Listener
Handles multiple GestureDirectors listening on a single layer. A GestureDirector is only given a touch start event if it originated within that director's region bounds. It is only given one of the other events if that event is for a touch that started within that director's region bounds.
  • Constructor Details

    • GestureRegionDirector

      public GestureRegionDirector(Platform plat, Timer timer)
      Creates an uninitalized GestureRegionDirector. setLayer() must be called separately.
    • GestureRegionDirector

      public GestureRegionDirector(Platform plat, Timer timer, Layer layer, pythagoras.f.IRectangle bounds)
      Creates a GestureRegionDirector with default options.
      Parameters:
      bounds - The bounds in which to react to touch events.
  • Method Details

    • setLayer

      public GestureRegionDirector setLayer(Layer layer, pythagoras.f.IRectangle bounds)
    • remove

      public void remove()
    • getRegions

      public Collection<GestureDirector> getRegions()
    • getRegion

      public GestureDirector getRegion(float x, float y, float width, float height)
      Gets a Region instance bounded by the given dimensions. The given bounds will restricted to the given bounds of this GestureRegionDirector, and null may be returned if suitable bounds are not found or a conflicting region was already defined on this GestureRegionDirector.
    • getRegion

      public GestureDirector getRegion(pythagoras.f.IRectangle bounds)
      Gets a Region instance bounded by the given dimensions. The given bounds will be restricted to the given bounds of this GestureRegionDirector, and null may be returned if suitable bounds are not found or a conflicting region was already defined on this GestureRegionDirector.
    • getPercentRegion

      public GestureDirector getPercentRegion(float perX, float perY, float perWidth, float perHeight)
      Gets a region bounded by the given dimensions as defined as percentages of this GestureRegionDirector's defined bounds. Null may be returned if suitable bounds are not found or a conflicting Region was already defined on this GestureRegionDirector.
    • getPercentRegion

      public GestureDirector getPercentRegion(pythagoras.f.IRectangle bounds)
      Gets a Region instance bounded by the given dimensions as defined as percentages of this GestureRegionDirector's defined bounds. Null may be returned if suitable bounds are not found or a conflicting Region was already defined on this GestureRegionDirector.
    • 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