Class PointerEvent

java.lang.Object
com.myscript.iink.PointerEvent

public class PointerEvent extends Object
Represents a pointer event.
  • Field Details

    • eventType

      @NotNull public @NotNull PointerEventType eventType
      The event type.
    • x

      public float x
      The event x coordinate.
    • y

      public float y
      The event y coordinate.
    • t

      public long t
      The event timestamp in ms since Unix EPOCH, or -1.
    • f

      public float f
      The event normalized pressure, in [0,1].
    • tilt

      public float tilt
      The event tilt in radians. 0 is perpendicular, Pi/2 if flat on screen.
      Since:
      4.0
    • orientation

      public float orientation
      The event orientation in radians. 0 is pointing up, -Pi/2 is left, Pi/2 is right, +/-Pi is down.
      Since:
      4.0
    • pointerType

      @NotNull public @NotNull PointerType pointerType
      The type of input pointer.
    • pointerId

      public int pointerId
      The id of the pointer.
  • Constructor Details

    • PointerEvent

      public PointerEvent()
      Default constructor. Construct a Pen Cancel event.
    • PointerEvent

      public PointerEvent(@NotNull @NotNull PointerEvent other)
      Copy constructor.
      Parameters:
      other - the pointer event to copy.
    • PointerEvent

      public PointerEvent(@NotNull @NotNull PointerEventType eventType, float x, float y, long t, float f, @NotNull @NotNull PointerType pointerType, int pointerId)
      Constructs a PointerEvent
      Parameters:
      eventType - the event type.
      x - the event x coordinate.
      y - the event y coordinate.
      t - the event timestamp in ms since Unix EPOCH, or -1.
      f - the event pressure.
      pointerType - the event pointer type.
      pointerId - the event pointer identifier.
    • PointerEvent

      public PointerEvent(@NotNull @NotNull PointerEventType eventType, float x, float y, long t, float f, float tilt, float orientation, @NotNull @NotNull PointerType pointerType, int pointerId)
      Constructs a PointerEvent
      Parameters:
      eventType - the event type.
      x - the event x coordinate.
      y - the event y coordinate.
      t - the event timestamp in ms since Unix EPOCH, or -1.
      f - the event pressure.
      tilt - the event tilt in radians.
      orientation - the event orientation in radians.
      pointerType - the event pointer type.
      pointerId - the event pointer identifier.
      Since:
      4.0
  • Method Details

    • down

      @NotNull public @NotNull PointerEvent down(float x, float y)
      Update this event to a "down" event.
      Parameters:
      x - the x coordinate location.
      y - the y coordinate location.
      Returns:
      this.
    • move

      @NotNull public @NotNull PointerEvent move(float x, float y)
      Update this event to a "move" event.
      Parameters:
      x - the x coordinate location.
      y - the y coordinate location.
      Returns:
      this.
    • up

      @NotNull public @NotNull PointerEvent up(float x, float y)
      Update this event to a "up" event.
      Parameters:
      x - the x coordinate location.
      y - the y coordinate location.
      Returns:
      this.
    • timestamp

      @NotNull public @NotNull PointerEvent timestamp(long t)
      Update the event timestamp.
      Parameters:
      t - the timestamp value.
      Returns:
      this.
    • force

      @NotNull public @NotNull PointerEvent force(float f)
      Update the event pressure.
      Parameters:
      f - the pressure value.
      Returns:
      this.
    • tiltAngle

      @NotNull public @NotNull PointerEvent tiltAngle(float tilt)
      Update the event tilt angle.
      Parameters:
      tilt - the tilt value.
      Returns:
      this.
      Since:
      4.0
    • orientationAngle

      @NotNull public @NotNull PointerEvent orientationAngle(float orientation)
      Update the event orientation angle.
      Parameters:
      orientation - the orientation value.
      Returns:
      this.
      Since:
      4.0
    • type

      @NotNull public @NotNull PointerEvent type(@NotNull @NotNull PointerType pointerType)
      Update the event pointer type.
      Parameters:
      pointerType - the pointer type.
      Returns:
      this.
    • id

      @NotNull public @NotNull PointerEvent id(int pointerId)
      Update the event pointer id.
      Parameters:
      pointerId - the pointer id value.
      Returns:
      this.
    • hasTiltInfo

      public boolean hasTiltInfo()
      Check whether the event has tilt and orientation information.
      Returns:
      true if the event has tilt and orientation info, otherwise false.
      Since:
      4.0
    • equals

      public boolean equals(@Nullable @Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @NotNull public final @NotNull String toString()
      Overrides:
      toString in class Object