USE_OPENGL_RENDER check in tilt

This commit is contained in:
veliymolfar 2020-01-14 12:01:10 +02:00
parent 8e12147196
commit 5c5fe57798

View file

@ -5,6 +5,8 @@ import android.graphics.PointF;
import android.view.MotionEvent;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log;
@ -45,6 +47,7 @@ public class MultiTouchSupport {
private boolean multiTouchAPISupported = false;
private final MultiTouchZoomListener listener;
protected final Context ctx;
private OsmandSettings settings;
protected Method getPointerCount;
protected Method getX;
@ -71,6 +74,7 @@ public class MultiTouchSupport {
}
private void initMethods(){
settings = ((OsmandApplication) ctx.getApplicationContext()).getSettings();
try {
getPointerCount = MotionEvent.class.getMethod("getPointerCount"); //$NON-NLS-1$
getPointerId = MotionEvent.class.getMethod("getPointerId", Integer.TYPE); //$NON-NLS-1$
@ -166,7 +170,8 @@ public class MultiTouchSupport {
if (dx1 < TILT_X_THRESHOLD_PX && dx2 < TILT_X_THRESHOLD_PX
&& dy1 > TILT_Y_THRESHOLD_PX && dy2 > TILT_Y_THRESHOLD_PX
&& startDy < TILT_Y_THRESHOLD_PX * 6
&& Math.abs(dy2 - dy1) < TILT_DY_THRESHOLD_PX) {
&& Math.abs(dy2 - dy1) < TILT_DY_THRESHOLD_PX
&& settings.USE_OPENGL_RENDER.get()) {
listener.onChangeViewAngleStarted();
inTiltMode = true;
} else if (dx1 > TILT_X_THRESHOLD_PX || dx2 > TILT_X_THRESHOLD_PX