-
Notifications
You must be signed in to change notification settings - Fork 23
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
Question.. Switch styles and maintain state? #23
Comments
Hi. I didnt understand what you meant. But feel free to create a PR. 👍 |
@el Let me explain... When you call |
This makes sense, currently, the user of the library is required to handle that themselves. Please feel free to create a PR. |
I managed to fix this by passing a Probably not the best solution, but hey: 'if it works it ain't stupid' ;) |
I've created a fork with a new option for "preserveLayers": https://github.com/chriszrc/style-switcher It automatically retains all user-added layers/sources while switching between road/satellite/etc styles. I think I've covered all the edge cases, but if you try it out and find any problems let me know and then maybe I will create a pull request- |
@chriszrc Thanks for initiative, it's great, however, I'm experiencing a strange behaviour. When I switch styles, it flashes to the new one and goes back to the original. Any ideas? |
@vcardins hard to say, can you recreate the problem in a codesandbox? |
@chriszrc Thanks for the quick response, I'm going to try and get back to you. I assume it worked well for you, right? |
@chriszrc Never mind, it's something related to my custom code. 👍🏽 |
@vcardins I removed it- |
I dont see a PR for that. I can take a look if @vcardins creates a PR. |
Hi, I've recently implemented a very similar component myself, before discovering this one!
The main difference being that I needed to maintain sources/layers/feature state in-between style switches. This is semi-baked into my version but I feel like this could be a useful feature for others too...
My question is whether or not you'd accept a PR for this feature?
The text was updated successfully, but these errors were encountered: