Skip to content

Commit

Permalink
Add options parameter to Provider constructor.
Browse files Browse the repository at this point in the history
This allows users to pass through parameters to the tile layer
that they may want to customize.  For example opacity.
abierbaum committed Jan 10, 2013
1 parent 5488589 commit 4ec60a2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions leaflet-providers-0.0.2.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
var providers = {};

L.TileLayer.Provider = L.TileLayer.extend({
initialize: function (arg) {
initialize: function (arg, options) {
var parts = arg.split('.');

var providerName = parts[0];
@@ -37,7 +37,9 @@
return providers[attributionName].options.attribution;
});
}
L.TileLayer.prototype.initialize.call(this, provider.url, provider.options);
// Compute final options combining provider options with any user overrides
var layer_opts = L.Util.extend({}, provider.options, options);
L.TileLayer.prototype.initialize.call(this, provider.url, layer_opts);
}
});

0 comments on commit 4ec60a2

Please sign in to comment.