File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ collapsed: false or true
36
36
// The position of the control (one of the map corners).
37
37
position: ' topleft' or ' topright' or ' bottomleft' or ' bottomright'
38
38
39
+ // Optional label to present before the controls (e.g. "Layers Opacity")
40
+ label: string or null
41
+
39
42
```
40
43
41
44
<br >
Original file line number Diff line number Diff line change 1
1
L . Control . Opacity = L . Control . extend ( {
2
2
options : {
3
3
collapsed : false ,
4
- position : 'topright'
4
+ position : 'topright' ,
5
+ label : null
5
6
} ,
6
7
initialize : function ( overlays , options ) {
7
8
L . Util . setOptions ( this , options ) ;
@@ -41,6 +42,11 @@ L.Control.Opacity = L.Control.extend({
41
42
container . setAttribute ( 'aria-haspopup' , true ) ;
42
43
L . DomEvent . disableClickPropagation ( container ) ;
43
44
L . DomEvent . disableScrollPropagation ( container ) ;
45
+ if ( this . options . label ) {
46
+ var labelSpan = L . DomUtil . create ( 'span' , className + "-label" ) ;
47
+ labelSpan . innerHTML = this . options . label ;
48
+ container . appendChild ( labelSpan ) ;
49
+ }
44
50
var form = this . _form = L . DomUtil . create ( 'form' , className + '-list' ) ;
45
51
if ( collapsed ) {
46
52
this . _map . on ( 'click' , this . collapse , this ) ;
You can’t perform that action at this time.
0 commit comments