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

[Bug] Cannot set zoom or center via setStyle() #5467

Closed
titouancreach opened this issue Oct 16, 2017 · 3 comments
Closed

[Bug] Cannot set zoom or center via setStyle() #5467

titouancreach opened this issue Oct 16, 2017 · 3 comments

Comments

@titouancreach
Copy link

titouancreach commented Oct 16, 2017

mapbox-gl-js version: 0.41.0

Steps to Trigger Behavior

  1. get the current mapbox style via map.getStyle();
  2. change zoom for example: const newStyle = {...map.getStyle(), zoom: 11};
  3. Set our new style: map.setStyle(newStyle);

Tested both with {diff: true} and {diff: false}
With {diff: true} the zoom and center are in the ignoredOptions and the diff returns 0 event if there's a diff. I don't understand why theses options are in the ignoredOptions list.

Expected Behavior

The zoom should change

Actual Behavior

The style is changed internally (i.e style.stylesheet) but the visu doesn't update.

Minimal reproduction: https://codepen.io/anon/pen/rGQaXb?editors=1111
It works the first time because the zoom is undefined but it doesn't work after

@titouancreach titouancreach changed the title Cannot set zoom or center via setStyle() [Bug] Cannot set zoom or center via setStyle() Oct 16, 2017
@anandthakker
Copy link
Contributor

Thanks @titouancreach! This is a known issue, tracked at #3654.

Duplicate of #3654

@titouancreach
Copy link
Author

Thanks for answering, I didn't see the issue. This issue is opened since Nov 2016, do you have any plan to work on that ?

Thanks

@enersis-pst
Copy link
Contributor

Strange behaviour. If setStyle only set some layer and sources it shoudnt be named like setStyle or at least it should be described in the docu. For me it is unclear why not all properties like center, zoom are set.
Also strange, that they are set (also this values are updatet and can be checked by getStyle), but doesnt have a influence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants