This commit is contained in:
veliymolfar 2020-01-13 18:26:50 +02:00
parent ed85c92047
commit e0e99057d4

View file

@ -91,8 +91,6 @@ public class MultiTouchSupport {
private static final int TILT_X_THRESHOLD_PX = 40; private static final int TILT_X_THRESHOLD_PX = 40;
private static final int TILT_Y_THRESHOLD_PX = 40; private static final int TILT_Y_THRESHOLD_PX = 40;
private static final int TILT_DY_THRESHOLD_PX = 40; private static final int TILT_DY_THRESHOLD_PX = 40;
private static final float ROTATION_THRESHOLD_DEG = 15.0f;
private boolean isRotating;
public boolean onTouchEvent(MotionEvent event){ public boolean onTouchEvent(MotionEvent event){
if(!isMultiTouchSupported()){ if(!isMultiTouchSupported()){
@ -148,13 +146,7 @@ public class MultiTouchSupport {
centerPoint = new PointF((x1 + x2) / 2, (y1 + y2) / 2); centerPoint = new PointF((x1 + x2) / 2, (y1 + y2) / 2);
if (angleDefined) { if (angleDefined) {
float a = MapUtils.unifyRotationTo360(angle - angleStarted); angleRelative = MapUtils.unifyRotationTo360(angle - angleStarted);
if (!isRotating && Math.abs(a) > ROTATION_THRESHOLD_DEG) {
isRotating = true;
angleStarted = angle;
} else if (isRotating) {
angleRelative = a;
}
} }
zoomRelative = distance / zoomStartedDistance; zoomRelative = distance / zoomStartedDistance;
listener.onZoomingOrRotating(zoomRelative, angleRelative); listener.onZoomingOrRotating(zoomRelative, angleRelative);
@ -182,7 +174,6 @@ public class MultiTouchSupport {
angleStarted = angle; angleStarted = angle;
angleRelative = 0; angleRelative = 0;
zoomRelative = 0; zoomRelative = 0;
isRotating = false;
inZoomMode = true; inZoomMode = true;
} }
} }