Script and makefile adjustments for updating extlib
[larjonas-mediagoblin.git] / extlib / leaflet / src / layer / FeatureGroup.js
blob6e45d84c79d9c998d3e29dba53187190bb2210a7
1 /*
2 * L.FeatureGroup extends L.LayerGroup by introducing mouse events and bindPopup method shared between a group of layers.
3 */
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) {
36 e.layer = e.target;
37 e.target = this;
38 this.fire(e.type, e);
40 });