Revert "cmd/ebitenmobile: bug fix: multiple touches were not updated correctly on Android"

This reverts commit 64b051cc38.

Reason: This fix has a limited impact

Updates #2220
This commit is contained in:
Hajime Hoshi 2022-08-05 19:59:21 +09:00
parent 0d65b16e4b
commit af4832b0ad
2 changed files with 2 additions and 7 deletions

View File

@ -419,16 +419,11 @@ public class EbitenView extends ViewGroup implements InputManager.InputDeviceLis
@Override
public boolean onTouchEvent(MotionEvent e) {
// getActionIndex returns a valid value only for the action whose index is the returned value of getActionIndex (#2220).
// See https://developer.android.com/reference/android/view/MotionEvent#getActionMasked().
// For other pointers, treat their actions as MotionEvent.ACTION_MOVE.
int touchIndex = e.getActionIndex();
for (int i = 0; i < e.getPointerCount(); i++) {
int id = e.getPointerId(i);
int x = (int)e.getX(i);
int y = (int)e.getY(i);
int action = (i == touchIndex) ? e.getActionMasked() : MotionEvent.ACTION_MOVE;
Ebitenmobileview.updateTouchesOnAndroid(action, id, (int)pxToDp(x), (int)pxToDp(y));
Ebitenmobileview.updateTouchesOnAndroid(e.getActionMasked(), id, (int)pxToDp(x), (int)pxToDp(y));
}
return true;
}

File diff suppressed because one or more lines are too long