diff --git a/dist/leaflet.groupedlayercontrol.min.js b/dist/leaflet.groupedlayercontrol.min.js
index a6693f9..e50ee4f 100644
--- a/dist/leaflet.groupedlayercontrol.min.js
+++ b/dist/leaflet.groupedlayercontrol.min.js
@@ -1,5 +1,5 @@
/*! Version: 0.6.1
-Date: 2018-04-30 */
+Date: 2018-07-06 */
-L.Control.GroupedLayers=L.Control.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,exclusiveGroups:[],groupCheckboxes:!1},initialize:function(a,b,c){var d,e;L.Util.setOptions(this,c),this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._groupList=[],this._domGroups=[];for(d in a)this._addLayer(a[d],d);for(d in b)for(e in b[d])this._addLayer(b[d][e],e,d,!0)},onAdd:function(a){return this._initLayout(),this._update(),a.on("layeradd",this._onLayerChange,this).on("layerremove",this._onLayerChange,this),this._container},onRemove:function(a){a.off("layeradd",this._onLayerChange,this).off("layerremove",this._onLayerChange,this)},addBaseLayer:function(a,b){return this._addLayer(a,b),this._update(),this},addOverlay:function(a,b,c){return this._addLayer(a,b,c,!0),this._update(),this},removeLayer:function(a){var b=L.Util.stamp(a),c=this._getLayer(b);return c&&delete this._layers[this._layers.indexOf(c)],this._update(),this},_getLayer:function(a){for(var b=0;b";var d=document.createElement("div");return d.innerHTML=c,d.firstChild},_addItem:function(a){var b,c,d,e=document.createElement("label"),f=this._map.hasLayer(a.layer);a.overlay?a.group.exclusive?(d="leaflet-exclusive-group-layer-"+a.group.id,b=this._createRadioElement(d,f)):(b=document.createElement("input"),b.type="checkbox",b.className="leaflet-control-layers-selector",b.defaultChecked=f):b=this._createRadioElement("leaflet-base-layers",f),b.layerId=L.Util.stamp(a.layer),b.groupID=a.group.id,L.DomEvent.on(b,"click",this._onInputClick,this);var g=document.createElement("span");if(g.innerHTML=" "+a.name,e.appendChild(b),e.appendChild(g),a.overlay){c=this._overlaysList;var h=this._domGroups[a.group.id];if(!h){h=document.createElement("div"),h.className="leaflet-control-layers-group",h.id="leaflet-control-layers-group-"+a.group.id;var i=document.createElement("label");if(i.className="leaflet-control-layers-group-label",""!==a.group.name&&!a.group.exclusive&&this.options.groupCheckboxes){var j=document.createElement("input");j.type="checkbox",j.className="leaflet-control-layers-group-selector",j.groupID=a.group.id,j.legend=this,L.DomEvent.on(j,"click",this._onGroupInputClick,j),i.appendChild(j)}var k=document.createElement("span");k.className="leaflet-control-layers-group-name",k.innerHTML=a.group.name,i.appendChild(k),h.appendChild(i),c.appendChild(h),this._domGroups[a.group.id]=h}c=h}else c=this._baseLayersList;return c.appendChild(e),e},_onGroupInputClick:function(){var a,b,c,d=this.legend;d._handlingClick=!0;var e=d._form.getElementsByTagName("input"),f=e.length;for(a=0;f>a;a++)b=e[a],b.groupID===this.groupID&&"leaflet-control-layers-selector"===b.className&&(b.checked=this.checked,c=d._getLayer(b.layerId),b.checked&&!d._map.hasLayer(c.layer)?d._map.addLayer(c.layer):!b.checked&&d._map.hasLayer(c.layer)&&d._map.removeLayer(c.layer));d._handlingClick=!1},_onInputClick:function(){var a,b,c,d=this._form.getElementsByTagName("input"),e=d.length;for(this._handlingClick=!0,a=0;e>a;a++)b=d[a],"leaflet-control-layers-selector"===b.className&&(c=this._getLayer(b.layerId),b.checked&&!this._map.hasLayer(c.layer)?this._map.addLayer(c.layer):!b.checked&&this._map.hasLayer(c.layer)&&this._map.removeLayer(c.layer));this._handlingClick=!1},_expand:function(){L.DomUtil.addClass(this._container,"leaflet-control-layers-expanded");var a=this._map._size.y-4*this._container.offsetTop;ac;c++)if(a[c]===b)return c;return-1}}),L.control.groupedLayers=function(a,b,c){return new L.Control.GroupedLayers(a,b,c)};
+L.Control.GroupedLayers=L.Control.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,exclusiveGroups:[],groupCheckboxes:!1},initialize:function(a,b,c){var d,e;L.Util.setOptions(this,c),this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._groupList=[],this._domGroups=[];for(d in a)this._addLayer(a[d],d);for(d in b)for(e in b[d])this._addLayer(b[d][e],e,d,!0)},onAdd:function(a){return this._initLayout(),this._update(),a.on("layeradd",this._onLayerChange,this).on("layerremove",this._onLayerChange,this),this._container},addTo:function(a){return L.Control.prototype.addTo.call(this,a),this._expandIfNotCollapsed()},onRemove:function(a){a.off("layeradd",this._onLayerChange,this).off("layerremove",this._onLayerChange,this)},addBaseLayer:function(a,b){return this._addLayer(a,b),this._update(),this},addOverlay:function(a,b,c){return this._addLayer(a,b,c,!0),this._update(),this},removeLayer:function(a){var b=L.Util.stamp(a),c=this._getLayer(b);return c&&this._layers.splice(this._layers.indexOf(c),1),this._update(),this},_getLayer:function(a){for(var b=0;b";var d=document.createElement("div");return d.innerHTML=c,d.firstChild},_addItem:function(a){var b,c,d,e=document.createElement("label"),f=this._map.hasLayer(a.layer);a.overlay?a.group.exclusive?(d="leaflet-exclusive-group-layer-"+a.group.id,b=this._createRadioElement(d,f)):(b=document.createElement("input"),b.type="checkbox",b.className="leaflet-control-layers-selector",b.defaultChecked=f):b=this._createRadioElement("leaflet-base-layers",f),b.layerId=L.Util.stamp(a.layer),b.groupID=a.group.id,L.DomEvent.on(b,"click",this._onInputClick,this);var g=document.createElement("span");if(g.innerHTML=" "+a.name,e.appendChild(b),e.appendChild(g),a.overlay){c=this._overlaysList;var h=this._domGroups[a.group.id];if(!h){h=document.createElement("div"),h.className="leaflet-control-layers-group",h.id="leaflet-control-layers-group-"+a.group.id;var i=document.createElement("label");if(i.className="leaflet-control-layers-group-label",""!==a.group.name&&!a.group.exclusive&&this.options.groupCheckboxes){var j=document.createElement("input");j.type="checkbox",j.className="leaflet-control-layers-group-selector",j.groupID=a.group.id,j.legend=this,L.DomEvent.on(j,"click",this._onGroupInputClick,j),i.appendChild(j)}var k=document.createElement("span");k.className="leaflet-control-layers-group-name",k.innerHTML=a.group.name,i.appendChild(k),h.appendChild(i),c.appendChild(h),this._domGroups[a.group.id]=h}c=h}else c=this._baseLayersList;return c.appendChild(e),e},_onGroupInputClick:function(){var a,b,c,d=this.legend;d._handlingClick=!0;var e=d._form.getElementsByTagName("input"),f=e.length;for(a=0;f>a;a++)b=e[a],b.groupID===this.groupID&&"leaflet-control-layers-selector"===b.className&&(b.checked=this.checked,c=d._getLayer(b.layerId),b.checked&&!d._map.hasLayer(c.layer)?d._map.addLayer(c.layer):!b.checked&&d._map.hasLayer(c.layer)&&d._map.removeLayer(c.layer));d._handlingClick=!1},_onInputClick:function(){var a,b,c,d=this._form.getElementsByTagName("input"),e=d.length;for(this._handlingClick=!0,a=0;e>a;a++)b=d[a],"leaflet-control-layers-selector"===b.className&&(c=this._getLayer(b.layerId),b.checked&&!this._map.hasLayer(c.layer)?this._map.addLayer(c.layer):!b.checked&&this._map.hasLayer(c.layer)&&this._map.removeLayer(c.layer));this._handlingClick=!1},_expand:function(){L.DomUtil.addClass(this._container,"leaflet-control-layers-expanded"),this._form.style.height=null;var a=this._map.getSize().y-(this._container.offsetTop+50);return ac;c++)if(a[c]===b)return c;return-1}}),L.control.groupedLayers=function(a,b,c){return new L.Control.GroupedLayers(a,b,c)};
//# sourceMappingURL=leaflet.groupedlayercontrol.min.js.map
\ No newline at end of file
diff --git a/dist/leaflet.groupedlayercontrol.min.js.map b/dist/leaflet.groupedlayercontrol.min.js.map
index 5bbb028..53294bb 100644
--- a/dist/leaflet.groupedlayercontrol.min.js.map
+++ b/dist/leaflet.groupedlayercontrol.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"leaflet.groupedlayercontrol.min.js","sources":["../src/leaflet.groupedlayercontrol.js"],"names":["L","Control","GroupedLayers","extend","options","collapsed","position","autoZIndex","exclusiveGroups","groupCheckboxes","initialize","baseLayers","groupedOverlays","i","j","Util","setOptions","this","_layers","_lastZIndex","_handlingClick","_groupList","_domGroups","_addLayer","onAdd","map","_initLayout","_update","on","_onLayerChange","_container","onRemove","off","addBaseLayer","layer","name","addOverlay","group","removeLayer","id","stamp","_layer","_getLayer","indexOf","length","className","container","DomUtil","create","setAttribute","Browser","touch","DomEvent","stopPropagation","disableClickPropagation","form","_form","android","_expand","_collapse","link","_layersLink","href","title","stop","_map","_baseLayersList","_separator","_overlaysList","appendChild","overlay","push","groupId","_indexOf","exclusive","setZIndex","innerHTML","obj","baseLayersPresent","overlaysPresent","_addItem","style","display","e","type","fire","_createRadioElement","checked","radioHtml","radioFragment","document","createElement","firstChild","input","groupRadioName","label","hasLayer","defaultChecked","layerId","groupID","_onInputClick","groupContainer","groupLabel","groupInput","legend","_onGroupInputClick","groupName","this_legend","inputs","getElementsByTagName","inputsLen","addLayer","addClass","acceptableHeight","_size","y","offsetTop","clientHeight","height","replace","arr","control","groupedLayers"],"mappings":";;;AAIAA,EAAEC,QAAQC,cAAgBF,EAAEC,QAAQE,QAElCC,SACEC,WAAW,EACXC,SAAU,WACVC,YAAY,EACZC,mBACAC,iBAAiB,GAGnBC,WAAY,SAAUC,EAAYC,EAAiBR,GACjD,GAAIS,GAAGC,CACPd,GAAEe,KAAKC,WAAWC,KAAMb,GAExBa,KAAKC,WACLD,KAAKE,YAAc,EACnBF,KAAKG,gBAAiB,EACtBH,KAAKI,cACLJ,KAAKK,aAEL,KAAKT,IAAKF,GACRM,KAAKM,UAAUZ,EAAWE,GAAIA,EAGhC,KAAKA,IAAKD,GACR,IAAKE,IAAKF,GAAgBC,GACxBI,KAAKM,UAAUX,EAAgBC,GAAGC,GAAIA,EAAGD,GAAG,IAKlDW,MAAO,SAAUC,GAQf,MAPAR,MAAKS,cACLT,KAAKU,UAELF,EACKG,GAAG,WAAYX,KAAKY,eAAgBZ,MACpCW,GAAG,cAAeX,KAAKY,eAAgBZ,MAErCA,KAAKa,YAGdC,SAAU,SAAUN,GAClBA,EACKO,IAAI,WAAYf,KAAKY,eAAgBZ,MACrCe,IAAI,cAAef,KAAKY,eAAgBZ,OAG/CgB,aAAc,SAAUC,EAAOC,GAG7B,MAFAlB,MAAKM,UAAUW,EAAOC,GACtBlB,KAAKU,UACEV,MAGTmB,WAAY,SAAUF,EAAOC,EAAME,GAGjC,MAF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,KAAOgE,EACb,MAAOhE,EAGX,OAAO,MAIXb,EAAEyH,QAAQC,cAAgB,SAAU/G,EAAYC,EAAiBR,GAC/D,MAAO,IAAIJ,GAAEC,QAAQC,cAAcS,EAAYC,EAAiBR"}
\ No newline at end of file
+{"version":3,"file":"leaflet.groupedlayercontrol.min.js","sources":["../src/leaflet.groupedlayercontrol.js"],"names":["L","Control","GroupedLayers","extend","options","collapsed","position","autoZIndex","exclusiveGroups","groupCheckboxes","initialize","baseLayers","groupedOverlays","i","j","Util","setOptions","this","_layers","_lastZIndex","_handlingClick","_groupList","_domGroups","_addLayer","onAdd","map","_initLayout","_update","on","_onLayerChange","_container","addTo","prototype","call","_expandIfNotCollapsed","onRemove","off","addBaseLayer","layer","name","addOverlay","group","removeLayer","id","stamp","_layer","_getLayer","splice","indexOf","length","className","container","DomUtil","create","setAttribute","DomEvent","disableClickPropagation","disableScrollPropagation","form","_form","_map","_collapse","Browser","android","mouseenter","_expand","mouseleave","link","_layersLink","href","title","touch","stop","_baseLayersList","_separator","_overlaysList","appendChild","overlay","push","groupId","_indexOf","exclusive","setZIndex","innerHTML","obj","baseLayersPresent","overlaysPresent","_addItem","style","display","e","type","fire","_createRadioElement","checked","radioHtml","radioFragment","document","createElement","firstChild","input","groupRadioName","label","hasLayer","defaultChecked","layerId","groupID","_onInputClick","groupContainer","groupLabel","groupInput","legend","_onGroupInputClick","groupName","this_legend","inputs","getElementsByTagName","inputsLen","addLayer","addClass","height","acceptableHeight","getSize","y","offsetTop","clientHeight","removeClass","replace","arr","control","groupedLayers"],"mappings":";;;AAIAA,EAAEC,QAAQC,cAAgBF,EAAEC,QAAQE,QAElCC,SACEC,WAAW,EACXC,SAAU,WACVC,YAAY,EACZC,mBACAC,iBAAiB,GAGnBC,WAAY,SAAUC,EAAYC,EAAiBR,GACjD,GAAIS,GAAGC,CACPd,GAAEe,KAAKC,WAAWC,KAAMb,GAExBa,KAAKC,WACLD,KAAKE,YAAc,EACnBF,KAAKG,gBAAiB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,EAAI9C,QACb8D,EAAMN,SAAW7E,KAAK2C,KAAK2C,SAASnB,EAAI9C,QAClDrB,KAAK2C,KAAKlB,YAAY0C,EAAI9C,OAKhCrB,MAAKG,gBAAiB,GAGxB6C,QAAS,WACPjE,EAAEoD,QAAQmE,SAAStG,KAAKa,WAAY,mCACpCb,KAAK0C,MAAM6B,MAAMgC,OAAS,IAC1B,IAAIC,GAAmBxG,KAAK2C,KAAK8D,UAAUC,GAAK1G,KAAKa,WAAW8F,UAAY,GAQ5E,OAPIH,GAAmBxG,KAAK0C,MAAMkE,cAChC7H,EAAEoD,QAAQmE,SAAStG,KAAK0C,MAAO,oCAC/B1C,KAAK0C,MAAM6B,MAAMgC,OAASC,EAAmB,MAE7CzH,EAAEoD,QAAQ0E,YAAY7G,KAAK0C,MAAO,oCAG7B1C,MAGTiB,sBAAuB,WAIrB,MAHIjB,MAAK2C,OAAS3C,KAAKb,QAAQC,WAC7BY,KAAKgD,UAEAhD,MAGT4C,UAAW,WACT5C,KAAKa,WAAWoB,UAAYjC,KAAKa,WAAWoB,UAAU6E,QAAQ,mCAAoC,KAGpG/C,SAAU,SAAUgD,EAAK5C,GACvB,IAAK,GAAIvE,GAAI,EAAGC,EAAIkH,EAAI/E,OAAYnC,EAAJD,EAAOA,IACrC,GAAImH,EAAInH,KAAOuE,EACb,MAAOvE,EAGX,OAAO,MAIXb,EAAEiI,QAAQC,cAAgB,SAAUvH,EAAYC,EAAiBR,GAC/D,MAAO,IAAIJ,GAAEC,QAAQC,cAAcS,EAAYC,EAAiBR"}
\ No newline at end of file
diff --git a/src/leaflet.groupedlayercontrol.js b/src/leaflet.groupedlayercontrol.js
index b1e80d1..28eee08 100644
--- a/src/leaflet.groupedlayercontrol.js
+++ b/src/leaflet.groupedlayercontrol.js
@@ -44,6 +44,12 @@ L.Control.GroupedLayers = L.Control.extend({
return this._container;
},
+ addTo: function (map) {
+ L.Control.prototype.addTo.call(this, map);
+ // Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height.
+ return this._expandIfNotCollapsed();
+ },
+
onRemove: function (map) {
map
.off('layeradd', this._onLayerChange, this)
@@ -66,7 +72,7 @@ L.Control.GroupedLayers = L.Control.extend({
var id = L.Util.stamp(layer);
var _layer = this._getLayer(id);
if (_layer) {
- delete this._layers[this._layers.indexOf(_layer)];
+ this._layers.splice(this._layers.indexOf(_layer), 1);
}
this._update();
return this;
@@ -82,41 +88,40 @@ L.Control.GroupedLayers = L.Control.extend({
_initLayout: function () {
var className = 'leaflet-control-layers',
- container = this._container = L.DomUtil.create('div', className);
+ container = this._container = L.DomUtil.create('div', className),
+ collapsed = this.options.collapsed;
// Makes this work on IE10 Touch devices by stopping it from firing a mouseout event when the touch is released
container.setAttribute('aria-haspopup', true);
- if (L.Browser.touch) {
- L.DomEvent.on(container, 'click', L.DomEvent.stopPropagation);
- } else {
- L.DomEvent.disableClickPropagation(container);
- L.DomEvent.on(container, 'wheel', L.DomEvent.stopPropagation);
- }
+ L.DomEvent.disableClickPropagation(container);
+ L.DomEvent.disableScrollPropagation(container);
var form = this._form = L.DomUtil.create('form', className + '-list');
- if (this.options.collapsed) {
+ if (collapsed) {
+ this._map.on('click', this._collapse, this);
+
if (!L.Browser.android) {
- L.DomEvent
- .on(container, 'mouseover', this._expand, this)
- .on(container, 'mouseout', this._collapse, this);
- }
- var link = this._layersLink = L.DomUtil.create('a', className + '-toggle', container);
- link.href = '#';
- link.title = 'Layers';
-
- if (L.Browser.touch) {
- L.DomEvent
- .on(link, 'click', L.DomEvent.stop)
- .on(link, 'click', this._expand, this);
- } else {
- L.DomEvent.on(link, 'focus', this._expand, this);
+ L.DomEvent.on(container, {
+ mouseenter: this._expand,
+ mouseleave: this._collapse
+ }, this);
}
+ }
- this._map.on('click', this._collapse, this);
- // TODO keyboard accessibility
+ var link = this._layersLink = L.DomUtil.create('a', className + '-toggle', container);
+ link.href = '#';
+ link.title = 'Layers';
+
+ if (L.Browser.touch) {
+ L.DomEvent.on(link, 'click', L.DomEvent.stop);
+ L.DomEvent.on(link, 'click', this._expand, this);
} else {
+ L.DomEvent.on(link, 'focus', this._expand, this);
+ }
+
+ if (!collapsed) {
this._expand();
}
@@ -156,6 +161,8 @@ L.Control.GroupedLayers = L.Control.extend({
this._lastZIndex++;
layer.setZIndex(this._lastZIndex);
}
+
+ this._expandIfNotCollapsed();
},
_update: function () {
@@ -347,12 +354,23 @@ L.Control.GroupedLayers = L.Control.extend({
_expand: function () {
L.DomUtil.addClass(this._container, 'leaflet-control-layers-expanded');
- // permits to have a scrollbar if overlays heighter than the map.
- var acceptableHeight = this._map._size.y - (this._container.offsetTop * 4);
+ this._form.style.height = null;
+ var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);
if (acceptableHeight < this._form.clientHeight) {
L.DomUtil.addClass(this._form, 'leaflet-control-layers-scrollbar');
this._form.style.height = acceptableHeight + 'px';
+ } else {
+ L.DomUtil.removeClass(this._form, 'leaflet-control-layers-scrollbar');
}
+ // this._checkDisabledLayers();
+ return this;
+ },
+
+ _expandIfNotCollapsed: function () {
+ if (this._map && !this.options.collapsed) {
+ this._expand();
+ }
+ return this;
},
_collapse: function () {