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 33e13c5ecc3..5346baa4e2c 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 @@ -346,7 +346,6 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve // and ignore when a scale gesture has occurred return false; } - cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); float screenDensity = uiSettings.getPixelRatio(); @@ -362,6 +361,8 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve // cancel any animation transform.cancelTransitions(); + cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE); + // tilt results in a bigger translation, limiting input for #5281 double tilt = transform.getTilt(); double tiltFactor = 1 + ((tilt != 0) ? (tilt / 10) : 0); /* 1 -> 7 */ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java index 7f44e0de070..9a8997014a5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java @@ -79,7 +79,7 @@ void updateCameraPosition(@NonNull CameraPosition position) { @Override public void onMapChanged(@MapView.MapChange int change) { - if (change == REGION_DID_CHANGE_ANIMATED && cameraCancelableCallback != null) { + if (change == REGION_DID_CHANGE_ANIMATED) { updateCameraPosition(invalidateCameraPosition()); if (cameraCancelableCallback != null) { cameraCancelableCallback.onFinish(); @@ -116,8 +116,8 @@ final void easeCamera(MapboxMap mapboxMap, CameraUpdate update, int durationMs, if (callback != null) { cameraCancelableCallback = callback; - mapView.addOnMapChangedListener(this); } + mapView.addOnMapChangedListener(this); mapView.easeTo(cameraPosition.bearing, cameraPosition.target, durationMs, cameraPosition.tilt, cameraPosition.zoom, easingInterpolator); } @@ -134,9 +134,8 @@ final void animateCamera(MapboxMap mapboxMap, CameraUpdate update, int durationM if (callback != null) { cameraCancelableCallback = callback; - mapView.addOnMapChangedListener(this); } - + mapView.addOnMapChangedListener(this); mapView.flyTo(cameraPosition.bearing, cameraPosition.target, durationMs, cameraPosition.tilt, cameraPosition.zoom); }