Merge pull request #1400 from jfirebaugh/getTileUrl

Enable cleaner overriding of TileLayer#getTileUrl
This commit is contained in:
Vladimir Agafonkin 2013-02-15 16:39:22 -08:00
commit f12e7e65f3
2 changed files with 4 additions and 5 deletions

View File

@ -48,8 +48,6 @@ L.TileLayer.WMS = L.TileLayer.extend({
getTileUrl: function (tilePoint, zoom) { // (Point, Number) -> String
this._adjustTilePoint(tilePoint);
var map = this._map,
crs = map.options.crs,
tileSize = this.options.tileSize,

View File

@ -424,11 +424,9 @@ L.TileLayer = L.Class.extend({
// image-specific code (override to implement e.g. Canvas or SVG tile layer)
getTileUrl: function (tilePoint) {
this._adjustTilePoint(tilePoint);
return L.Util.template(this._url, L.extend({
s: this._getSubdomain(tilePoint),
z: this._getZoomForUrl(),
z: tilePoint.z,
x: tilePoint.x,
y: tilePoint.y
}, this.options));
@ -451,6 +449,8 @@ L.TileLayer = L.Class.extend({
if (this.options.tms) {
tilePoint.y = limit - tilePoint.y - 1;
}
tilePoint.z = this._getZoomForUrl();
},
_getSubdomain: function (tilePoint) {
@ -491,6 +491,7 @@ L.TileLayer = L.Class.extend({
tile.onload = this._tileOnLoad;
tile.onerror = this._tileOnError;
this._adjustTilePoint(tilePoint);
tile.src = this.getTileUrl(tilePoint);
},