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

Make Map#flyTo respect maxBounds #2521

Closed
cvn opened this issue May 2, 2016 · 5 comments
Closed

Make Map#flyTo respect maxBounds #2521

cvn opened this issue May 2, 2016 · 5 comments
Assignees
Labels

Comments

@cvn
Copy link

cvn commented May 2, 2016

Hello,

When using flyTo on a map with maxBounds set, it attempts to cross the antimeridian even if it can't. So instead of flying across the map, it flies into the edge. easeTo does not have this problem.

So, with a map with maxBounds: [[-180,-85],[180,85]], starting at [-130, 60], and attempting to flyTo([130, 60]), you wind up at [-164,60] or so, depending on your zoom.

Here's a demo with mapbox-gl v0.18.0: http://jsbin.com/mogodi/edit?js,output

I suspect this was introduced #1857.

@lucaswoj lucaswoj changed the title flyTo ignores maxBounds Make Map#flyTo respect maxBounds Jul 29, 2016
@lucaswoj
Copy link
Contributor

related to #2801

@francoiscabrol
Copy link

any workaround? this problem is very frustrating

@cvn
Copy link
Author

cvn commented Feb 12, 2017

I commented out these lines and made a custom build: https://github.com/mapbox/mapbox-gl-js/blob/b9e10b9/src/ui/camera.js#L613-L621

It's not good, but it works if you need it.

@francoiscabrol
Copy link

Oh thanks! Your changes was merged, right? So is it going to be in the next release?

@cvn
Copy link
Author

cvn commented Feb 12, 2017

My suggestion is a workaround you would have to apply yourself. I'm not sure when a fix is coming.

@mourner mourner self-assigned this Apr 18, 2017
mourner added a commit that referenced this issue Apr 18, 2017
- Enable anti-meridian crossing for `easeTo`-based methods for
consistency with `flyTo`.
- Fix #2521 by disabling anti-meridian crossing if `maxBounds` is set.
mourner added a commit that referenced this issue Apr 18, 2017
- Enable anti-meridian crossing for `easeTo`-based methods for
consistency with `flyTo`.
- Fix #2521 by disabling anti-meridian crossing if `maxBounds` is set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants