Sha256: 06f38af03bd66202fa9dddcdc13bcf789108f597b9b1d33ccb94bfb5ea3edb5a
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
/* * L.FeatureGroup extends L.LayerGroup by introducing mouse events and additional methods * shared between a group of interactive layers (like vectors or markers). */ L.FeatureGroup = L.LayerGroup.extend({ addLayer: function (layer) { if (this.hasLayer(layer)) { return this; } layer.addEventParent(this); L.LayerGroup.prototype.addLayer.call(this, layer); if (this._popupContent && layer.bindPopup) { layer.bindPopup(this._popupContent, this._popupOptions); } return this.fire('layeradd', {layer: layer}); }, removeLayer: function (layer) { if (!this.hasLayer(layer)) { return this; } if (layer in this._layers) { layer = this._layers[layer]; } layer.removeEventParent(this); L.LayerGroup.prototype.removeLayer.call(this, layer); if (this._popupContent) { this.invoke('unbindPopup'); } return this.fire('layerremove', {layer: layer}); }, bindPopup: function (content, options) { this._popupContent = content; this._popupOptions = options; return this.invoke('bindPopup', content, options); }, openPopup: function (latlng) { // open popup on the first layer for (var id in this._layers) { this._layers[id].openPopup(latlng); break; } return this; }, setStyle: function (style) { return this.invoke('setStyle', style); }, bringToFront: function () { return this.invoke('bringToFront'); }, bringToBack: function () { return this.invoke('bringToBack'); }, getBounds: function () { var bounds = new L.LatLngBounds(); this.eachLayer(function (layer) { bounds.extend(layer.getBounds ? layer.getBounds() : layer.getLatLng()); }); return bounds; } }); L.featureGroup = function (layers) { return new L.FeatureGroup(layers); };
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
leaflet-js-0.8.dev2 | lib/leaflet/src/layer/FeatureGroup.js |