leaflet-boundsawarelayergroup
Advanced tools
Comparing version 1.2.0 to 1.2.1
/* | ||
leaflet-boundsawarelayergroup - 1.1.1, Leaflet.LayerGroup plugin to render only layers in the current map bounds | ||
leaflet-boundsawarelayergroup - 1.2.0, Leaflet.LayerGroup plugin to render only layers in the current map bounds | ||
git://github.com/brandoncopeland/Leaflet.boundsAwareLayerGroup.git | ||
@@ -77,2 +77,9 @@ (c) 2013 Brandon Copeland <br@ndoncopeland.com> | ||
if (this.options.minZoom && map.getZoom() < this.options.minZoom) { | ||
intersectsMapBounds = false; | ||
} | ||
if (this.options.maxZoom && map.getZoom() > this.options.maxZoom) { | ||
intersectsMapBounds = false; | ||
} | ||
if (intersectsMapBounds) { | ||
@@ -79,0 +86,0 @@ map.addLayer(layer); |
/* | ||
leaflet-boundsawarelayergroup - 1.1.1, Leaflet.LayerGroup plugin to render only layers in the current map bounds | ||
leaflet-boundsawarelayergroup - 1.2.0, 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&&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); | ||
!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)),this.options.minZoom&&b.getZoom()<this.options.minZoom&&(c=!1),this.options.maxZoom&&b.getZoom()>this.options.maxZoom&&(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.2.0", | ||
"version": "1.2.1", | ||
"description": "Leaflet.LayerGroup plugin to render only layers in the current map bounds", | ||
@@ -5,0 +5,0 @@ "main": "dist/leaflet.boundsawarelayergroup.js", |
@@ -36,2 +36,7 @@ Leaflet.boundsAwareLayerGroup | ||
## Additional options | ||
- minZoom - Do not show LayerGroup if map zoom is less than minZoom | ||
- maxZoom - Do not show LayerGroup if map zoom is greater than maxZoom | ||
[leaflet.layergroup]: http://leafletjs.com/reference.html#layergroup | ||
@@ -38,0 +43,0 @@ [leaflet.featuregroup]: http://leafletjs.com/reference.html#featuregroup |
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
29403
524
44