[android] - avoid triggering a fling gesture after a scale gesture. (#7675)
This commit is contained in:
@@ -33,6 +33,8 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to
|
||||
- Rename to reflect the increased responsibilities introduced in prior releases
|
||||
* AnnotationManager refactor [#6067](https://github.com/mapbox/mapbox-gl-native/issues/6067)
|
||||
- Extracting all business logic related to annotations into a seperate class cfr. to core and the iOS codebase
|
||||
* Gesture handling bugs
|
||||
- Avoid calls to onFling when while pinch zooming [#7666](https://github.com/mapbox/mapbox-gl-native/issues/7666)
|
||||
|
||||
## 4.2.1 - December 22, 2016
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ final class MapGestureDetector {
|
||||
private boolean dragStarted = false;
|
||||
private boolean quickZoom = false;
|
||||
private boolean scrollInProgress = false;
|
||||
private boolean scaleGestureOccurred = false;
|
||||
|
||||
MapGestureDetector(Context context, Transform transform, Projection projection, UiSettings uiSettings,
|
||||
TrackingSettings trackingSettings, AnnotationManager annotationManager) {
|
||||
@@ -111,7 +112,8 @@ final class MapGestureDetector {
|
||||
// Handle two finger tap
|
||||
switch (event.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
// First pointer down
|
||||
// First pointer down, reset scaleGestureOccurred, used to avoid triggering a fling after a scale gesture #7666
|
||||
scaleGestureOccurred = false;
|
||||
transform.setGestureInProgress(true);
|
||||
break;
|
||||
|
||||
@@ -294,7 +296,9 @@ final class MapGestureDetector {
|
||||
|
||||
@Override
|
||||
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
|
||||
if (!trackingSettings.isScrollGestureCurrentlyEnabled()) {
|
||||
if ((!trackingSettings.isScrollGestureCurrentlyEnabled()) || scaleGestureOccurred) {
|
||||
// don't allow a fling is scroll is disabled
|
||||
// and ignore when a scale gesture has occurred
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -368,6 +372,7 @@ final class MapGestureDetector {
|
||||
return false;
|
||||
}
|
||||
|
||||
scaleGestureOccurred = true;
|
||||
beginTime = detector.getEventTime();
|
||||
MapboxEvent.trackGestureEvent(projection,
|
||||
MapboxEvent.GESTURE_PINCH_START, detector.getFocusX(), detector.getFocusY(), transform.getZoom());
|
||||
|
||||
Reference in New Issue
Block a user