Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android][core] #509 - Setting Min and Max Zooms warning annotations …
Browse files Browse the repository at this point in the history
…in Android. Clamping Min and Max zooms at Core GL for all platforms to use at runtime.
  • Loading branch information
bleege committed Feb 3, 2016
1 parent 23c6e0f commit 932012e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public class MapboxConstants {
/**
* The currently supported minimum zoom level.
*/
public static final double MINIMUM_ZOOM = 0f;
public static final double MINIMUM_ZOOM = 0.0;

/**
* The currently supported maximum zoom level.
*/
public static final double MAXIMUM_ZOOM = 25.0;
public static final double MAXIMUM_ZOOM = 25.5;

/**
* The currently supported maximum tilt value.
Expand Down
18 changes: 16 additions & 2 deletions src/mbgl/map/transform_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,14 @@ double TransformState::getScale() const {
}

void TransformState::setMinZoom(const double minZoom) {
min_scale = zoomScale(minZoom);
double zoom = minZoom;
if (minZoom > 25.5) {
zoom = 25.5;
}
if (minZoom < 0) {
zoom = 0.0;
}
min_scale = zoomScale(zoom);
}

double TransformState::getMinZoom() const {
Expand All @@ -174,7 +181,14 @@ double TransformState::getMinZoom() const {
}

void TransformState::setMaxZoom(const double maxZoom) {
max_scale = zoomScale(maxZoom);
double zoom = maxZoom;
if (maxZoom > 25.5) {
zoom = 25.5;
}
if (maxZoom < 0) {
zoom = 0.0;
}
max_scale = zoomScale(zoom);
}

double TransformState::getMaxZoom() const {
Expand Down

0 comments on commit 932012e

Please sign in to comment.