Permalink
Browse files

TMS support

- Tried to make code a little easier to understand.
- Supporting TMS (just doing what L.TileLayer does here).
  • Loading branch information...
1 parent a78b0fc commit f4afd49fa8671221cbbe6510a70c191faf12c8b3 @ismyrnow committed Feb 2, 2014
Showing with 14 additions and 13 deletions.
  1. +14 −13 src/leaflet.functionaltilelayer.js
@@ -8,7 +8,6 @@ L.TileLayer.Functional = L.TileLayer.extend({
},
getTileUrl: function (tilePoint) {
- // Note: bbox code untested; pulled from TileLayer.WMS
var map = this._map,
crs = map.options.crs,
tileSize = this.options.tileSize,
@@ -17,18 +16,20 @@ L.TileLayer.Functional = L.TileLayer.extend({
sePoint = nwPoint.add(new L.Point(tileSize, tileSize)),
nw = crs.project(map.unproject(nwPoint, zoom)),
se = crs.project(map.unproject(sePoint, zoom)),
- bbox = [nw.x, se.y, se.x, nw.y].join(','),
- view = {
- bbox: bbox,
- width: tileSize,
- height: tileSize,
- zoom: zoom,
- tile: {
- row: tilePoint.y,
- column: tilePoint.x
- },
- subdomain: this._getSubdomain(tilePoint)
- };
+ bbox = [nw.x, se.y, se.x, nw.y].join(',');
+
+ // Setup object to send to tile function.
+ var view = {
+ bbox: bbox,
+ width: tileSize,
+ height: tileSize,
+ zoom: zoom,
+ tile: {
+ row: this.options.tms ? this._tileNumBounds.max.y - tilePoint.y : tilePoint.y,
+ column: tilePoint.x
+ },
+ subdomain: this._getSubdomain(tilePoint)
+ };
return this._tileFunction(view);
},

0 comments on commit f4afd49

Please sign in to comment.