Gracefully handle missing tile service bounds in map preview

This commit is contained in:
Nikolay Korotkiy 2019-11-18 20:28:28 +03:00
parent 10eb6193b7
commit 65d73d5600
No known key found for this signature in database
GPG Key ID: D1DE6D7F693663A5

View File

@ -84,10 +84,13 @@
var layer = null;
d3.json('./', function(tileJSON) {
var b = tileJSON.bounds;
if (tileJSON.bounds) {
var b = tileJSON.bounds;
// TODO: optimize and prevent jitter
map.fitBounds([[b[1], b[0]], [b[3], b[2]]]);
}
// TODO: optimize and prevent jitter
map.fitBounds([[b[1], b[0]], [b[3], b[2]]]);
if (tileJSON.maxzoom && tileJSON.maxzoom < map.getZoom()){
map.setZoom(tileJSON.maxzoom);
}