sync slider with buttons, expose more options #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is my first PR for a JS-library, so please excuse me if there are some obvious problems or better solutions.
I acutally want to wrap this plugin to R and had to define the
mapin the functionsonClickHigherOpacityandonClickLowerOpacity, as otherwise i get an error in R, saying thatmap.doubleClickZoomis undefined. So I defined the map as:var map = opacity_layer._map;This works for me in JS and in R.
Further changes are the synchronisation of the slider with the buttons. This could definitly be further optimized, but as a start it looked fine.
I also exposed more
optionsfor the slider. (range, max, animate)If an initial opacity is set, it has to be passed to the slider aswell, so it is integrated in the options (
init_opac).I changed the demo to show the use of those options.