Leaflet.StyledLayerControl
Leaflet.StyledLayerControl copied to clipboard
Bug with leaflet 1.1
How to reproduce
- Leaflet version I'm using: 1.1.0
- Browser (with version) I'm using: Chrome Version 57.0.2987.133 (64-bit)
- OS/Platform (with version) I'm using: Ubuntu 16.04 x86_64 4.4.0-59-generic
- Step 1 : Import this snippet of code which should be compatible with Leaflet 1.1 new API : https://github.com/davicustodio/Leaflet.StyledLayerControl/blob/master/src/styledLayerControl.js and change option
collapsed
tofalse
- Step 2 : Use this repo's code
What behaviour I'm expecting and which behaviour I'm seeing
This extended ControlLayer worked well with Leaflet 1.0.3.
It still works, but triggers an error in the web console:
leaflet-src.self-2632dc6….js?body=1:5110 Uncaught TypeError: Cannot read property 'length' of undefined
at NewClass._checkDisabledLayers (leaflet-src.self-2632dc6….js?body=1:5110)
at NewClass.expand (leaflet-src.self-2632dc6….js?body=1:4870)
at NewClass._expandIfNotCollapsed (leaflet-src.self-2632dc6….js?body=1:5121)
at NewClass.addTo (leaflet-src.self-2632dc6….js?body=1:4821)
at NewClass.addControl (leaflet-src.self-2632dc6….js?body=1:4676)
[...]
Minimal example reproducing the issue
Full example without overlays: (it's the same error with or without overlays) https://playground-leaflet.rhcloud.com/heki/edit
+1
+1
+1
Hi, Late answer but if it can help i found a workaround:
In styledLayerControl.js rename _initLayout: function() to _initCustomLayout: function() line 148.
Now line 43 in function onAdd() , add a call to this._initCustomLayout(); after the this._initLayout() and before this._update();
This error came back with [email protected] :-(