- ANDROID fixed multitouch move taht was not sending additional pointers event. thanks to iwgeric

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9438 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent d76d58c0e9
commit cd64f74898
  1. 15
      engine/src/android/com/jme3/input/android/AndroidInput.java

@ -232,7 +232,6 @@ public class AndroidInput extends GLSurfaceView implements
// final int historySize = event.getHistorySize(); // final int historySize = event.getHistorySize();
//final int pointerCount = event.getPointerCount(); //final int pointerCount = event.getPointerCount();
switch (action) { switch (action) {
case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
@ -260,18 +259,18 @@ public class AndroidInput extends GLSurfaceView implements
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE:
// Convert all pointers into events // Convert all pointers into events
for (int p = 0; p < event.getPointerCount(); p++) { for (int p = 0; p < event.getPointerCount(); p++) {
Vector2f lastPos = lastPositions.get(pointerIndex); Vector2f lastPos = lastPositions.get(p);
if (lastPos == null) { if (lastPos == null) {
lastPos = new Vector2f(event.getX(pointerIndex), this.getHeight() - event.getY(pointerIndex)); lastPos = new Vector2f(event.getX(p), this.getHeight() - event.getY(p));
lastPositions.put(pointerId, lastPos); lastPositions.put(event.getPointerId(p), lastPos);
} }
touch = getNextFreeTouchEvent(); touch = getNextFreeTouchEvent();
touch.set(Type.MOVE, event.getX(pointerIndex), this.getHeight() - event.getY(pointerIndex), event.getX(pointerIndex) - lastPos.x, this.getHeight() - event.getY(pointerIndex) - lastPos.y); touch.set(Type.MOVE, event.getX(p), this.getHeight() - event.getY(p), event.getX(p) - lastPos.x, this.getHeight() - event.getY(p) - lastPos.y);
touch.setPointerId(pointerId); touch.setPointerId(event.getPointerId(p));
touch.setTime(event.getEventTime()); touch.setTime(event.getEventTime());
touch.setPressure(event.getPressure(pointerIndex)); touch.setPressure(event.getPressure(p));
processEvent(touch); processEvent(touch);
lastPos.set(event.getX(pointerIndex), this.getHeight() - event.getY(pointerIndex)); lastPos.set(event.getX(p), this.getHeight() - event.getY(p));
} }
bWasHandled = true; bWasHandled = true;
break; break;

Loading…
Cancel
Save