Skip to content
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

Fix abrupt jump with globe view + maxBounds after transition to mercator #12124

Merged
merged 2 commits into from
Aug 10, 2022
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
2 changes: 1 addition & 1 deletion src/geo/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ class Transform {
if (!this.center || !this.width || !this.height || this._constraining) return;

this._constraining = true;
const isGlobe = this.projection.name === 'globe';
const isGlobe = this.projection.name === 'globe' || this.mercatorFromTransition;

// alternate constraining for non-Mercator projections
if (this.projection.isReprojectedInTileSpace || isGlobe) {
Expand Down
3 changes: 3 additions & 0 deletions src/ui/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,9 @@ class Map extends Camera {
* as close as possible to the operation's request while still
* remaining within the bounds.
*
* For `mercator` projection, the viewport will be constrained to the bounds.
* For other projections such as `globe`, only the map center will be constrained.
*
* @param {LngLatBoundsLike | null | undefined} bounds The maximum bounds to set. If `null` or `undefined` is provided, the function removes the map's maximum bounds.
* @returns {Map} Returns itself to allow for method chaining.
* @example
Expand Down