Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiTouchView1 ACTION_POINTER_UP hava problem #4

Open
heinika opened this issue Mar 20, 2020 · 1 comment
Open

MultiTouchView1 ACTION_POINTER_UP hava problem #4

heinika opened this issue Mar 20, 2020 · 1 comment

Comments

@heinika
Copy link

heinika commented Mar 20, 2020

case MotionEvent.ACTION_POINTER_UP:
        actionIndex = event.getActionIndex();
        int pointerId = event.getPointerId(actionIndex);
        if (pointerId == trackingPointerId) {
          int newIndex;
          if (actionIndex == event.getPointerCount() - 1) {
            newIndex = event.getPointerCount() - 2;
          } else {
            newIndex = event.getPointerCount() - 1;
          }
          trackingPointerId = event.getPointerId(newIndex);
          downX = event.getX(actionIndex);
          downY = event.getY(actionIndex);
          originalOffsetX = offsetX;
          originalOffsetY = offsetY;
        }
        break;

need change to

      case MotionEvent.ACTION_POINTER_UP:
        actionIndex = event.getActionIndex();
        int pointerId = event.getPointerId(actionIndex);
        if (pointerId == trackingPointerId) {
          int newIndex;
          if (actionIndex == event.getPointerCount() - 1) {
            newIndex = event.getPointerCount() - 2;
          } else {
            newIndex = event.getPointerCount() - 1;
          }
          trackingPointerId = event.getPointerId(newIndex);
          downX = event.getX(newIndex);
          downY = event.getY(newIndex);
          originalOffsetX = offsetX;
          originalOffsetY = offsetY;
        }
        break;
@liuchch
Copy link

liuchch commented Jul 5, 2020

I think you are right.
downX & downY should use newIndex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants