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. 19
      engine/src/android/com/jme3/input/android/AndroidInput.java

@ -267,13 +267,18 @@ public class AndroidInput implements
lastPos = new Vector2f(event.getX(p), view.getHeight() - event.getY(p));
lastPositions.put(event.getPointerId(p), lastPos);
}
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.setPointerId(event.getPointerId(p));
touch.setTime(event.getEventTime());
touch.setPressure(event.getPressure(p));
processEvent(touch);
lastPos.set(event.getX(p), view.getHeight() - event.getY(p));
float dX = event.getX(p) - lastPos.x;
float dY = view.getHeight() - event.getY(p) - lastPos.y;
if (dX != 0 || dY != 0) {
touch = getNextFreeTouchEvent();
touch.set(Type.MOVE, event.getX(p), view.getHeight() - event.getY(p), dX, dY);
touch.setPointerId(event.getPointerId(p));
touch.setTime(event.getEventTime());
touch.setPressure(event.getPressure(p));
processEvent(touch);
lastPos.set(event.getX(p), view.getHeight() - event.getY(p));
}
}
bWasHandled = true;
break;

Loading…
Cancel
Save