Merge pull request #11686 from t895/index-fix
Android: Ignore input from invalid pointer identifier
This commit is contained in:
commit
7de01597c6
|
@ -108,20 +108,21 @@ public class InputOverlayPointer
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackId == -1)
|
int eventPointerIndex = event.findPointerIndex(trackId);
|
||||||
|
if (trackId == -1 || eventPointerIndex == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mMode == MODE_FOLLOW)
|
if (mMode == MODE_FOLLOW)
|
||||||
{
|
{
|
||||||
mCurrentX = (event.getX(event.findPointerIndex(trackId)) - mGameCenterX) * mGameWidthHalfInv;
|
mCurrentX = (event.getX(eventPointerIndex) - mGameCenterX) * mGameWidthHalfInv;
|
||||||
mCurrentY = (event.getY(event.findPointerIndex(trackId)) - mGameCenterY) * mGameHeightHalfInv;
|
mCurrentY = (event.getY(eventPointerIndex) - mGameCenterY) * mGameHeightHalfInv;
|
||||||
}
|
}
|
||||||
else if (mMode == MODE_DRAG)
|
else if (mMode == MODE_DRAG)
|
||||||
{
|
{
|
||||||
mCurrentX = mOldX +
|
mCurrentX = mOldX +
|
||||||
(event.getX(event.findPointerIndex(trackId)) - mTouchStartX) * mGameWidthHalfInv;
|
(event.getX(eventPointerIndex) - mTouchStartX) * mGameWidthHalfInv;
|
||||||
mCurrentY = mOldY +
|
mCurrentY = mOldY +
|
||||||
(event.getY(event.findPointerIndex(trackId)) - mTouchStartY) * mGameHeightHalfInv;
|
(event.getY(eventPointerIndex) - mTouchStartY) * mGameHeightHalfInv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue