android跳转?

时间:2012-08-28 08:09:45

标签: java android zoom processing.js

当我移开手指并再次放置时,

变焦跳跃!有谁知道这个问题?

boolean surfaceTouchEvent(MotionEvent event) {
  pointNum=event.getPointerCount();
  switch (event.getAction() & MotionEvent.ACTION_MASK) {
  case MotionEvent.ACTION_POINTER_DOWN:
    // User is pressing down another finger.
    float x11 = event.getX(0) - event.getX(1);
    float y22 = event.getY(0) - event.getY(1);
    z4 = sqrt(x11*x11+y22*y22);

    break;
  case MotionEvent.ACTION_POINTER_UP:
    // User is released one of the fingers.
    break;
  case MotionEvent.ACTION_MOVE:
    if (pointNum >= 2 ) {
      x1=event.getX(0);
      x2=event.getX(1);
      y1=event.getY(0);
      y2=event.getY(1);

      float x = event.getX(0) - event.getX(1);
      float y= event.getY(0) - event.getY(1);
      float z3 = sqrt(x*x+y*y);
      if (pointNum >= 2 ) {
        if ( z3 < z4 ) {
          zoom = z3/z4;
        }
        else {
          zoom = z3/z4;
        }
        zoom = constrain(zoom, 0, 100);
      }
      press1=event.getSize(0);
      press2=event.getSize(1);
    }
    break;
  }
  return super.surfaceTouchEvent(event);
}

0 个答案:

没有答案