Open cammanderson opened 7 years ago
Referencing the conversation to mapbox gl js.
@cammanderson adding a setter for the renderWorldCopies
option would be fairly straightforward. Would you be interested in submitting a PR for this feature?
Hi @mollymerp, Thanks for offering :-) I would definitely be happy receiving a PR for this update, but I would like to understand how to 'unset' this option if the prop value changes. I have asked the mapbox developers if there is an API method as I just can't find one at the moment. I fear that it would mean you need to 'recreate' the map to change this value if the prop value changes.
Apologies @mollymerp, I totally thought this was from a different perspective and totally mis-read your message! Also, I apologise for not recognising you! Thanks for reaching out to this thread, I will have a look at submitting a PR across to you guys :-)
My mistake as well! I thought this was an issue in the mapbox-gl-js repo 🙈 -- I'll open a ticket for this over there.
Here's the issue https://github.com/mapbox/mapbox-gl-js/issues/4039 and another one that may be relevant to this project https://github.com/mapbox/mapbox-gl-js/issues/4029
You're a champion :)
With the addition in mapbox release version 0.31, it is possible to control the renderWorldCopies property. While the property is exposed to the constructor, it is not available as an API call to toggle this behaviour later.
I have raised a comment against the original ticket thread in order to see what is possible with an exposed API, but I doubt there is priority for this use case. We will see. In the meantime, I have added this down as a possible enhancement.
The update would be in map.jsx to add a prop of renderWorldCopiesDisabled and default to false. We would then update the constructor options to read from it. That update is trivial. The next update would be to compare the values of current versus next props to determine the user making a change and call the API. As this is missing, a work around could be to recreate the map instance which probably isn't ideal.