changeset 228:2be6060df6cc gmap2

Use global offsets.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 15 Mar 2014 15:14:21 +0200
parents 7c1cd542b2d2
children ccd79b97dc52
files map.js
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/map.js	Sat Mar 15 15:14:14 2014 +0200
+++ b/map.js	Sat Mar 15 15:14:21 2014 +0200
@@ -115,6 +115,7 @@
 //
 function pmapCoordinateListener(point)
 {
+  // Round the coordinates so that we hit the pointed square more accurately
   var p = pmapLatLngToMapCoords(point.latLng, 7);
   var tx = Math.round((p.x + 1) / 2.0);
   var ty = Math.round((p.y + 1) / 2.0);
@@ -134,8 +135,8 @@
     }
   }
 
-  tx += 8192;
-  ty += 8192;
+  tx += pmapWorld.ox;
+  ty += pmapWorld.oy;
 
   var str = "Cursor: "+
     "Global X: <span class=\"coord\">"+ tx +"</span>, Y: <span class=\"coord\">"+ ty +"</span>, "+
@@ -153,8 +154,8 @@
   if (pmap)
   {
     var p = pmapLatLngToMapCoords(pmap.getCenter(), 6);
-    var tx = Math.round(p.x) + 8192;
-    var ty = Math.round(p.y) + 8192;
+    var tx = Math.round(p.x) + pmapWorld.ox;
+    var ty = Math.round(p.y) + pmapWorld.oy;
     
     str = "http://tnsp.org/gmap2/?x="+ tx +"&y="+ ty +"&zoom="+ pmap.getZoom();