summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--viewer/MinedMap.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/viewer/MinedMap.js b/viewer/MinedMap.js
index 17a31cb..959e3ed 100644
--- a/viewer/MinedMap.js
+++ b/viewer/MinedMap.js
@@ -1,7 +1,7 @@
var MinedMapLayer = L.GridLayer.extend({
- initialize: function (info) {
- this._info = info.info;
- this._regions = info.regions;
+ initialize: function (info, regions) {
+ this._info = info;
+ this._regions = regions;
this.options.attribution = 'Generated by <a href="http://git.universe-factory.net/MinedMap/">MinedMap</a>';
@@ -68,21 +68,24 @@ var MinedMapLayer = L.GridLayer.extend({
window.createMap = function () {
var xhr = new XMLHttpRequest();
xhr.onload = function () {
- var info = JSON.parse(this.responseText);
+ var res = JSON.parse(this.responseText),
+ info = res.info,
+ regions = res.regions,
+ spawn = res.spawn;
var map = L.map('map', {
- center: [0, 0],
+ center: [-spawn.z, spawn.x],
zoom: 0,
minZoom: 0,
maxZoom: 3,
crs: L.CRS.Simple,
maxBounds: [
- [-512*(info.info.maxZ+1), 512*info.info.minX],
- [-512*info.info.minZ, 512*(info.info.maxX+1)],
+ [-512*(info.maxZ+1), 512*info.minX],
+ [-512*info.minZ, 512*(info.maxX+1)],
],
});
- (new MinedMapLayer(info)).addTo(map);
+ (new MinedMapLayer(info, regions)).addTo(map);
};
xhr.open('GET', 'data/info.json', true);