|
-
- pA.set(event.getX(0), event.getY(0));
- pB.set(event.getX(1), event.getY(1));
- PointF pC = new PointF(event.getX(1) - event.getX(0) + pA.x,
- event.getY(1) - event.getY(0) + pA.y);
- double a = spacing(pB.x, pB.y, pC.x, pC.y);
- double b = spacing(pA.x, pA.y, pC.x, pC.y);
- double c = spacing(pA.x, pA.y, pB.x, pB.y);
- double cosB = (a * a + c * c - b * b) / (2 * a * c);
- double angleB = Math.acos(cosB);
- double PID4 = Math.PI / 4;
- if (angleB > PID4 && angleB < 3 * PID4) {
- mode = ROTATE;
-
- } else {
- mode = ZOOM;
复制代码 |
|