diff --git a/lib/torque/leaflet/torque.js b/lib/torque/leaflet/torque.js index 9049bac..835ffb2 100644 --- a/lib/torque/leaflet/torque.js +++ b/lib/torque/leaflet/torque.js @@ -86,11 +86,6 @@ L.TorqueLayer = L.CanvasLayer.extend({ // for each tile shown on the map request the data this.on('tileAdded', function(t) { - var fixedPoint = new L.Point(t.x, t.y); - this._adjustTilePoint(fixedPoint); - t.corrected = {}; - t.corrected.x = fixedPoint.x; - t.corrected.y = fixedPoint.y; var tileData = this.provider.getTileData(t, t.zoom, function(tileData) { // don't load tiles that are not being shown if (t.zoom !== self._map.getZoom()) return; @@ -104,39 +99,6 @@ L.TorqueLayer = L.CanvasLayer.extend({ }, - _adjustTilePoint: function (tilePoint) { - - var limit = this._getWrapTileNum(); - - // wrap tile coordinates - if (!this.options.continuousWorld && !this.options.noWrap) { - tilePoint.x = ((tilePoint.x % limit.x) + limit.x) % limit.x; - } - - if (this.options.tms) { - tilePoint.y = limit.y - tilePoint.y - 1; - } - }, - - _getWrapTileNum: function () { - var crs = this._map.options.crs, - size = crs.getSize(this._map.getZoom()); - return size.divideBy(this._getTileSize())._floor(); - }, - - _getTileSize: function () { - var map = this._map, - zoom = map.getZoom() + this.options.zoomOffset, - zoomN = this.options.maxNativeZoom, - tileSize = this.options.tileSize; - - if (zoomN && zoom > zoomN) { - tileSize = Math.round(map.getZoomScale(zoom) / map.getZoomScale(zoomN) * tileSize); - } - - return tileSize; - }, - _clearTileCaches: function() { var t, tile; for(t in this._tiles) { diff --git a/lib/torque/provider/windshaft.js b/lib/torque/provider/windshaft.js index 5671d2f..a3e05b7 100644 --- a/lib/torque/provider/windshaft.js +++ b/lib/torque/provider/windshaft.js @@ -281,10 +281,12 @@ var self = this; var prof_fetch_time = Profiler.metric('torque.provider.windshaft.tile.fetch').start(); var subdomains = this.options.subdomains || '0123'; - var index = Math.abs(coord.corrected.x + coord.corrected.y) % subdomains.length; + var limit_x = Math.pow(2, zoom); + var corrected_x = ((coord.x % limit_x) + limit_x) % limit_x; + var index = Math.abs(corrected_x + coord.y) % subdomains.length; var url = this.templateUrl - .replace('{x}', coord.corrected.x) - .replace('{y}', coord.corrected.y) + .replace('{x}', corrected_x) + .replace('{y}', coord.y) .replace('{z}', zoom) .replace('{s}', subdomains[index])