From b7f6a5a39ded4f1c2e0128f18c29b50a767f1daa Mon Sep 17 00:00:00 2001 From: FrozenCow Date: Wed, 23 Feb 2011 12:40:05 +0100 Subject: [PATCH 1/2] Applied style-change of lechd. --- web/dynmap_style.css | 2 -- 1 file changed, 2 deletions(-) diff --git a/web/dynmap_style.css b/web/dynmap_style.css index 13b31249..78344522 100644 --- a/web/dynmap_style.css +++ b/web/dynmap_style.css @@ -122,8 +122,6 @@ body { .alertbox, .largeclock { - background: rgba(0,0,0,0.6); - border-style: solid; border-width: 0px 1px 1px 1px; From 1d2cce6caabd0ff3fa991145f16f43bbcc2f2a77 Mon Sep 17 00:00:00 2001 From: FrozenCow Date: Wed, 23 Feb 2011 14:06:13 +0100 Subject: [PATCH 2/2] Simplified tile-mechanism again (a bit like hMod's version). --- web/kzedmaps.js | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/web/kzedmaps.js b/web/kzedmaps.js index 5d1bf3f5..3814ad5b 100644 --- a/web/kzedmaps.js +++ b/web/kzedmaps.js @@ -55,34 +55,18 @@ KzedMapType.prototype = $.extend(new DynMapType(), { tileSize = 128; // Helper functions. - var floor = Math.floor; + /*var floor = Math.floor; var div = function(x,y){return floor(x/y);} - var mod = function(x,y){return ((x%y)+y)%y;}; + var mod = function(x,y){return ((x%y)+y)%y;};*/ - // Split the image up in ... segments (1*1 for zoom 1, 2*2 for zoom 2, 4*4 for zoom 3, etc). - var segments = Math.pow(2,zoom-1); - imgSize = segments*tileSize; - - // Calculate the location relative to the world of this segment. - var mapcoord = {x: div(coord.x,segments)*tileSize, y: div(coord.y,segments)*tileSize}; - // Calculate the location relative to the image of this segment. - offset = {x: mod(coord.x,segments)*-tileSize, y: mod(coord.y,segments)*-tileSize}; - - // The next couple of lines are somewhat of a hack, but makes it faster to render zoomed in tiles: - tileSize = imgSize; - - if (offset.x == 0 && offset.y == 0) { - tileName = this.prefix + '_' + (-mapcoord.x) + '_' + mapcoord.y + '.png'; - } - offset = {x: 0, y: 0}; - // The next line is not: - //tileName = this.prefix + '_' + (-mapcoord.x) + '_' + mapcoord.y; + imgSize = Math.pow(2, 6+zoom); + var mapcoord = {x: coord.x*tileSize, y: coord.y*tileSize}; + tileName = this.prefix + '_' + (-mapcoord.x) + '_' + mapcoord.y + '.png'; } var img; var tile = $('
') .addClass('tile') .css({ - overflow: 'hidden', width: tileSize + 'px', height: tileSize + 'px' }); @@ -99,13 +83,15 @@ KzedMapType.prototype = $.extend(new DynMapType(), { img = $('') .attr('src', this.dynmap.getTileUrl(tileName)) .error(function() { img.hide(); }) + .bind('load', function() { img.show(); }) .css({ width: imgSize + 'px', height: imgSize + 'px', borderStyle: 'none', - marginLeft: offset.x + 'px', - marginTop: offset.y + 'px' + /*marginLeft: offset.x + 'px', + marginTop: offset.y + 'px'*/ }) + .hide() .appendTo(tile); this.dynmap.registerTile(this, tileName, img); } else { @@ -114,7 +100,13 @@ KzedMapType.prototype = $.extend(new DynMapType(), { return tile.get(0); }, updateTileSize: function(zoom) { - //this.tileSize = new google.maps.Size(config.zoomSize[zoom], config.zoomSize[zoom]); + var size; + if (zoom == 0) { + size = 128; + } else { + size = Math.pow(2, 6+zoom); + } + this.tileSize = new google.maps.Size(size, size); } });