Info: rename mipmap "info" key to "bounds"

This commit is contained in:
Matthias Schiffer 2021-02-12 23:43:20 +01:00
parent d2802b73f5
commit cbc4a946c6
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
2 changed files with 5 additions and 5 deletions

View file

@ -54,7 +54,7 @@ void Info::writeJSON(const char *filename) const {
std::tie(minX, maxX, minZ, maxZ) = getBounds(level); std::tie(minX, maxX, minZ, maxZ) = getBounds(level);
std::fprintf(f, "{"); std::fprintf(f, "{");
std::fprintf(f, "\"info\":{"); std::fprintf(f, "\"bounds\":{");
std::fprintf(f, "\"minX\":%i,", minX); std::fprintf(f, "\"minX\":%i,", minX);
std::fprintf(f, "\"maxX\":%i,", maxX); std::fprintf(f, "\"maxX\":%i,", maxX);
std::fprintf(f, "\"minZ\":%i,", minZ); std::fprintf(f, "\"minZ\":%i,", minZ);

View file

@ -60,8 +60,8 @@ var MinedMapLayer = L.GridLayer.extend({
var mipmap = this.mipmaps[z]; var mipmap = this.mipmaps[z];
if (coords.x >= mipmap.info.minX && coords.x <= mipmap.info.maxX && if (coords.x >= mipmap.bounds.minX && coords.x <= mipmap.bounds.maxX &&
coords.y >= mipmap.info.minZ && coords.y <= mipmap.info.maxZ && coords.y >= mipmap.bounds.minZ && coords.y <= mipmap.bounds.maxZ &&
contains(mipmap.regions[coords.y] || [], coords.x)) contains(mipmap.regions[coords.y] || [], coords.x))
tile.src = 'data/'+this.layer+'/'+z+'/r.'+coords.x+'.'+coords.y+'.png'; tile.src = 'data/'+this.layer+'/'+z+'/r.'+coords.x+'.'+coords.y+'.png';
@ -190,8 +190,8 @@ window.createMap = function () {
maxZoom: 3, maxZoom: 3,
crs: L.CRS.Simple, crs: L.CRS.Simple,
maxBounds: [ maxBounds: [
[-512*(mipmaps[0].info.maxZ+1), 512*mipmaps[0].info.minX], [-512*(mipmaps[0].bounds.maxZ+1), 512*mipmaps[0].bounds.minX],
[-512*mipmaps[0].info.minZ, 512*(mipmaps[0].info.maxX+1)], [-512*mipmaps[0].bounds.minZ, 512*(mipmaps[0].bounds.maxX+1)],
], ],
}); });