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 28fc5db
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 @@ -489,15 +490,14 @@ public void takeScreenshot(NavigationSnapshotReadyCallback navigationSnapshotRea

@SuppressLint("MissingPermission")
private void initializeLocationComponent(MapView mapView, MapboxMap map) {
locationComponent = map.getLocationComponent();
map.setMinZoomPreference(NAVIGATION_MINIMUM_MAP_ZOOM);
map.setMaxZoomPreference(NAVIGATION_MAXIMUM_MAP_ZOOM);
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);
locationComponent.activateLocationComponent(context, map.getStyle(), locationComponentOptions);
locationComponent.setLocationComponentEnabled(true);
locationComponent.setRenderMode(RenderMode.GPS);
Expand Down

0 comments on commit 28fc5db

Please sign in to comment.