dynmap/web/js/flatmap.js

29 lines
899 B
JavaScript

var FlatProjection = DynmapProjection.extend({
fromLocationToLatLng: function(location) {
return new L.LatLng(
-location.z / (1 << this.options.mapzoomout),
location.x / (1 << this.options.mapzoomout),
true);
}
});
var FlatMapType = DynmapTileLayer.extend({
options: {
minZoom: 0,
maxZoom: 4,
errorTileUrl: 'images/blank.png'
},
initialize: function(options) {
options.maxZoom = options.mapzoomin + options.mapzoomout;
L.Util.setOptions(this, options);
this.projection = new FlatProjection({mapzoomout: options.mapzoomout});
},
getTileName: function(tilePoint, zoom) {
return namedReplace(this.options.bigmap
? '{prefix}{nightday}_128/{scaledx}_{scaledy}/{zoomprefix}{x}_{y}.png'
: '{zoom}{prefix}{nightday}_128_{x}_{y}.png'
, this.getTileInfo(tilePoint, zoom));
}
});
maptypes.FlatMapType = function(options) { return new FlatMapType(options); };