diff --git a/debug/tests/tile-bounds.html b/debug/tests/tile-bounds.html
new file mode 100644
index 00000000..63727c79
--- /dev/null
+++ b/debug/tests/tile-bounds.html
@@ -0,0 +1,61 @@
+
+
+
+ Leaflet debug page
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The CSS in this page makes the boundaries of the GridLayer tiles visible. Tiles which do not overlap the map bounds shall not be shown, even at fractional zoom levels.
+
+
+
+
+
+
+
+
+
diff --git a/src/layer/tile/GridLayer.js b/src/layer/tile/GridLayer.js
index 5e698647..fca852df 100644
--- a/src/layer/tile/GridLayer.js
+++ b/src/layer/tile/GridLayer.js
@@ -413,15 +413,19 @@ L.GridLayer = L.Layer.extend({
if (!map) { return; }
if (center === undefined) { center = map.getCenter(); }
- if (zoom === undefined) { zoom = Math.round(map.getZoom()); }
+ if (zoom === undefined) { zoom = map.getZoom(); }
+ var tileZoom = Math.round(zoom);
- if (zoom > this.options.maxZoom ||
- zoom < this.options.minZoom) { return; }
+ if (tileZoom > this.options.maxZoom ||
+ tileZoom < this.options.minZoom) { return; }
- var pixelBounds = map.getPixelBounds(center, zoom),
- tileRange = this._pxBoundsToTileRange(pixelBounds),
- tileCenter = tileRange.getCenter(),
- queue = [];
+ var scale = this._map.getZoomScale(zoom, tileZoom),
+ pixelCenter = map.project(center, tileZoom).floor(),
+ halfSize = map.getSize().divideBy(scale * 2),
+ pixelBounds = new L.Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize)),
+ tileRange = this._pxBoundsToTileRange(pixelBounds),
+ tileCenter = tileRange.getCenter(),
+ queue = [];
for (var key in this._tiles) {
this._tiles[key].current = false;
@@ -431,7 +435,7 @@ L.GridLayer = L.Layer.extend({
for (var j = tileRange.min.y; j <= tileRange.max.y; j++) {
for (var i = tileRange.min.x; i <= tileRange.max.x; i++) {
var coords = new L.Point(i, j);
- coords.z = zoom;
+ coords.z = tileZoom;
if (!this._isValidTile(coords)) { continue; }