forked from extern/Unexpected-Keyboard
Correctly handle pointer cancel events
The cancel event ends the motion, it doesn't apply to a single pointer like it was previously expected.
This commit is contained in:
parent
aaf3d8b630
commit
804ea84981
@ -172,7 +172,7 @@ public class Keyboard2View extends View
|
|||||||
_pointers.onTouchMove(event.getX(p), event.getY(p), event.getPointerId(p));
|
_pointers.onTouchMove(event.getX(p), event.getY(p), event.getPointerId(p));
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
_pointers.onTouchCancel(event.getPointerId(event.getActionIndex()));
|
_pointers.onTouchCancel();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return (false);
|
return (false);
|
||||||
|
@ -48,6 +48,8 @@ public final class Pointers implements Handler.Callback
|
|||||||
|
|
||||||
public void clear()
|
public void clear()
|
||||||
{
|
{
|
||||||
|
for (Pointer p : _ptrs)
|
||||||
|
stopKeyRepeat(p);
|
||||||
_ptrs.clear();
|
_ptrs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,13 +130,9 @@ public final class Pointers implements Handler.Callback
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTouchCancel(int pointerId)
|
public void onTouchCancel()
|
||||||
{
|
{
|
||||||
Pointer ptr = getPtr(pointerId);
|
clear();
|
||||||
if (ptr == null)
|
|
||||||
return;
|
|
||||||
stopKeyRepeat(ptr);
|
|
||||||
removePtr(ptr);
|
|
||||||
_handler.onPointerFlagsChanged(true);
|
_handler.onPointerFlagsChanged(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user