diff --git a/leaflet-providers.js b/leaflet-providers.js index 64eeb162..cc896900 100644 --- a/leaflet-providers.js +++ b/leaflet-providers.js @@ -27,7 +27,7 @@ var provider = { url: providers[providerName].url, - options: providers[providerName].options + options: providers[providerName].options, }; // overwrite values in provider from variant. @@ -63,6 +63,16 @@ ); }; provider.options.attribution = attributionReplacer(provider.options.attribution); + + // Override maxZoom if user want to use maxNativeZoom instead + if (options.hasOwnProperty('useNativeZoom') && options.hasOwnProperty('maxZoom')) { + if (options.useNativeZoom) { + // Add provider maxNativeZoom key equals to old maxZoom + provider.options.maxNativeZoom = provider.options.maxZoom; + // Delete custom useNativeZoom key + delete options.useNativeZoom; + } + } // Compute final options combining provider options with any user overrides var layerOpts = L.Util.extend({}, provider.options, options);