diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp index 04c0f8bda..7e9c0c4f4 100644 --- a/src/mbgl/map/transform.cpp +++ b/src/mbgl/map/transform.cpp @@ -212,13 +212,6 @@ double Transform::getScale() const { } void Transform::_setScale(double new_scale, const PrecisionPoint& center, const Duration& duration) { - // Ensure that we don't zoom in further than the maximum allowed. - if (new_scale < state.min_scale) { - new_scale = state.min_scale; - } else if (new_scale > state.max_scale) { - new_scale = state.max_scale; - } - const double factor = new_scale / state.scale; double dx = 0; double dy = 0; diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp index ccc5ab365..a41003e0d 100644 --- a/src/mbgl/map/transform_state.cpp +++ b/src/mbgl/map/transform_state.cpp @@ -355,11 +355,9 @@ bool TransformState::rotatedNorth() const { void TransformState::constrain(double& scale_, double& x_, double& y_) const { // Constrain minimum scale to avoid zooming out far enough to show off-world areas. - if (constrainMode == ConstrainMode::WidthAndHeight) { - scale_ = std::max(scale_, static_cast((rotatedNorth() ? height : width) / util::tileSize)); - } - - scale_ = std::max(scale_, static_cast((rotatedNorth() ? width : height) / util::tileSize)); + scale_ = util::max(scale_, + static_cast((rotatedNorth() ? height : width) / util::tileSize), + static_cast((rotatedNorth() ? width : height) / util::tileSize)); // Constrain min/max pan to avoid showing off-world areas. if (constrainMode == ConstrainMode::WidthAndHeight) {