Fix marker/player world-to-map coordinate transform in hdmap.js
This commit is contained in:
parent
54cb8980d6
commit
6bb2d2a329
1 changed files with 7 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
function HDProjection() {}
|
function HDProjection() {}
|
||||||
HDProjection.prototype = {
|
HDProjection.prototype = {
|
||||||
extrazoom: 0,
|
extrazoom: 0,
|
||||||
|
worldtomap: null,
|
||||||
fromLatLngToPoint: function(latLng) {
|
fromLatLngToPoint: function(latLng) {
|
||||||
return new google.maps.Point(latLng.lng()*config.tileWidth, latLng.lat()*config.tileHeight);
|
return new google.maps.Point(latLng.lng()*config.tileWidth, latLng.lat()*config.tileHeight);
|
||||||
},
|
},
|
||||||
|
|
@ -8,7 +9,11 @@ HDProjection.prototype = {
|
||||||
return new google.maps.LatLng( point.y/config.tileHeight, point.x/config.tileWidth);
|
return new google.maps.LatLng( point.y/config.tileHeight, point.x/config.tileWidth);
|
||||||
},
|
},
|
||||||
fromWorldToLatLng: function(x, y, z) {
|
fromWorldToLatLng: function(x, y, z) {
|
||||||
return new google.maps.LatLng(-z / config.tileWidth / (1 << this.extrazoom), x / config.tileHeight / (1 << this.extrazoom));
|
var wtp = this.worldtomap;
|
||||||
|
var xx = x*wtp[0] + y*wtp[1] + z*wtp[2];
|
||||||
|
var yy = x*wtp[3] + y*wtp[4] + z*wtp[5];
|
||||||
|
|
||||||
|
return new google.maps.LatLng(-yy / config.tileHeight / (1 << this.extrazoom), xx / config.tileWidth / (1 << this.extrazoom));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -69,6 +74,7 @@ HDMapType.prototype = $.extend(new DynMapType(), {
|
||||||
var size;
|
var size;
|
||||||
var extrazoom = this.mapzoomout;
|
var extrazoom = this.mapzoomout;
|
||||||
this.projection.extrazoom = extrazoom;
|
this.projection.extrazoom = extrazoom;
|
||||||
|
this.projection.worldtomap = this.worldtomap;
|
||||||
this.maxZoom = 2 + extrazoom;
|
this.maxZoom = 2 + extrazoom;
|
||||||
if (zoom <= extrazoom) {
|
if (zoom <= extrazoom) {
|
||||||
size = 128;
|
size = 128;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue