(MotionEvent event)
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | public boolean onTouchEvent(MotionEvent event) { |
| 74 | |
| 75 | switch (event.getAction()){ |
| 76 | case MotionEvent.ACTION_MOVE: |
| 77 | float tempX = event.getX(); |
| 78 | float tempY = event.getY(); |
| 79 | |
| 80 | // 根据触控位置改变dst |
| 81 | for (int i=0; i<testPoint*2; i+=2 ) { |
| 82 | if (Math.abs(tempX - dst[i]) <= triggerRadius && Math.abs(tempY - dst[i+1]) <= triggerRadius){ |
| 83 | dst[i] = tempX-100; |
| 84 | dst[i+1] = tempY-100; |
| 85 | break; // 防止两个点的位置重合 |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | resetPolyMatrix(testPoint); |
| 90 | invalidate(); |
| 91 | break; |
| 92 | } |
| 93 | |
| 94 | return true; |
| 95 | } |
| 96 | |
| 97 | public void resetPolyMatrix(int pointCount){ |
| 98 | mPolyMatrix.reset(); |
nothing calls this directly
no test coverage detected