Class Touch

Touch handler input is used to handle touch events.

Each touch point

Hierarchy (view full)

Constructors

Properties

domElement: HTMLElement | Window = null

DOM element where to attach the touch events.

events: EventManager = null

Event manager used for the touch inputs.

maxPoints: number = 3

How many touch inputs to support in the handler.

pinch: number = null

Distance delta between two points in adjacent frames.

points: TouchPoint[] = []

Touch points, these are created as required by the touch handler.

Methods

  • Dispose touch events.

    Should be called after the touch handler is no longer required.

    Returns void

  • Create touch handler events.

    Events created are managed by the event manager instance.

    Returns void

  • Check for multi touch pan movement.

    Return null if there are no point available to calculate the movement.

    Parameters

    • fingers: number

    Returns {
        delta: Vector2;
        position: Vector2;
    }

    the position and delta of the pan group.

  • Pinch to zoom actions.

    Returns number

    The two finger pinch values.

  • Check if a touch button was just pressed.

    Parameters

    • idx: number

      Index of the touch point.

    Returns boolean

    True if the point has just been pressed.

  • Check if a touch button was just released.

    Parameters

    • idx: number

      Index of the touch point.

    Returns boolean

    True if the point has just released.

  • Check if touch button is currently pressed.

    Parameters

    • idx: number

      Index of the touch point.

    Returns boolean

    True if the point is currently pressed.

  • Update the touch handler, should be called every frame before reading values.

    Returns void

  • Update touch input state, position and delta synchronously.

    Parameters

    • id: number

      Identifier of the point to be updated.

    • action: number

      Action applied to the point.

    • pressure: number

      Touch pressure of the point.

    • rotation: number

      Rotation of the point.

    • position: Vector2
    • radius: Vector2

    Returns void