- Timestamp:
- Oct 23, 2006, 6:36:37 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/npemap.org.uk/static/index.html
r133 r143 54 54 55 55 <script type="text/javascript"> 56 var ROOTURL = "."; 57 56 58 var xOffset = 62; 57 59 … … 81 83 var easting = Math.round(en.easting/1000); 82 84 var northing = Math.round(en.northing/1000); 83 window.location = "tiles/map.html#" + easting + "," + northing + ",1";85 window.location = urlFor(easting, northing, 1); 84 86 } 85 87 else { … … 96 98 var imgPos = YAHOO.util.Dom.getXY(img); 97 99 98 var x = xOffset + YAHOO.util.Event.getPageX(e) - imgPos[0];99 var y = img.height-(YAHOO.util.Event.getPageY(e) - imgPos[1]);100 var x = (xOffset + YAHOO.util.Event.getPageX(e) - imgPos[0]) * 2; 101 var y = (img.height-(YAHOO.util.Event.getPageY(e) - imgPos[1])) * 2; 100 102 101 var s6x = Math.round(x/3); 102 var s6y = Math.round(y/3); 103 104 window.location=("tiles/map.html#" + s6x + "," + s6y + ",3"); 103 window.location=(urlFor(x, y, 1)); 105 104 106 105 YAHOO.util.Event.stopEvent(e); 107 106 } 108 107 109 YAHOO.util.Event.addListener("link", "click", click); 108 YAHOO.util.Event.addListener("link", "click", click); 109 110 var zooms = new Array(1); 111 zooms[1] = 1; 112 zooms[2] = 3; 113 zooms[3] = 6; 114 115 function urlFor(easting, northing, zoom) { 116 var x= easting / zooms[zoom]; 117 var y= northing/ zooms[zoom]; 118 return ROOTURL + "/tiles/map.html#" + x + "," + y +","+zoom; 119 } 110 120 111 121 </script>
Note: See TracChangeset
for help on using the changeset viewer.