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 map in the functions onClickHigherOpacity and onClickLowerOpacity, as otherwise i get an error in R, saying that map.doubleClickZoom is 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.
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
map
in the functionsonClickHigherOpacity
andonClickLowerOpacity
, as otherwise i get an error in R, saying thatmap.doubleClickZoom
is 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
options
for 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.