Fixed zoomed tile/player not fitting unzoomed.

This commit is contained in:
FrozenCow 2011-01-10 00:31:44 +01:00
parent 2b2891bd0a
commit a08edc3fa9
3 changed files with 6 additions and 13 deletions

View File

@ -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));
}

View File

@ -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 */

View File

@ -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,