Android: Possible fix for multi-touch-stuck issue

This commit is contained in:
Connor McLaughlin 2020-10-09 18:34:42 +10:00
parent cb6502afa3
commit e7bf22c31f

View file

@ -93,10 +93,14 @@ public class TouchscreenControllerView extends FrameLayout {
{
Rect rect = new Rect();
final int pointerCount = event.getPointerCount();
final int liftedPointerIndex = (event.getActionMasked() == MotionEvent.ACTION_POINTER_UP) ? event.getActionIndex() : -1;
for (TouchscreenControllerButtonView buttonView : mButtonViews) {
buttonView.getHitRect(rect);
boolean pressed = false;
for (int i = 0; i < pointerCount; i++) {
if (i == liftedPointerIndex)
continue;
final int x = (int) event.getX(i);
final int y = (int) event.getY(i);
pressed |= rect.contains(x, y);