Permalink
Browse files

Single touch is now working

  • Loading branch information...
1 parent 1020f03 commit 4effee37212711e5ebc5cbf15be3f5a4efa5544b @rjmarsan committed Dec 22, 2011
@@ -116,9 +116,9 @@ private MotionEvent makeOrUpdateMotionEvent(TuioContainer point, long id, int ac
int totalcursors = getNumCursors();
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP) {
//totalcursors -= 1;
- if (totalcursors <= 0) { //no cursors is a special case
+ if (totalcursors <= 1) { //no cursors is a special case
//id = -1;
- //totalcursors = 1;
+ totalcursors = 1;
action = MotionEvent.ACTION_UP; //no more ACTION_POINTER_UP. need to be serious.
}
}
@@ -185,8 +185,8 @@ public int compare(TuioCursor object1, TuioCursor object2) {
}
}
else {
- currentEvent = MotionEvent.obtain(startms, SystemClock.uptimeMillis(), actionmasked, totalcursors, pointerIds, inData, 0, 0.0f, 0.0f, 0, 0, 0, 0);
- // return null; //EEK! something happened in the middle of us doing stuff.
+ //currentEvent = MotionEvent.obtain(startms, SystemClock.uptimeMillis(), actionmasked, totalcursors, pointerIds, inData, 0, 0.0f, 0.0f, 0, 0, 0, 0);
+ if (1==1) return null; //EEK! something happened in the middle of us doing stuff.
synchronized(events) {
if (currentEvent != null)
events.add(currentEvent);
@@ -236,7 +236,8 @@ public void addTuioObject(TuioObject tobj) {
private void addTuioThing(TuioContainer point, long id) {
// Log.d(TAG, "forwarding");
- int event = (id == 0) ? MotionEvent.ACTION_DOWN : MotionEvent.ACTION_POINTER_DOWN;
+ //int event = (id == id) ? MotionEvent.ACTION_DOWN : MotionEvent.ACTION_POINTER_DOWN;
+ int event = (getNumCursors() <= 1) ? MotionEvent.ACTION_DOWN : MotionEvent.ACTION_POINTER_DOWN;
MotionEvent me = makeOrUpdateMotionEvent(point, id, event);
// callback.sendMotionEvent(me);
this.sendUpDownEvent(me);
@@ -277,7 +278,7 @@ public void removeTuioObject(TuioObject tobj) {
private void removeTuioThing(TuioContainer point, long id) {
// Log.d(TAG, "forwarding");
- int event = (id == 0) ? MotionEvent.ACTION_UP : MotionEvent.ACTION_POINTER_UP;
+ int event = (id == id) ? MotionEvent.ACTION_UP : MotionEvent.ACTION_POINTER_UP;
MotionEvent me = makeOrUpdateMotionEvent(point, id, event);
//callback.sendMotionEvent(me);
this.sendUpDownEvent(me);
Binary file not shown.
Binary file not shown.

0 comments on commit 4effee3

Please sign in to comment.