Package playn.scene

Class Interaction<E extends Event.XY>

java.lang.Object
playn.scene.Interaction<E>
All Implemented Interfaces:
XY
Direct Known Subclasses:
Mouse.Interaction, Pointer.Interaction, Touch.Interaction

public abstract class Interaction<E extends Event.XY> extends Object implements XY
Contains information about the interaction of which an event is a part.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Used to configure capture().
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The event currently being dispatched in this interaction.
    final Layer
    The layer that was hit at the start of this interaction.
    final Point
    The current event's location, translated into the hit layer's coordinate space.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Interaction(Layer hitLayer, boolean bubble)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Cancels this interaction.
    void
    Captures this interaction in ONLY mode.
    void
    Captures this interaction in the specified capture mode.
    boolean
    Returns whether this interaction is captured.
     
    float
    x()
    Returns event's x coordinate, for convenience.
    float
    y()
    Returns event's y coordinate, for convenience.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • hitLayer

      public final Layer hitLayer
      The layer that was hit at the start of this interaction.
    • local

      public final Point local
      The current event's location, translated into the hit layer's coordinate space.
    • event

      public E extends Event.XY event
      The event currently being dispatched in this interaction.
  • Constructor Details

    • Interaction

      public Interaction(Layer hitLayer, boolean bubble)
  • Method Details

    • x

      public float x()
      Returns event's x coordinate, for convenience.
      Specified by:
      x in interface XY
    • y

      public float y()
      Returns event's y coordinate, for convenience.
      Specified by:
      y in interface XY
    • captured

      public boolean captured()
      Returns whether this interaction is captured.
    • capture

      public void capture()
      Captures this interaction in ONLY mode. This causes subsequent events in this interaction to go only to the layer which is currently handling the interaction. Other layers in the interaction will receive a cancellation event and nothing further.
    • capture

      public void capture(Interaction.CaptureMode mode)
      Captures this interaction in the specified capture mode. Depending on the mode, subsequent events will go only to the current layer, or that layer and its parents, or that layer and its children. Other layers in the interaction will receive a cancellation event and nothing further.
    • cancel

      public void cancel()
      Cancels this interaction. All layers which normally participate in the action will be notified of the cancellation.
    • toString

      public String toString()
      Overrides:
      toString in class Object