Finish zoom out on normal and 'bigworld' mode, fix marker coordinates

This commit is contained in:
Mike Primm 2011-06-23 00:53:56 -05:00
parent 9db23444db
commit f722c6fdc8
7 changed files with 97 additions and 55 deletions

View file

@ -1,5 +1,6 @@
function FlatProjection() {}
FlatProjection.prototype = {
extrazoom: 0,
fromLatLngToPoint: function(latLng) {
return new google.maps.Point(latLng.lat()*config.tileWidth, latLng.lng()*config.tileHeight);
},
@ -7,7 +8,7 @@ FlatProjection.prototype = {
return new google.maps.LatLng(point.x/config.tileWidth, point.y/config.tileHeight);
},
fromWorldToLatLng: function(x, y, z) {
return new google.maps.LatLng(-z / config.tileWidth, x / config.tileHeight);
return new google.maps.LatLng(-z / config.tileWidth / (1 << this.extrazoom), x / config.tileHeight / (1 << this.extrazoom));
}
};
@ -71,6 +72,7 @@ FlatMapType.prototype = $.extend(new DynMapType(), {
updateTileSize: function(zoom) {
var size;
var extrazoom = this.dynmap.world.extrazoomout;
this.projection.extrazoom = extrazoom;
this.maxZoom = 3 + extrazoom;
if (zoom <= extrazoom) {
size = 128;

View file

@ -1,5 +1,6 @@
function KzedProjection() {}
KzedProjection.prototype = {
extrazoom: 0,
fromLatLngToPoint: function(latLng) {
var x = latLng.lng() * config.tileWidth;
var y = latLng.lat() * config.tileHeight;
@ -18,9 +19,10 @@ KzedProjection.prototype = {
var dz = +z;
var px = dx + dz;
var py = dx - dz - dy;
var scale = 2 << this.extrazoom;
var lng = -px / config.tileWidth / 2 + 0.5;
var lat = py / config.tileHeight / 2;
var lng = -px / config.tileWidth / scale + (1.0 / scale);
var lat = py / config.tileHeight / scale;
return new google.maps.LatLng(lat, lng);
}
@ -112,6 +114,7 @@ KzedMapType.prototype = $.extend(new DynMapType(), {
updateTileSize: function(zoom) {
var size;
var extrazoom = this.dynmap.world.extrazoomout;
this.projection.extrazoom = extrazoom;
this.maxZoom = 3 + extrazoom;
if (zoom <= extrazoom) {
size = 128;