diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2019-06-19 18:29:16 +0200 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2019-06-20 17:07:01 +0200 |
commit | f57e7f31b36cb28249ed5ffa21a2d229b452345e (patch) | |
tree | b1f360a308955b63a029027832b580d6ffb84293 | |
parent | 7f3db52b5ae959e0c1dd59ae56bf3c3b625ca728 (diff) | |
download | qtlocation-mapboxgl-f57e7f31b36cb28249ed5ffa21a2d229b452345e.tar.gz |
[android] ensure to re-enable move when quickzoom finishes
Because the double tap event can be canceled and stop delivering events whenever ACTION_CANCEL or ACTION_POINTER_DOWN is dispatched, we need to make the #onScaleEnd callback responsible for re-enabling the move detector as well
(cherry picked from commit 577e03f949c9e897269b99db376a518193b2a895)
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java | 13 |
1 files changed, 11 insertions, 2 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 17d3ab0aa2..3f24ebe2ac 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 @@ -344,8 +344,10 @@ final class MapGestureDetector { } if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP) { - // re-enabled the move detector - gesturesManager.getMoveGestureDetector().setEnabled(true); + if (executeDoubleTap) { + // re-enable the move detector only if we did not start the quickzoom, otherwise, re-enable in the #onScaleEnd + gesturesManager.getMoveGestureDetector().setEnabled(true); + } if (!uiSettings.isZoomGesturesEnabled() || !uiSettings.isDoubleTapGesturesEnabled() || !executeDoubleTap) { return false; @@ -512,6 +514,13 @@ final class MapGestureDetector { @Override public void onScaleEnd(@NonNull StandardScaleGestureDetector detector, float velocityX, float velocityY) { + if (quickZoom) { + // re-enabled the move detector only if the quickzoom happened + // we need to split the responsibility of re-enabling the move detector, + // because the double tap event (where the detector is disabled) can be canceled without warning (see #14598) + gesturesManager.getMoveGestureDetector().setEnabled(true); + } + if (uiSettings.isIncreaseRotateThresholdWhenScaling()) { // resetting default angle threshold gesturesManager.getRotateGestureDetector().setAngleThreshold( |