Merge branch 'android-quickzoom-fix' of git://github.com/brewin/mapbox-gl-native into brewin-android-quickzoom-fix
This commit is contained in:
@@ -180,6 +180,7 @@ public final class MapView extends FrameLayout {
|
||||
private RotateGestureDetector mRotateGestureDetector;
|
||||
private boolean mTwoTap = false;
|
||||
private boolean mZoomStarted = false;
|
||||
private boolean mQuickZoom = false;
|
||||
|
||||
// Shows zoom buttons
|
||||
private ZoomButtonsController mZoomButtonsController;
|
||||
@@ -2369,20 +2370,34 @@ public final class MapView extends FrameLayout {
|
||||
|
||||
// Called for double taps
|
||||
@Override
|
||||
public boolean onDoubleTap(MotionEvent e) {
|
||||
public boolean onDoubleTapEvent(MotionEvent e) {
|
||||
if (!mZoomEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Single finger double tap
|
||||
// Zoom in
|
||||
if (mUserLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE) {
|
||||
// Zoom in on gesture
|
||||
zoom(true, e.getX(), e.getY());
|
||||
} else {
|
||||
// Zoom in on center map
|
||||
zoom(true, getWidth() / 2, getHeight() / 2);
|
||||
switch (e.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mQuickZoom = false;
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
mQuickZoom = true;
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (mQuickZoom) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Single finger double tap
|
||||
if (mUserLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE) {
|
||||
// Zoom in on gesture
|
||||
zoom(true, e.getX(), e.getY());
|
||||
} else {
|
||||
// Zoom in on center map
|
||||
zoom(true, getWidth() / 2, getHeight() / 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2596,7 +2611,7 @@ public final class MapView extends FrameLayout {
|
||||
mNativeMapView.cancelTransitions();
|
||||
|
||||
// Scale the map
|
||||
if (mUserLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE) {
|
||||
if (!mQuickZoom && mUserLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE) {
|
||||
// around gesture
|
||||
mNativeMapView.scaleBy(detector.getScaleFactor(), detector.getFocusX() / mScreenDensity, detector.getFocusY() / mScreenDensity);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user