GesturePointersUtility

  • The GesturePointersUtility class manages pointer IDs to ensure each pointer is used in only one gesture at a time.

  • It provides methods for converting touch coordinates between pixels and inches (inchesToPixels, pixelsToInches).

  • You can check if a pointer ID is currently retained using isPointerIdRetained.

  • The motionEventToPosition method converts a MotionEvent and pointer ID into a 3D position vector.

  • Pointer IDs can be retained and released using retainPointerId and releasePointerId, respectively.

public class GesturePointersUtility

Retains/Releases pointer Ids so that each pointer can only be used in one gesture at a time. Provides helper functions for converting touch coordinates between pixels and inches.

Public Constructors

Public Methods

float
inchesToPixels(float inches)
boolean
isPointerIdRetained(int pointerId)
static Vector3
motionEventToPosition(MotionEvent me, int pointerId)
float
pixelsToInches(float pixels)
void
releasePointerId(int pointerId)
void
retainPointerId(int pointerId)

Inherited Methods

Public Constructors

public GesturePointersUtility (DisplayMetrics displayMetrics)

Parameters
displayMetrics

Public Methods

public float inchesToPixels (float inches)

Parameters
inches

public boolean isPointerIdRetained (int pointerId)

Parameters
pointerId

public static Vector3 motionEventToPosition (MotionEvent me, int pointerId)

Parameters
me
pointerId

public float pixelsToInches (float pixels)

Parameters
pixels

public void releasePointerId (int pointerId)

Parameters
pointerId

public void retainPointerId (int pointerId)

Parameters
pointerId