Add hasLayer to LayerGroup
Add the method hasLayer to LayerGroup, return false when not present or checking for a null layer.
This commit is contained in:
parent
a000304473
commit
82d4535180
@ -40,6 +40,13 @@ L.LayerGroup = L.Class.extend({
|
||||
return this;
|
||||
},
|
||||
|
||||
hasLayer: function (layer) {
|
||||
if (!layer) { return false; }
|
||||
|
||||
var id = L.stamp(layer);
|
||||
return this._layers.hasOwnProperty(id);
|
||||
}
|
||||
|
||||
clearLayers: function () {
|
||||
this.eachLayer(this.removeLayer, this);
|
||||
return this;
|
||||
|
Loading…
Reference in New Issue
Block a user