Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to use maxNativeZoom and maxZoom to allow pixelized tile (instead of a grey tile) #323

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion leaflet-providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

var provider = {
url: providers[providerName].url,
options: providers[providerName].options
options: providers[providerName].options,
};

// overwrite values in provider from variant.
Expand Down Expand Up @@ -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);
Expand Down