-
public class MultiTouchController.PointInfoA class that packages up all MotionEvent information with all derived multitouch information (if available)
-
-
Method Summary
Modifier and Type Method Description Array<float>getXs()Return the array of X coords -- only the first getNumTouchPoints() of these is defined. Array<float>getYs()Return the array of Y coords -- only the first getNumTouchPoints() of these is defined. Array<float>getPressures()Return the array of pressures -- only the first getNumTouchPoints() of these is defined. Array<int>getPointerIds()Return the array of pointer ids -- only the first getNumTouchPoints() of these is defined. booleanisDown()booleanisMultiTouch()True if number of touch points greater than or equal to 2. intgetAction()longgetEventTime()voidset(MultiTouchController.PointInfo other)Copy all fields from one PointInfo class to another. floatgetMultiTouchWidth()Difference between x coords of touchpoint 0 and 1. floatgetMultiTouchHeight()Difference between y coords of touchpoint 0 and 1. floatgetMultiTouchDiameterSq()Calculate the squared diameter of the multitouch event, and cache it. floatgetMultiTouchDiameter()Calculate the diameter of the multitouch event, and cache it. floatgetMultiTouchAngle()Calculate the angle of a multitouch event, and cache it. intgetNumTouchPoints()Return the total number of touch points floatgetX()Return the X coord of the first touch point if there's only one, or the midpoint between first and second touch points if two or more. floatgetY()Return the X coord of the first touch point if there's only one, or the midpoint between first and second touch points if two or more. floatgetPressure()Return the pressure the first touch point if there's only one, or the average pressure of first and second touch points if two or more. -
-
Method Detail
-
getXs
Array<float> getXs()
Return the array of X coords -- only the first getNumTouchPoints() of these is defined.
-
getYs
Array<float> getYs()
Return the array of Y coords -- only the first getNumTouchPoints() of these is defined.
-
getPressures
Array<float> getPressures()
Return the array of pressures -- only the first getNumTouchPoints() of these is defined.
-
getPointerIds
Array<int> getPointerIds()
Return the array of pointer ids -- only the first getNumTouchPoints() of these is defined. These don't have to be all the numbers from 0 togetNumTouchPoints()-1 inclusive, numbers can be skipped if a finger is lifted and the touch sensor is capable of detecting that thatparticular touch point is no longer down. Note that a lot of sensors do not have this capability: when finger 1 is lifted up finger 2becomes the new finger 1. However in theory these IDs can correct for that. Convert back to indices using MotionEvent.findPointerIndex().
-
isDown
boolean isDown()
-
isMultiTouch
boolean isMultiTouch()
True if number of touch points greater than or equal to 2.
-
getAction
int getAction()
-
getEventTime
long getEventTime()
-
set
void set(MultiTouchController.PointInfo other)
Copy all fields from one PointInfo class to another. PointInfo objects are volatile so you should use this if you want to keep track of thelast touch event in your own code.
-
getMultiTouchWidth
float getMultiTouchWidth()
Difference between x coords of touchpoint 0 and 1.
-
getMultiTouchHeight
float getMultiTouchHeight()
Difference between y coords of touchpoint 0 and 1.
-
getMultiTouchDiameterSq
float getMultiTouchDiameterSq()
Calculate the squared diameter of the multitouch event, and cache it. Use this if you don't need to perform the sqrt.
-
getMultiTouchDiameter
float getMultiTouchDiameter()
Calculate the diameter of the multitouch event, and cache it. Uses fast int sqrt but gives accuracy to 1/16px.
-
getMultiTouchAngle
float getMultiTouchAngle()
Calculate the angle of a multitouch event, and cache it. Actually gives the smaller of the two angles between the x axis and the linebetween the two touchpoints, so range is [0,Math.PI/2]. Uses Math.atan2().
-
getNumTouchPoints
int getNumTouchPoints()
Return the total number of touch points
-
getX
float getX()
Return the X coord of the first touch point if there's only one, or the midpoint between first and second touch points if two or more.
-
getY
float getY()
Return the X coord of the first touch point if there's only one, or the midpoint between first and second touch points if two or more.
-
getPressure
float getPressure()
Return the pressure the first touch point if there's only one, or the average pressure of first and second touch points if two or more.
-
-
-
-