Leaflet.StyledLayerControl icon indicating copy to clipboard operation
Leaflet.StyledLayerControl copied to clipboard

Bug with leaflet 1.1

Open kofronpi opened this issue 7 years ago • 5 comments

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 to false
  • 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

kofronpi avatar Jul 11 '17 12:07 kofronpi

+1

thomas-gt avatar Oct 18 '17 14:10 thomas-gt

+1

edmargomes avatar Jan 02 '18 16:01 edmargomes

+1

gilbertoss avatar Jan 02 '18 22:01 gilbertoss

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();

beve avatar May 06 '19 22:05 beve

This error came back with [email protected] :-(

veragreen119 avatar May 08 '19 01:05 veragreen119