diff options
-rw-r--r-- | viewer/MinedMap.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/viewer/MinedMap.js b/viewer/MinedMap.js index ad330b2..c8a41df 100644 --- a/viewer/MinedMap.js +++ b/viewer/MinedMap.js @@ -1,7 +1,8 @@ var MinedMapLayer = L.GridLayer.extend({ - initialize: function (info, regions) { + initialize: function (info, regions, layer) { this._info = info; this._regions = regions; + this._layer = layer; this.options.attribution = 'Generated by <a href="http://git.universe-factory.net/MinedMap/">MinedMap</a>'; @@ -21,7 +22,7 @@ var MinedMapLayer = L.GridLayer.extend({ if (coords.x >= this._info.minX && coords.x <= this._info.maxX && coords.y >= this._info.minZ && coords.y <= this._info.maxZ && this._regions[coords.y-this._info.minZ][coords.x-this._info.minX]) - tile.src = 'data/map/0/r.'+coords.x+'.'+coords.y+'.png'; + tile.src = 'data/'+this._layer+'/0/r.'+coords.x+'.'+coords.y+'.png'; return tile; }, @@ -85,7 +86,16 @@ window.createMap = function () { ], }); - (new MinedMapLayer(info, regions)).addTo(map); + var mapLayer = new MinedMapLayer(info, regions, 'map'); + var lightLayer = new MinedMapLayer(info, regions, 'light'); + + mapLayer.addTo(map); + + var overlayMaps = { + "Illumination": lightLayer, + }; + + L.control.layers({}, overlayMaps).addTo(map); }; xhr.open('GET', 'data/info.json', true); |