Fixed issue where MOVE events were being generated even if the deltaX and deltaY were both 0. Now MOVE events with both deltaX and deltaY values of 0 will not be generated. See post http://jmonkeyengine.org/groups/android/forum/topic/differentiating-tap-from-a-quick-downmoveup/

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9596 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
pot..om 13 years ago
parent 0deeb597f1
commit 48b40f4e3c
  1. 7
      engine/src/android/com/jme3/input/android/AndroidInput.java

@ -267,14 +267,19 @@ public class AndroidInput implements
lastPos = new Vector2f(event.getX(p), view.getHeight() - event.getY(p)); lastPos = new Vector2f(event.getX(p), view.getHeight() - event.getY(p));
lastPositions.put(event.getPointerId(p), lastPos); lastPositions.put(event.getPointerId(p), lastPos);
} }
float dX = event.getX(p) - lastPos.x;
float dY = view.getHeight() - event.getY(p) - lastPos.y;
if (dX != 0 || dY != 0) {
touch = getNextFreeTouchEvent(); touch = getNextFreeTouchEvent();
touch.set(Type.MOVE, event.getX(p), view.getHeight() - event.getY(p), event.getX(p) - lastPos.x, view.getHeight() - event.getY(p) - lastPos.y); touch.set(Type.MOVE, event.getX(p), view.getHeight() - event.getY(p), dX, dY);
touch.setPointerId(event.getPointerId(p)); touch.setPointerId(event.getPointerId(p));
touch.setTime(event.getEventTime()); touch.setTime(event.getEventTime());
touch.setPressure(event.getPressure(p)); touch.setPressure(event.getPressure(p));
processEvent(touch); processEvent(touch);
lastPos.set(event.getX(p), view.getHeight() - event.getY(p)); lastPos.set(event.getX(p), view.getHeight() - event.getY(p));
} }
}
bWasHandled = true; bWasHandled = true;
break; break;
case MotionEvent.ACTION_OUTSIDE: case MotionEvent.ACTION_OUTSIDE:

Loading…
Cancel
Save