From da532007043b1827e83686faca0de2a45c4ef730 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 2 Jun 2017 12:39:35 +0200 Subject: [PATCH] [android] - validate if gestures should execute (#9173) --- .../mapbox/mapboxsdk/maps/MapGestureDetector.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java index e60f9b1d1e6..33e13c5ecc3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java @@ -383,6 +383,14 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve // Called for drags @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { + if (!trackingSettings.isScrollGestureCurrentlyEnabled()) { + return false; + } + + if (dragStarted) { + return false; + } + if (!scrollInProgress) { scrollInProgress = true; @@ -393,13 +401,6 @@ public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float d getLocationFromGesture(e1.getX(), e1.getY()), MapboxEvent.GESTURE_PAN_START, transform)); } - if (!trackingSettings.isScrollGestureCurrentlyEnabled()) { - return false; - } - - if (dragStarted) { - return false; - } // reset tracking if needed trackingSettings.resetTrackingModesIfRequired(true, false, false);