2 * L.FeatureGroup extends L.LayerGroup by introducing mouse events and bindPopup method shared between a group of layers.
5 L
.FeatureGroup
= L
.LayerGroup
.extend({
6 includes
: L
.Mixin
.Events
,
8 addLayer: function(layer
) {
9 this._initEvents(layer
);
10 L
.LayerGroup
.prototype.addLayer
.call(this, layer
);
12 if (this._popupContent
&& layer
.bindPopup
) {
13 layer
.bindPopup(this._popupContent
);
17 bindPopup: function(content
) {
18 this._popupContent
= content
;
20 for (var i
in this._layers
) {
21 if (this._layers
.hasOwnProperty(i
) && this._layers
[i
].bindPopup
) {
22 this._layers
[i
].bindPopup(content
);
27 _events
: ['click', 'dblclick', 'mouseover', 'mouseout'],
29 _initEvents: function(layer
) {
30 for (var i
= 0, len
= this._events
.length
; i
< len
; i
++) {
31 layer
.on(this._events
[i
], this._propagateEvent
, this);
35 _propagateEvent: function(e
) {