Add API for allowing the map to zoom out to z0
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
## Motivation
https://github.com/mapbox/mapbox-gl-js/pull/6918 clamps latitude values to +-85.56° to prevent `fitBounds` values such as -90 from throwing an error. This inadvertently made zooming all the way out to z0 impossible. This should have been considered a breaking change. At least one user has already asked about this. Clamping latitudes to valid Web Mercator values is the correct behavior, but we should provide a simple API to allow a user to revert to the pre-v0.48.0 behavior.
## Design Alternatives
1. Do nothing. It can be argued that the previous behavior was a bug and we shouldn't add a way to reintroduce "buggy" behavior. `map.transform.latRange = null` achieves the desired effect without introducing a new API
2. `map.setMaxBounds(null);` used to achieve this functionality so we could ensure that this function call sets the `latRange` to `null`
3. We could add a map option such as `clampLatRange` with the default `true`
4. We could have an explicit `transform` method such as `map.transform.unclampLatRange()`.
## Design
The more I think about it, I might lean towards option 1. There's a way to achieve this without introducing a new API that allows arguably undesirable behavior. If we do want to implement this, I think 3 might be the simplest way for a user to allow this behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the map.transform.latRange behavior and the existing setMaxBounds(null) path described in the issue. Compare the four listed design alternatives and determine which API behavior should be supported; the work is done when the chosen approach consistently permits or rejects zooming to z0 as specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api, frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100