Revert "[android] Fixed multitouch for drag and zoom"

This reverts commit d69820f375c757b7cceb2610f49c50c1db7b236f.

Conflicts:

	android/src/com/mapswithme/maps/SmartGLActivity.java
This commit is contained in:
rachytski 2012-01-30 19:29:31 +04:00 committed by Alex Zolotarev
parent 3d1dafcd73
commit d59c16a379
2 changed files with 8 additions and 27 deletions

View file

@ -1,7 +1,6 @@
package com.mapswithme.maps;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;

View file

@ -115,57 +115,39 @@ public class SmartGLSurfaceView extends GLSurfaceView
}
}
private final static int START_CMD = 0;
private final static int DO_CMD = 1;
private final static int STOP_CMD = 2;
@Override
public boolean onTouchEvent (MotionEvent event)
{
switch (event.getAction() & MotionEvent.ACTION_MASK)
{
case MotionEvent.ACTION_DOWN:
nativeMove(START_CMD, event.getX(), event.getY());
nativeMove(0, event.getX(), event.getY());
break;
case MotionEvent.ACTION_POINTER_DOWN:
if (event.getPointerId(0) < event.getPointerId(1))
nativeZoom(START_CMD, event.getX(0), event.getY(0), event.getX(1), event.getY(1));
else
nativeZoom(START_CMD, event.getX(1), event.getY(1), event.getX(0), event.getY(0));
nativeZoom(0, event.getX(0), event.getY(0), event.getX(1), event.getY(1));
break;
case MotionEvent.ACTION_MOVE:
if (event.getPointerCount() > 1)
{
if (event.getPointerId(0) < event.getPointerId(1))
nativeZoom(DO_CMD, event.getX(0), event.getY(0), event.getX(1), event.getY(1));
else
nativeZoom(DO_CMD, event.getX(1), event.getY(1), event.getX(0), event.getY(0));
}
nativeZoom(1, event.getX(0), event.getY(0), event.getX(1), event.getY(1));
else
nativeMove(DO_CMD, event.getX(), event.getY());
nativeMove(1, event.getX(), event.getY());
break;
case MotionEvent.ACTION_POINTER_UP:
if (event.getPointerId(0) < event.getPointerId(1))
nativeZoom(STOP_CMD, event.getX(0), event.getY(0), event.getX(1), event.getY(1));
else
nativeZoom(STOP_CMD, event.getX(1), event.getY(1), event.getX(0), event.getY(0));
final int leftIndex = ((event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK)
>> MotionEvent.ACTION_POINTER_ID_SHIFT) == 0 ? 1 : 0;
nativeMove(START_CMD, event.getX(leftIndex), event.getY(leftIndex));
nativeZoom(2, event.getX(0), event.getY(0), event.getX(1), event.getY(1));
break;
case MotionEvent.ACTION_UP:
nativeMove(STOP_CMD, event.getX(), event.getY());
nativeMove(2, event.getX(), event.getY());
break;
case MotionEvent.ACTION_CANCEL:
if (event.getPointerCount() > 1)
nativeZoom(STOP_CMD, event.getX(0), event.getY(0), event.getX(1), event.getY(1));
nativeZoom(2, event.getX(0), event.getY(0), event.getX(1), event.getY(1));
else
nativeMove(STOP_CMD, event.getX(), event.getY());
nativeMove(2, event.getX(), event.getY());
}
requestRender();