Skip to content

Commit

Permalink
Prevent route overview animation with insufficient route data
Browse files Browse the repository at this point in the history
  • Loading branch information
danesfeder committed Jul 19, 2018
1 parent 1678aa0 commit 04a7418
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
public class NavigationCamera implements LifecycleObserver {

private static final long MAX_ANIMATION_DURATION_MS = 1500;
private static final int ONE_POINT = 1;

private MapboxMap mapboxMap;
private MapboxNavigation navigation;
Expand Down Expand Up @@ -300,8 +301,11 @@ private void animateCameraForRouteOverview(RouteInformation routeInformation, in
}

private void animateMapboxMapForRouteOverview(int[] padding, List<Point> routePoints) {
CameraUpdate resetUpdate = buildResetCameraUpdate();
if (routePoints.size() <= ONE_POINT) {
return;
}
final CameraUpdate overviewUpdate = buildOverviewCameraUpdate(padding, routePoints);
CameraUpdate resetUpdate = buildResetCameraUpdate();
mapboxMap.animateCamera(resetUpdate, 150,
new CameraOverviewCancelableCallback(overviewUpdate, mapboxMap)
);
Expand Down

0 comments on commit 04a7418

Please sign in to comment.