Skip to content

Commit

Permalink
fix: Fix pixelmap parameters for images smaller than tiles
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
manthey committed Jan 3, 2025
1 parent 99b58e3 commit efc2b51
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/osmLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var osmLayer = function (arg) {
overlap: m_this._options.tileOverlap,
scale: m_this._options.tileScale,
url: m_this._options.url.call(
m_this, urlParams.x, urlParams.y, urlParams.level || 0,
m_this, urlParams.x, urlParams.y, Math.max(urlParams.level || 0, 0),
m_this._options.subdomains),
crossDomain: m_this._options.crossDomain
});
Expand Down
2 changes: 1 addition & 1 deletion src/pixelmapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var pixelmapLayer = function (arg) {
overlap: m_this._options.tileOverlap,
scale: m_this._options.tileScale,
url: m_this._options.url.call(
m_this, urlParams.x, urlParams.y, urlParams.level || 0,
m_this, urlParams.x, urlParams.y, Math.max(urlParams.level || 0, 0),
m_this._options.subdomains),
crossDomain: m_this._options.crossDomain
});
Expand Down
2 changes: 1 addition & 1 deletion src/tileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ var tileLayer = function (arg) {
size: {x: m_this._options.tileWidth, y: m_this._options.tileHeight},
queue: m_this._queue,
url: m_this._options.url.call(
m_this, urlParams.x, urlParams.y, urlParams.level || 0,
m_this, urlParams.x, urlParams.y, Math.max(urlParams.level || 0, 0),
m_this._options.subdomains)
});
};
Expand Down
1 change: 1 addition & 0 deletions src/util/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ var util = {
};
var layerParams = {
maxLevel: maxLevel,
minLevel: Math.min(0, maxLevel),
wrapX: false,
wrapY: false,
tileOffset: function () {
Expand Down

0 comments on commit efc2b51

Please sign in to comment.