summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/Utils.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/Utils.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/Utils.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/Utils.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/Utils.java
index 8907b93b5f..7a2415ed5d 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/Utils.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/Utils.java
@@ -14,8 +14,11 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
+import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapboxMap;
+import static com.mapbox.mapboxsdk.location.LocationComponentConstants.INSTANT_LOCATION_TRANSITION_THRESHOLD;
+
public final class Utils {
private Utils() {
@@ -89,6 +92,15 @@ public final class Utils {
return (float) (location.getAccuracy() * (1 / metersPerPixel));
}
+ static boolean immediateAnimation(LatLng current, @NonNull LatLng target, double zoom) {
+ // TODO: calculate the value based on the projection
+ double distance = current.distanceTo(target);
+ if (zoom > 10) {
+ distance *= zoom;
+ }
+ return distance > INSTANT_LOCATION_TRANSITION_THRESHOLD;
+ }
+
/**
* Casts the value to an even integer.
*/