summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorBraden Ewing <brewin@gmail.com>2015-11-25 17:33:03 -0700
committerTobrun <tobrun.van.nuland@gmail.com>2015-12-01 15:15:47 +0100
commit60b0e78e0ef7357cf6ef260a6df4241b2c5503db (patch)
treea617b36bd3c221f9fdd5808fbf83047a419fe60d /android
parente7b6d72cd12aae845f56c92db53dad608217726a (diff)
downloadqtlocation-mapboxgl-60b0e78e0ef7357cf6ef260a6df4241b2c5503db.tar.gz
Improve quickzooming on Android
Diffstat (limited to 'android')
-rw-r--r--android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
index 0e4d487af6..ec805fdfa1 100644
--- a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
+++ b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
@@ -2467,13 +2467,12 @@ public final class MapView extends FrameLayout {
switch (e.getAction()) {
case MotionEvent.ACTION_DOWN:
- mQuickZoom = false;
break;
case MotionEvent.ACTION_MOVE:
- mQuickZoom = true;
break;
case MotionEvent.ACTION_UP:
if (mQuickZoom) {
+ mQuickZoom = false;
break;
}
@@ -2594,7 +2593,7 @@ public final class MapView extends FrameLayout {
// Called for a long press
@Override
public void onLongPress(MotionEvent e) {
- if (mOnMapLongClickListener != null) {
+ if (mOnMapLongClickListener != null && !mQuickZoom) {
LatLng point = fromScreenLocation(new PointF(e.getX(), e.getY()));
mOnMapLongClickListener.onMapLongClick(point);
}
@@ -2651,7 +2650,7 @@ public final class MapView extends FrameLayout {
}
}
- // This class handles two finger gestures
+ // This class handles two finger gestures and double-tap drag gestures
private class ScaleGestureListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
long mBeginTime = 0;
@@ -2676,8 +2675,8 @@ public final class MapView extends FrameLayout {
mZoomStarted = false;
}
- // Called each time one of the two fingers moves
- // Called for pinch zooms
+ // Called each time a finger moves
+ // Called for pinch zooms and quickzooms/quickscales
@Override
public boolean onScale(ScaleGestureDetector detector) {
if (!mZoomEnabled) {
@@ -2705,6 +2704,9 @@ public final class MapView extends FrameLayout {
// Cancel any animation
mNativeMapView.cancelTransitions();
+ // Gesture is a quickzoom if there aren't two fingers
+ mQuickZoom = !mTwoTap;
+
// Scale the map
if (!mQuickZoom && mUserLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE) {
// around gesture