[core] Always constrain width for zoom level

Even if the map supports wrapping the world, it isn’t necessary to show more than one full revolution of the world at a time. Removed a redundant zoom level clamp.
This commit is contained in:
Minh Nguyễn
2015-12-23 10:06:51 -08:00
committed by Minh Nguyễn
parent 58264408c8
commit 63820d1b4f
2 changed files with 3 additions and 12 deletions

View File

@@ -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;

View File

@@ -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<double>((rotatedNorth() ? height : width) / util::tileSize));
}
scale_ = std::max(scale_, static_cast<double>((rotatedNorth() ? width : height) / util::tileSize));
scale_ = util::max(scale_,
static_cast<double>((rotatedNorth() ? height : width) / util::tileSize),
static_cast<double>((rotatedNorth() ? width : height) / util::tileSize));
// Constrain min/max pan to avoid showing off-world areas.
if (constrainMode == ConstrainMode::WidthAndHeight) {