-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow rendering full world smaller than 512px #9028
Changes from all commits
994e2eb
808f46a
70ad780
f2a3662
fb015e8
31f8918
da2aad2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,7 +101,7 @@ type MapOptions = { | |
locale?: Object | ||
}; | ||
|
||
const defaultMinZoom = 0; | ||
const defaultMinZoom = -2; | ||
const defaultMaxZoom = 22; | ||
|
||
// the default values, but also the valid range | ||
|
@@ -614,8 +614,13 @@ class Map extends Camera { | |
* If the map's current zoom level is lower than the new minimum, | ||
* the map will zoom to the new minimum. | ||
* | ||
* @param {number | null | undefined} minZoom The minimum zoom level to set (0-24). | ||
* If `null` or `undefined` is provided, the function removes the current minimum zoom (i.e. sets it to 0). | ||
* It is not always possible to zoom out and reach the set `minZoom`. | ||
* Other factors such as map height may restrict zooming. For example, | ||
* if the map is 512px tall it will not be possible to zoom below zoom 0 | ||
* no matter what the `minZoom` is set to. | ||
* | ||
* @param {number | null | undefined} minZoom The minimum zoom level to set (-2 - 24). | ||
* If `null` or `undefined` is provided, the function removes the current minimum zoom (i.e. sets it to -2). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this comment should be expanded to clarify that negative zoom levels equate to containers < 512px square. It's not possible to set a map to a negative zoom when the container is larger than a tile. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does fb015e8 look clear enough? |
||
* @returns {Map} `this` | ||
* @example | ||
* map.setMinZoom(12.25); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 256, | ||
"height": 256 | ||
} | ||
}, | ||
"center": [ | ||
0, | ||
0 | ||
], | ||
"zoom": -1, | ||
"sources": { | ||
"mapbox": { | ||
"type": "vector", | ||
"maxzoom": 14, | ||
"tiles": [ | ||
"local://tiles/{z}-{x}-{y}.mvt" | ||
] | ||
} | ||
}, | ||
"layers": [ | ||
{ | ||
"id": "background", | ||
"type": "background", | ||
"paint": { | ||
"background-color": "white" | ||
} | ||
}, | ||
{ | ||
"id": "fill", | ||
"type": "fill", | ||
"source": "mapbox", | ||
"source-layer": "water", | ||
"paint": { | ||
"fill-color": "black" | ||
} | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should stick with 0 by default, and allow folks to explicitly pass in a negative
minZoom
if they really want to enable this.