@@ -222,6 +222,12 @@ public class PApplet extends Object implements PConstants {
222
222
protected int mousePointerId ;
223
223
224
224
225
+ /**
226
+ * ID of the most recently touch pointer gone up or down.
227
+ */
228
+ protected int touchPointerId ;
229
+
230
+
225
231
/**
226
232
* Last key pressed.
227
233
* <P>
@@ -2039,6 +2045,8 @@ protected void handleMouseEvent(MouseEvent event) {
2039
2045
2040
2046
2041
2047
protected void handleTouchEvent (TouchEvent event ) {
2048
+ touches = event .getTouches (touches );
2049
+
2042
2050
switch (event .getAction ()) {
2043
2051
case TouchEvent .START :
2044
2052
touchPressed = true ;
@@ -2064,8 +2072,6 @@ protected void handleTouchEvent(TouchEvent event) {
2064
2072
touchCancelled (event );
2065
2073
break ;
2066
2074
}
2067
-
2068
- touches = event .getTouches (touches );
2069
2075
}
2070
2076
2071
2077
@@ -2121,6 +2127,9 @@ protected void enqueueTouchEvents(MotionEvent event, int button, int modifiers)
2121
2127
case MotionEvent .ACTION_DOWN :
2122
2128
paction = TouchEvent .START ;
2123
2129
break ;
2130
+ case MotionEvent .ACTION_POINTER_DOWN :
2131
+ paction = TouchEvent .START ;
2132
+ break ;
2124
2133
case MotionEvent .ACTION_MOVE :
2125
2134
paction = TouchEvent .MOVE ;
2126
2135
break ;
@@ -2136,6 +2145,10 @@ protected void enqueueTouchEvents(MotionEvent event, int button, int modifiers)
2136
2145
break ;
2137
2146
}
2138
2147
2148
+ if (paction == TouchEvent .START || paction == TouchEvent .END ) {
2149
+ touchPointerId = event .getPointerId (0 );
2150
+ }
2151
+
2139
2152
int pointerCount = event .getPointerCount ();
2140
2153
2141
2154
if (actionMasked == MotionEvent .ACTION_MOVE ) {
0 commit comments