From a08edc3fa969b12581c5715dd08f594318f69cef Mon Sep 17 00:00:00 2001 From: FrozenCow Date: Mon, 10 Jan 2011 00:31:44 +0100 Subject: [PATCH] Fixed zoomed tile/player not fitting unzoomed. --- src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java | 9 ++++----- src/main/java/org/dynmap/kzedmap/ZoomedTileRenderer.java | 4 ++-- web/map.js | 6 ------ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java b/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java index 23fabb98..2cd42cab 100644 --- a/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java +++ b/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java @@ -7,7 +7,7 @@ import org.dynmap.MapTile; public class KzedZoomedMapTile extends MapTile { @Override public String getName() { - return "z" + originalTile.renderer.getName() + "_" + ztilex(originalTile.px) + "_" + ztiley(originalTile.py); + return "z" + originalTile.renderer.getName() + "_" + getTileX() + "_" + getTileY(); } public BufferedImage unzoomedImage; public KzedMapTile originalTile; @@ -18,14 +18,14 @@ public class KzedZoomedMapTile extends MapTile { } public int getTileX() { - return ztilex(originalTile.px); + return ztilex(originalTile.px+KzedMap.tileWidth); } public int getTileY() { return ztiley(originalTile.py); } - static int ztilex(int x) { + private static int ztilex(int x) { if(x < 0) return x + (x % (KzedMap.tileWidth*2)); else @@ -33,11 +33,10 @@ public class KzedZoomedMapTile extends MapTile { } /* zoomed-out tile Y for tile position y */ - static int ztiley(int y) + private static int ztiley(int y) { if(y < 0) return y + (y % (KzedMap.tileHeight*2)); - //return y - (zTileHeight + (y % zTileHeight)); else return y - (y % (KzedMap.tileHeight*2)); } diff --git a/src/main/java/org/dynmap/kzedmap/ZoomedTileRenderer.java b/src/main/java/org/dynmap/kzedmap/ZoomedTileRenderer.java index 14d34421..5f806480 100644 --- a/src/main/java/org/dynmap/kzedmap/ZoomedTileRenderer.java +++ b/src/main/java/org/dynmap/kzedmap/ZoomedTileRenderer.java @@ -48,10 +48,10 @@ public class ZoomedTileRenderer { int sch = KzedMap.tileHeight / 2; /* origin in zoomed-out tile */ - int ox = scw; + int ox = 0; int oy = 0; - if(zpx != px) ox = 0; + if(zpx != px) ox = scw; if(zpy != py) oy = sch; /* blit scaled rendered tile onto zoom-out tile */ diff --git a/web/map.js b/web/map.js index 493b3d4e..4892618f 100644 --- a/web/map.js +++ b/web/map.js @@ -69,16 +69,11 @@ function makeRequest(url, func, type, fail, post, contenttype) var x = (latLng.lng() * config.tileWidth)|0; var y = (latLng.lat() * config.tileHeight)|0; - if(map.zoom == 0) { - x += config.tileWidth / 2; - } return new google.maps.Point(x, y); }; MCMapProjection.prototype.fromPointToLatLng = function(point) { var x = point.x; - if(map.zoom == 0) - x -= config.tileWidth / 2; var lng = x / config.tileWidth; var lat = point.y / config.tileHeight; return new google.maps.LatLng(lat, lng); @@ -269,7 +264,6 @@ function makeRequest(url, func, type, fail, post, contenttype) function mapUpdate() { - console.log('requesting ' + config.updateUrl + lasttimestamp); makeRequest(config.updateUrl + lasttimestamp, function(res) { var typeVisibleMap = { 'warp': document.getElementById('showWarps').checked,