Added a debug option to the config options in template.html. Setting this to true displays a tile boundary overlay as well as x, y, and z values for each tile, and the tile's url. Defaults to false.
This commit is contained in:
@@ -17,7 +17,8 @@
|
|||||||
tileSize: 384,
|
tileSize: 384,
|
||||||
defaultZoom: 1,
|
defaultZoom: 1,
|
||||||
maxZoom: {maxzoom},
|
maxZoom: {maxzoom},
|
||||||
cacheMinutes: {cachelife}
|
cacheMinutes: {cachelife},
|
||||||
|
debug: false
|
||||||
};
|
};
|
||||||
|
|
||||||
var MCMapOptions = {
|
var MCMapOptions = {
|
||||||
@@ -51,19 +52,41 @@
|
|||||||
MCMapType.name = "MC Map";
|
MCMapType.name = "MC Map";
|
||||||
MCMapType.alt = "Minecraft Map";
|
MCMapType.alt = "Minecraft Map";
|
||||||
|
|
||||||
|
function CoordMapType() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function CoordMapType(tileSize) {
|
||||||
|
this.tileSize = tileSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
CoordMapType.prototype.getTile = function(coord, zoom, ownerDocument) {
|
||||||
|
var div = ownerDocument.createElement('DIV');
|
||||||
|
div.innerHTML = "(" + coord.x + ", " + coord.y + ", " + zoom + ")";
|
||||||
|
div.innerHTML += "<br />";
|
||||||
|
div.innerHTML += MCMapOptions.getTileUrl(coord, zoom);
|
||||||
|
div.style.width = this.tileSize.width + 'px';
|
||||||
|
div.style.height = this.tileSize.height + 'px';
|
||||||
|
div.style.fontSize = '10';
|
||||||
|
div.style.borderStyle = 'solid';
|
||||||
|
div.style.borderWidth = '1px';
|
||||||
|
div.style.borderColor = '#AAAAAA';
|
||||||
|
return div;
|
||||||
|
};
|
||||||
|
|
||||||
var map;
|
var map;
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
var mapOptions = {
|
var mapOptions = {
|
||||||
zoom: config.defaultZoom,
|
zoom: config.defaultZoom,
|
||||||
center: new google.maps.LatLng(-45, 90),
|
center: new google.maps.LatLng(-45, 90),
|
||||||
mapTypeControlOptions: {
|
mapTypeId: 'mcmap'
|
||||||
mapTypeIds: ['mcmap'],
|
|
||||||
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
map = new google.maps.Map(document.getElementById("mcmap"), mapOptions);
|
map = new google.maps.Map(document.getElementById("mcmap"), mapOptions);
|
||||||
|
|
||||||
|
if(config.debug) {
|
||||||
|
map.overlayMapTypes.insertAt(0, new CoordMapType(new google.maps.Size(384, 384)));
|
||||||
|
}
|
||||||
|
|
||||||
// Now attach the coordinate map type to the map's registry
|
// Now attach the coordinate map type to the map's registry
|
||||||
map.mapTypes.set('mcmap', MCMapType);
|
map.mapTypes.set('mcmap', MCMapType);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user