Seems the slider has a fixed default of 60% which may not match the actual application.
For the moment, have just changed my copy of Control.Opacity.js to set the initial value (in my case to 80%), but seems it could be dynamic
The onAdd function should be able to compute it from the layer,
var opacity_value = opacity_layer.options.opacity;
var value = opacity_value * 100;
sort of thing. But I guess the main issue, is the opacity_layer, may not be known when the control is created, ie setOpacityLayer not called, (or it might not have its opacity set yet!) - as the slider is 'internal' application code cant easily call 'setValue' on it, to initialize it to match an actual layer.
Easiest perhap would be to have a function 'setOpacity' methon on the control, that sets both the opacity of the actual layer, and sets the value on the slider.
Seems the slider has a fixed default of 60% which may not match the actual application.
For the moment, have just changed my copy of Control.Opacity.js to set the initial value (in my case to 80%), but seems it could be dynamic
The onAdd function should be able to compute it from the layer,
var opacity_value = opacity_layer.options.opacity; var value = opacity_value * 100;
sort of thing. But I guess the main issue, is the opacity_layer, may not be known when the control is created, ie setOpacityLayer not called, (or it might not have its opacity set yet!) - as the slider is 'internal' application code cant easily call 'setValue' on it, to initialize it to match an actual layer.
Easiest perhap would be to have a function 'setOpacity' methon on the control, that sets both the opacity of the actual layer, and sets the value on the slider.