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

Commit

Permalink
[core] #509 - Adding min / max checks to parameters and refactoring t…
Browse files Browse the repository at this point in the history
…o utilize clamp function
  • Loading branch information
bleege committed Feb 4, 2016
1 parent 932012e commit 511c01c
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/mbgl/map/transform_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,9 @@ double TransformState::getScale() const {
}

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

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

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

double TransformState::getMaxZoom() const {
Expand Down

0 comments on commit 511c01c

Please sign in to comment.