Skip to content

Instantly share code, notes, and snippets.

@IvanSanchez
Created September 27, 2016 07:27
Show Gist options
  • Save IvanSanchez/7529e0516ec260d4efe8ce510fab1083 to your computer and use it in GitHub Desktop.
Save IvanSanchez/7529e0516ec260d4efe8ce510fab1083 to your computer and use it in GitHub Desktop.
/* eslint indent:[2, "tab", {"VariableDeclarator": 0}], no-mixed-spaces-and-tabs:[2, "smart-tabs"] */
// Code snipped from https://github.com/Leaflet/Leaflet/blob/master/src/layer/Layer.js
L.Layer = L.Evented.extend({
_updateZoomLevels: function () {
var minZoom = Infinity,
maxZoom = -Infinity,
oldZoomSpan = this._getZoomSpan();
for (var i in this._zoomBoundLayers) {
var options = this._zoomBoundLayers[i].options;
minZoom = options.minZoom === undefined ? minZoom : Math.min(minZoom, options.minZoom);
maxZoom = options.maxZoom === undefined ? maxZoom : Math.max(maxZoom, options.maxZoom);
}
this._layersMaxZoom = maxZoom === -Infinity ? undefined : maxZoom;
this._layersMinZoom = minZoom === Infinity ? undefined : minZoom;
if (oldZoomSpan !== this._getZoomSpan()) {
this.fire('zoomlevelschange');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment