2017-06-02 22 views

cevap

4

Orada bunun için hiçbir API olduğunu ancak kolayca tek kendin oluşturabilirsiniz:

// Add method to layer control class 
L.Control.Layers.include({ 
    getActiveOverlays: function() { 

     // Create array for holding active layers 
     var active = []; 

     // Iterate all layers in control 
     this._layers.forEach(function (obj) { 

      // Check if it's an overlay and added to the map 
      if (obj.overlay && this._map.hasLayer(obj.layer)) { 

       // Push layer to active array 
       active.push(obj.layer); 
      } 
     }); 

     // Return array 
     return active; 
    } 
}); 

var control = new L.Control.Layers(...), 
    active = control.getActiveOverlays();