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

Set Default MaxZoom to 22 #9821

Merged
merged 1 commit into from
Aug 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/mbgl/util/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ constexpr double MIN_ZOOM = 0.0;
constexpr double MAX_ZOOM = 25.5;
constexpr float MIN_ZOOM_F = MIN_ZOOM;
constexpr float MAX_ZOOM_F = MAX_ZOOM;
constexpr uint8_t DEFAULT_MAX_ZOOM = 22;

constexpr uint8_t DEFAULT_PREFETCH_ZOOM_DELTA = 4;

Expand Down
3 changes: 2 additions & 1 deletion include/mbgl/util/tileset.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <mbgl/util/range.hpp>
#include <mbgl/util/constants.hpp>

#include <vector>
#include <string>
Expand All @@ -18,7 +19,7 @@ class Tileset {
Scheme scheme;

Tileset(std::vector<std::string> tiles_ = std::vector<std::string>(),
Range<uint8_t> zoomRange_ = { 0, 22 },
Range<uint8_t> zoomRange_ = { 0, util::DEFAULT_MAX_ZOOM },
std::string attribution_ = {},
Scheme scheme_ = Scheme::XYZ)
: tiles(std::move(tiles_)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ public void setMinZoomPreference(

/**
* <p>
* Gets the maximum zoom level the map can be displayed at.
* Gets the minimum zoom level the map can be displayed at.
* </p>
*
* @return The minimum zoom level.
Expand All @@ -508,7 +508,9 @@ public double getMinZoomLevel() {
* <p>
* Sets the maximum zoom level the map can be displayed at.
* </p>
*
* <p>
* The default maximum zoomn level is 22. The upper bound for this value is 25.5.
* </p>
* @param maxZoom The new maximum zoom level.
*/
public void setMaxZoomPreference(@FloatRange(from = MapboxConstants.MINIMUM_ZOOM,
Expand Down
3 changes: 2 additions & 1 deletion platform/macos/src/MGLMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ MGL_EXPORT IB_DESIGNABLE
If the value of this property is smaller than that of the `minimumZoomLevel`
property, the behavior is undefined.

The default value of this property is 20.
The default value of this property is 22. The upper bound for this property
is 25.5.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The corresponding iOS comment needs to be updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is happening in #9835.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I originally left out the upper bound because setting the property to something higher like 30 would silently get capped to 25.5 anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1ec5 Its nice to know it up front in that case, since there is no other way for a developer to know why its been capped.

*/
@property (nonatomic) double maximumZoomLevel;

Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/annotation/render_annotation_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void RenderAnnotationSource::update(Immutable<style::Source::Impl> baseImpl_,
parameters,
SourceType::Annotations,
util::tileSize,
{ 0, 22 },
{ 0, util::DEFAULT_MAX_ZOOM },
[&] (const OverscaledTileID& tileID) {
return std::make_unique<AnnotationTile>(tileID, parameters);
});
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/map/transform_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class TransformState {

// Limit the amount of zooming possible on the map.
double min_scale = std::pow(2, 0);
double max_scale = std::pow(2, 20);
double max_scale = std::pow(2, util::DEFAULT_MAX_ZOOM);
double min_pitch = 0.0;
double max_pitch = util::PITCH_MAX;

Expand Down