[android] harden map events creation
This commit is contained in:
@@ -22,6 +22,7 @@ import com.mapbox.android.gestures.StandardScaleGestureDetector;
|
||||
import com.mapbox.android.telemetry.Event;
|
||||
import com.mapbox.android.telemetry.MapEventFactory;
|
||||
import com.mapbox.android.telemetry.MapState;
|
||||
import com.mapbox.android.telemetry.MapboxTelemetry;
|
||||
import com.mapbox.mapboxsdk.R;
|
||||
import com.mapbox.mapboxsdk.camera.CameraPosition;
|
||||
import com.mapbox.mapboxsdk.constants.MapboxConstants;
|
||||
@@ -886,11 +887,12 @@ final class MapGestureDetector {
|
||||
if (cameraPosition != null) {
|
||||
double zoom = cameraPosition.zoom;
|
||||
if (isZoomValid(zoom)) {
|
||||
MapboxTelemetry telemetry = Telemetry.obtainTelemetry();
|
||||
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));
|
||||
telemetry.push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user