summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java23
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java4
2 files changed, 12 insertions, 15 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 de9b4fdbc2..896f655bbc 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
@@ -23,6 +23,7 @@ import com.mapbox.android.telemetry.Event;
import com.mapbox.android.telemetry.MapEventFactory;
import com.mapbox.android.telemetry.MapState;
import com.mapbox.mapboxsdk.R;
+import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.utils.MathUtils;
@@ -885,20 +886,20 @@ final class MapGestureDetector {
}
private void sendTelemetryEvent(String eventType, PointF focalPoint) {
- if (isZoomValid(transform)) {
- MapEventFactory mapEventFactory = new MapEventFactory();
- LatLng latLng = projection.fromScreenLocation(focalPoint);
- MapState state = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom());
- state.setGesture(eventType);
- Telemetry.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, state));
+ CameraPosition cameraPosition = transform.getCameraPosition();
+ if (cameraPosition != null) {
+ double zoom = cameraPosition.zoom;
+ if (isZoomValid(zoom)) {
+ MapEventFactory mapEventFactory = new MapEventFactory();
+ LatLng latLng = projection.fromScreenLocation(focalPoint);
+ MapState state = new MapState(latLng.getLatitude(), latLng.getLongitude(), zoom);
+ state.setGesture(eventType);
+ Telemetry.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, state));
+ }
}
}
- private boolean isZoomValid(Transform transform) {
- if (transform == null) {
- return false;
- }
- double mapZoom = transform.getZoom();
+ private boolean isZoomValid(double mapZoom) {
return mapZoom >= MapboxConstants.MINIMUM_ZOOM && mapZoom <= MapboxConstants.MAXIMUM_ZOOM;
}
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 f76e54984b..c827e5e636 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
@@ -218,10 +218,6 @@ final class Transform implements MapView.OnMapChangedListener {
// Zoom in or out
- double getZoom() {
- return cameraPosition.zoom;
- }
-
double getRawZoom() {
return mapView.getZoom();
}