Skip to content

Commit

Permalink
fix allowing users to zoom in too closely to the map - zoom levels ar…
Browse files Browse the repository at this point in the history
…e not default restricted by maps anymore
  • Loading branch information
Guardiola31337 committed Jan 14, 2019
1 parent 78450a6 commit 5f151db
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class NavigationMapboxMap {
private static final String INCIDENTS_LAYER_ID = "closures";
private static final String TRAFFIC_LAYER_ID = "traffic";
private static final int[] ZERO_MAP_PADDING = {0, 0, 0, 0};
private static final double NAVIGATION_MAXIMUM_MAP_ZOOM = 18d;

private MapboxMap mapboxMap;
private NavigationCamera mapCamera;
Expand Down Expand Up @@ -492,12 +493,11 @@ private void initializeLocationComponent(MapView mapView, MapboxMap map) {
Context context = mapView.getContext();
int locationLayerStyleRes = ThemeSwitcher.retrieveNavigationViewStyle(context,
R.attr.navigationViewLocationLayerStyle);

LocationComponentOptions locationComponentOptions =
LocationComponentOptions.createFromAttributes(context, locationLayerStyleRes);

locationComponent = map.getLocationComponent();
map.setMinZoomPreference(NAVIGATION_MINIMUM_MAP_ZOOM);
map.setMaxZoomPreference(NAVIGATION_MAXIMUM_MAP_ZOOM);
LocationComponentOptions locationComponentOptions =
LocationComponentOptions.createFromAttributes(context, locationLayerStyleRes);
locationComponent.activateLocationComponent(context, map.getStyle(), locationComponentOptions);
locationComponent.setLocationComponentEnabled(true);
locationComponent.setRenderMode(RenderMode.GPS);
Expand Down

0 comments on commit 5f151db

Please sign in to comment.