[core] Do not consider X axis when constraining scale

This commit is contained in:
Bruno de Oliveira Abinader
2018-11-28 09:49:33 +02:00
parent c0bfa99b66
commit 369d1f005b
4 changed files with 8 additions and 10 deletions

View File

@@ -375,12 +375,9 @@ void TransformState::constrain(double& scale_, double& x_, double& y_) const {
return;
}
const double ratioX = (rotatedNorth() ? size.height : size.width) / util::tileSize;
// Constrain scale to avoid zooming out far enough to show off-world areas on the Y axis.
const double ratioY = (rotatedNorth() ? size.width : size.height) / util::tileSize;
// Constrain minimum scale to avoid zooming out far enough to show off-world areas on the Y axis.
// If Y axis ratio is too small to be constrained, use X axis ratio instead.
scale_ = util::max(scale_, ratioY < 1.0 ? ratioX : ratioY);
scale_ = util::max(scale_, ratioY);
// Constrain min/max pan to avoid showing off-world areas on the Y axis.
double max_y = (scale_ * util::tileSize - (rotatedNorth() ? size.width : size.height)) / 2;

View File

@@ -50,10 +50,9 @@ void HeatmapBucket::addFeature(const GeometryTileFeature& feature,
auto y = point.y;
// Do not include points that are outside the tile boundaries.
// Include all points in Still mode. You need to include points from
// neighbouring tiles so that they are not clipped at tile boundaries.
if ((mode == MapMode::Continuous) &&
(x < 0 || x >= util::EXTENT || y < 0 || y >= util::EXTENT)) continue;
if (x < 0 || x >= util::EXTENT || y < 0 || y >= util::EXTENT) {
continue;
}
if (segments.empty() || segments.back().vertexLength + vertexLength > std::numeric_limits<uint16_t>::max()) {
// Move to a new segments because the old one can't hold the geometry.