summaryrefslogtreecommitdiffstats
path: root/viewer
diff options
context:
space:
mode:
Diffstat (limited to 'viewer')
-rw-r--r--viewer/MinedMap.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/viewer/MinedMap.js b/viewer/MinedMap.js
index a949cce..f6be634 100644
--- a/viewer/MinedMap.js
+++ b/viewer/MinedMap.js
@@ -1,7 +1,9 @@
var MinedMapLayer = L.GridLayer.extend({
initialize: function (mipmaps, layer) {
- this._mipmaps = mipmaps;
- this._layer = layer;
+ this.mipmaps = mipmaps;
+ this.layer = layer;
+
+ this.zoomOffset = L.Browser.retina ? 1 : 0;
this.options.attribution = 'Generated by <a href="http://git.universe-factory.net/MinedMap/">MinedMap</a>';
@@ -18,16 +20,16 @@ var MinedMapLayer = L.GridLayer.extend({
tile.alt = '';
- var z = -coords.z;
+ var z = -(coords.z + this.zoomOffset);
if (z < 0)
z = 0;
- var mipmap = this._mipmaps[z];
+ var mipmap = this.mipmaps[z];
if (coords.x >= mipmap.info.minX && coords.x <= mipmap.info.maxX &&
coords.y >= mipmap.info.minZ && coords.y <= mipmap.info.maxZ &&
mipmap.regions[coords.y-mipmap.info.minZ][coords.x-mipmap.info.minX])
- tile.src = 'data/'+this._layer+'/'+z+'/r.'+coords.x+'.'+coords.y+'.png';
+ tile.src = 'data/'+this.layer+'/'+z+'/r.'+coords.x+'.'+coords.y+'.png';
if (coords.z >= 0)
L.DomUtil.addClass(tile, 'overzoomed');
@@ -44,12 +46,14 @@ var MinedMapLayer = L.GridLayer.extend({
},
_getTileSize: function () {
- var map = this._map, zoom = map.getZoom();
+ var map = this._map, zoom = map.getZoom() + this.zoomOffset;
+
+ var base = (L.Browser.retina ? 256 : 512);
if (zoom > 0)
- return Math.round(map.getZoomScale(map.getZoom(), 0) * 512);
+ return Math.round(map.getZoomScale(zoom, 0) * base);
else
- return 512;
+ return base;
},
_onTileRemove: function (e) {