Use tilegrid extent as default attributionExtent

Test attributions
This commit is contained in:
mike-000
2020-12-21 22:52:46 +00:00
parent cce7ecec49
commit 13e1ae9574
3 changed files with 87 additions and 35 deletions

View File

@@ -171,10 +171,11 @@ class TileJSON extends TileImage {
extent = applyTransform(tileJSON['bounds'], transform);
}
const gridExtent = extentFromProjection(sourceProjection);
const minZoom = tileJSON['minzoom'] || 0;
const maxZoom = tileJSON['maxzoom'] || 22;
const tileGrid = createXYZ({
extent: extentFromProjection(sourceProjection),
extent: gridExtent,
maxZoom: maxZoom,
minZoom: minZoom,
tileSize: this.tileSize_,
@@ -184,9 +185,7 @@ class TileJSON extends TileImage {
this.tileUrlFunction = createFromTemplates(tileJSON['tiles'], tileGrid);
if (tileJSON['attribution'] !== undefined && !this.getAttributions()) {
const attributionExtent =
extent !== undefined ? extent : epsg4326Projection.getExtent();
const attributionExtent = extent !== undefined ? extent : gridExtent;
this.setAttributions(function (frameState) {
if (intersects(attributionExtent, frameState.extent)) {
return [tileJSON['attribution']];