leaflet-boundsawarelayergroup
Advanced tools
Comparing version 1.1.1 to 1.1.2
/* | ||
leaflet-boundsawarelayergroup - 1.1.0, Leaflet.LayerGroup plugin to render only layers in the current map bounds | ||
leaflet-boundsawarelayergroup - 1.1.1, Leaflet.LayerGroup plugin to render only layers in the current map bounds | ||
git://github.com/brandoncopeland/Leaflet.boundsAwareLayerGroup.git | ||
@@ -31,3 +31,3 @@ (c) 2013 Brandon Copeland <br@ndoncopeland.com> | ||
if (this._map) { | ||
if (this.options.makeBoundsAware === true) { | ||
if (this.options && this.options.makeBoundsAware === true) { | ||
this._addForBounds([layer], this._map); | ||
@@ -44,3 +44,3 @@ } else { | ||
this._map = map; | ||
if (this.options.makeBoundsAware === true) { | ||
if (this.options && this.options.makeBoundsAware === true) { | ||
this._addForBounds(this._layers, map); | ||
@@ -47,0 +47,0 @@ map.on('moveend', this._onMapMoveEnd, this); |
/* | ||
leaflet-boundsawarelayergroup - 1.1.0, Leaflet.LayerGroup plugin to render only layers in the current map bounds | ||
leaflet-boundsawarelayergroup - 1.1.1, Leaflet.LayerGroup plugin to render only layers in the current map bounds | ||
git://github.com/brandoncopeland/Leaflet.boundsAwareLayerGroup.git | ||
@@ -8,2 +8,2 @@ (c) 2013 Brandon Copeland <br@ndoncopeland.com> | ||
*/ | ||
!function(a){var b={makeBoundsAware:!1},c=a.LayerGroup.prototype.initialize,d=a.LayerGroup.prototype.onRemove;a.LayerGroup.include({initialize:function(d,e){a.setOptions(this,b),a.setOptions(this,e),c.call(this,d)},addLayer:function(a){var b=this.getLayerId(a);return this._layers[b]=a,this._map&&(this.options.makeBoundsAware===!0?this._addForBounds([a],this._map):this._map.addLayer(a)),this},onAdd:function(a){this._map=a,this.options.makeBoundsAware===!0?(this._addForBounds(this._layers,a),a.on("moveend",this._onMapMoveEnd,this)):this.eachLayer(a.addLayer,a)},onRemove:function(a){d.call(this,a),a.off("moveend",this._onMapMoveEnd,this)},_onMapMoveEnd:function(){this._addForBounds(this._layers,this._map)},_addForBounds:function(a,b){var c,d,e,f=b.getBounds();for(e in a)d=a[e],c=!0,"function"==typeof d.getLatLng?f.contains(d.getLatLng())||(c=!1):"function"==typeof d.getBounds&&(f.intersects(d.getBounds())||(c=!1)),c?b.addLayer(d):b.removeLayer(d)}}),a.layerGroup=function(b,c){return new a.LayerGroup(b,c)},a.featureGroup=function(b,c){return new a.FeatureGroup(b,c)}}(L); | ||
!function(a){var b={makeBoundsAware:!1},c=a.LayerGroup.prototype.initialize,d=a.LayerGroup.prototype.onRemove;a.LayerGroup.include({initialize:function(d,e){a.setOptions(this,b),a.setOptions(this,e),c.call(this,d)},addLayer:function(a){var b=this.getLayerId(a);return this._layers[b]=a,this._map&&(this.options&&this.options.makeBoundsAware===!0?this._addForBounds([a],this._map):this._map.addLayer(a)),this},onAdd:function(a){this._map=a,this.options&&this.options.makeBoundsAware===!0?(this._addForBounds(this._layers,a),a.on("moveend",this._onMapMoveEnd,this)):this.eachLayer(a.addLayer,a)},onRemove:function(a){d.call(this,a),a.off("moveend",this._onMapMoveEnd,this)},_onMapMoveEnd:function(){this._addForBounds(this._layers,this._map)},_addForBounds:function(a,b){var c,d,e,f=b.getBounds();for(e in a)d=a[e],c=!0,"function"==typeof d.getLatLng?f.contains(d.getLatLng())||(c=!1):"function"==typeof d.getBounds&&(f.intersects(d.getBounds())||(c=!1)),c?b.addLayer(d):b.removeLayer(d)}}),a.layerGroup=function(b,c){return new a.LayerGroup(b,c)},a.featureGroup=function(b,c){return new a.FeatureGroup(b,c)}}(L); |
{ | ||
"name": "leaflet-boundsawarelayergroup", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Leaflet.LayerGroup plugin to render only layers in the current map bounds", | ||
@@ -5,0 +5,0 @@ "main": "dist/leaflet.boundsawarelayergroup.js", |
@@ -21,3 +21,3 @@ var defaultOptions = { | ||
if (this._map) { | ||
if (this.options.makeBoundsAware === true) { | ||
if (this.options && this.options.makeBoundsAware === true) { | ||
this._addForBounds([layer], this._map); | ||
@@ -34,3 +34,3 @@ } else { | ||
this._map = map; | ||
if (this.options.makeBoundsAware === true) { | ||
if (this.options && this.options.makeBoundsAware === true) { | ||
this._addForBounds(this._layers, map); | ||
@@ -37,0 +37,0 @@ map.on('moveend', this._onMapMoveEnd, this); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19482