Skip to content

Commit efc2b51

Browse files
committed
fix: Fix pixelmap parameters for images smaller than tiles
Fix an issue when generating pixelmap parameters for images smaller than tiles. Specifically, if an image was small (say 100 x 100) and claimed to be tiled where the tiles where more than twice the size of the image (say 1024 x 1024), the minimum tile level was not set appropriately for the tile layer, and, if corrected, the url could ask for a negative z level. If negative z levels are ever desired, this would need to change.
1 parent 99b58e3 commit efc2b51

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

src/osmLayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ var osmLayer = function (arg) {
7979
overlap: m_this._options.tileOverlap,
8080
scale: m_this._options.tileScale,
8181
url: m_this._options.url.call(
82-
m_this, urlParams.x, urlParams.y, urlParams.level || 0,
82+
m_this, urlParams.x, urlParams.y, Math.max(urlParams.level || 0, 0),
8383
m_this._options.subdomains),
8484
crossDomain: m_this._options.crossDomain
8585
});

src/pixelmapLayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ var pixelmapLayer = function (arg) {
8181
overlap: m_this._options.tileOverlap,
8282
scale: m_this._options.tileScale,
8383
url: m_this._options.url.call(
84-
m_this, urlParams.x, urlParams.y, urlParams.level || 0,
84+
m_this, urlParams.x, urlParams.y, Math.max(urlParams.level || 0, 0),
8585
m_this._options.subdomains),
8686
crossDomain: m_this._options.crossDomain
8787
});

src/tileLayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ var tileLayer = function (arg) {
601601
size: {x: m_this._options.tileWidth, y: m_this._options.tileHeight},
602602
queue: m_this._queue,
603603
url: m_this._options.url.call(
604-
m_this, urlParams.x, urlParams.y, urlParams.level || 0,
604+
m_this, urlParams.x, urlParams.y, Math.max(urlParams.level || 0, 0),
605605
m_this._options.subdomains)
606606
});
607607
};

src/util/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ var util = {
569569
};
570570
var layerParams = {
571571
maxLevel: maxLevel,
572+
minLevel: Math.min(0, maxLevel),
572573
wrapX: false,
573574
wrapY: false,
574575
tileOffset: function () {

0 commit comments

Comments
 (0)