From b78e1964ace44e6908a4141fc8c869be34834de7 Mon Sep 17 00:00:00 2001 From: Joffrey Bourdieux Date: Tue, 21 May 2019 12:26:35 +0200 Subject: [PATCH 1/2] Add maxNativeZoom key on each providers to allow pixelized tile --- leaflet-providers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/leaflet-providers.js b/leaflet-providers.js index d2aa47d6..c530908e 100644 --- a/leaflet-providers.js +++ b/leaflet-providers.js @@ -25,9 +25,11 @@ throw 'No such provider (' + providerName + ')'; } + var opts = providers[providerName].options; + opts.maxNativeZoom = opts.maxZoom; var provider = { url: providers[providerName].url, - options: providers[providerName].options + options: opts, }; // overwrite values in provider from variant. From 20b91939dd868570c80442c01fc282ad1266a00f Mon Sep 17 00:00:00 2001 From: Joffrey Date: Fri, 5 Jul 2019 15:40:55 +0200 Subject: [PATCH 2/2] Add maxNativeZoom as an option --- leaflet-providers.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/leaflet-providers.js b/leaflet-providers.js index ff8a1fab..cc896900 100644 --- a/leaflet-providers.js +++ b/leaflet-providers.js @@ -25,11 +25,9 @@ throw 'No such provider (' + providerName + ')'; } - var opts = providers[providerName].options; - opts.maxNativeZoom = opts.maxZoom; var provider = { url: providers[providerName].url, - options: opts, + options: providers[providerName].options, }; // overwrite values in provider from variant. @@ -65,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);