Class TouchEvent

Direct Known Subclasses:
ScrollStartEvent, ScrollStopEvent, SwipeEvent, SwipeLeftEvent, SwipeRightEvent, TapEvent, TapHoldEvent, TouchCancelEvent, TouchEndEvent, TouchMoveEvent, TouchStartEvent

public abstract class TouchEvent extends ClientEvent<TouchListener>
Abstract base class for all touch-related events in the client interface.

This class serves as the foundation for specific touch event types, providing a common framework for touch interactions on mobile and touch-enabled devices. All touch events extend this class and are dispatched to registered TouchListener instances. Touch events encompass both native browser touch events (touchstart, touchmove, touchend, touchcancel) and higher-level gestures such as taps, swipes, and scroll actions.

Features:

  • Provides coordinate and touch identity tracking for native touch events
  • Captures the number of active touch points
  • Serves as a base for both native touch and gesture event types
  • Integrates with the TouchListener interface
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructs a new TouchEvent with no coordinate data.
    protected
    TouchEvent(int clientX, int clientY, int identifier, int touchCount)
    Constructs a new TouchEvent with the specified touch data.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the X coordinate of the first changed touch relative to the client viewport.
    int
    Returns the Y coordinate of the first changed touch relative to the client viewport.
    int
    Returns the unique identifier of the touch point.
    int
    Returns the number of currently active touch points on the touch surface.

    Methods inherited from class com.oorian.messaging.events.client.ClientEvent

    getSource, getTarget, setSource, setTarget

    Methods inherited from class com.oorian.messaging.events.Event

    bubbles, dispatchTo

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TouchEvent

      protected TouchEvent()
      Constructs a new TouchEvent with no coordinate data.

      Used by gesture event subclasses (TapEvent, SwipeEvent, etc.) that do not carry individual touch coordinate information.

    • TouchEvent

      protected TouchEvent(int clientX, int clientY, int identifier, int touchCount)
      Constructs a new TouchEvent with the specified touch data.

      Used by native touch event subclasses (TouchStartEvent, TouchMoveEvent, etc.) that carry coordinate and touch identity information from the browser.

      Parameters:
      clientX - the X coordinate of the first changed touch relative to the client viewport
      clientY - the Y coordinate of the first changed touch relative to the client viewport
      identifier - the unique identifier of the touch point
      touchCount - the number of currently active touch points
  • Method Details

    • getClientX

      public int getClientX()
      Returns the X coordinate of the first changed touch relative to the client viewport.
      Returns:
      the X coordinate of the touch event
    • getClientY

      public int getClientY()
      Returns the Y coordinate of the first changed touch relative to the client viewport.
      Returns:
      the Y coordinate of the touch event
    • getIdentifier

      public int getIdentifier()
      Returns the unique identifier of the touch point.

      Each touch point is assigned a unique identifier that persists for the duration of the touch interaction, allowing tracking of individual fingers across touchstart, touchmove, and touchend events.

      Returns:
      the touch point identifier
    • getTouchCount

      public int getTouchCount()
      Returns the number of currently active touch points on the touch surface.
      Returns:
      the number of active touches