diff --git a/src/geo/crs/CRS.js b/src/geo/crs/CRS.js index f8ccbaa668c..a24a8b4d2c7 100644 --- a/src/geo/crs/CRS.js +++ b/src/geo/crs/CRS.js @@ -5,14 +5,14 @@ L.CRS = { latLngToPoint: function (latlng, zoom) { // (LatLng, Number) -> Point var projectedPoint = this.projection.project(latlng), - scale = this.scale(zoom); + scale = this.scale(zoom); return this.transformation._transform(projectedPoint, scale); }, pointToLatLng: function (point, zoom) { // (Point, Number[, Boolean]) -> LatLng var scale = this.scale(zoom), - untransformedPoint = this.transformation.untransform(point, scale); + untransformedPoint = this.transformation.untransform(point, scale); return this.projection.unproject(untransformedPoint); }, @@ -25,8 +25,8 @@ L.CRS = { return 256 * Math.pow(2, zoom); }, - getBounds: function (zoom) { + getSize: function (zoom) { var s = this.scale(zoom); - return [s, s, s, s]; - } + return L.point(s, s); + } }; diff --git a/src/layer/tile/TileLayer.js b/src/layer/tile/TileLayer.js index e60cee939c9..e0b13a232f6 100644 --- a/src/layer/tile/TileLayer.js +++ b/src/layer/tile/TileLayer.js @@ -474,8 +474,8 @@ L.TileLayer = L.Class.extend({ _getWrapTileNum: function () { var crs = this._map.options.crs, - bounds = crs.getBounds(this._getZoomForUrl()); - return bounds[3] / this.options.tileSize; + size = crs.getSize(this._getZoomForUrl()); + return size.divideBy(this.options.tileSize); }, _adjustTilePoint: function (tilePoint) { @@ -484,11 +484,11 @@ L.TileLayer = L.Class.extend({ // wrap tile coordinates if (!this.options.continuousWorld && !this.options.noWrap) { - tilePoint.x = ((tilePoint.x % limit) + limit) % limit; + tilePoint.x = ((tilePoint.x % limit.x) + limit.x) % limit.x; } if (this.options.tms) { - tilePoint.y = limit - tilePoint.y - 1; + tilePoint.y = limit.y - tilePoint.y - 1; } tilePoint.z = this._getZoomForUrl();