From 48b40f4e3c9e1d2862a7444439f7bdda891ca575 Mon Sep 17 00:00:00 2001 From: "pot..om" Date: Sat, 28 Jul 2012 23:11:47 +0000 Subject: [PATCH] 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 --- .../com/jme3/input/android/AndroidInput.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/engine/src/android/com/jme3/input/android/AndroidInput.java b/engine/src/android/com/jme3/input/android/AndroidInput.java index 4146fe5a1..618b5cde3 100644 --- a/engine/src/android/com/jme3/input/android/AndroidInput.java +++ b/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;