@@ -222,6 +222,12 @@ public class PApplet extends Object implements PConstants {
222222 protected int mousePointerId ;
223223
224224
225+ /**
226+ * ID of the most recently touch pointer gone up or down.
227+ */
228+ protected int touchPointerId ;
229+
230+
225231 /**
226232 * Last key pressed.
227233 * <P>
@@ -2039,6 +2045,8 @@ protected void handleMouseEvent(MouseEvent event) {
20392045
20402046
20412047 protected void handleTouchEvent (TouchEvent event ) {
2048+ touches = event .getTouches (touches );
2049+
20422050 switch (event .getAction ()) {
20432051 case TouchEvent .START :
20442052 touchPressed = true ;
@@ -2064,8 +2072,6 @@ protected void handleTouchEvent(TouchEvent event) {
20642072 touchCancelled (event );
20652073 break ;
20662074 }
2067-
2068- touches = event .getTouches (touches );
20692075 }
20702076
20712077
@@ -2121,6 +2127,9 @@ protected void enqueueTouchEvents(MotionEvent event, int button, int modifiers)
21212127 case MotionEvent .ACTION_DOWN :
21222128 paction = TouchEvent .START ;
21232129 break ;
2130+ case MotionEvent .ACTION_POINTER_DOWN :
2131+ paction = TouchEvent .START ;
2132+ break ;
21242133 case MotionEvent .ACTION_MOVE :
21252134 paction = TouchEvent .MOVE ;
21262135 break ;
@@ -2136,6 +2145,10 @@ protected void enqueueTouchEvents(MotionEvent event, int button, int modifiers)
21362145 break ;
21372146 }
21382147
2148+ if (paction == TouchEvent .START || paction == TouchEvent .END ) {
2149+ touchPointerId = event .getPointerId (0 );
2150+ }
2151+
21392152 int pointerCount = event .getPointerCount ();
21402153
21412154 if (actionMasked == MotionEvent .ACTION_MOVE ) {
0 commit comments