Changeset 536 for trunk/london.npemap.org.uk
- Timestamp:
- Apr 30, 2007, 10:31:28 AM (14 years ago)
- Location:
- trunk/london.npemap.org.uk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/london.npemap.org.uk/index.html
r535 r536 51 51 var tile_y_offset = y - (tile_y*24); 52 52 53 // Always seem to be 1 tile too far to the right 53 // Always seem to be 1 tile too far to the right, and 1 too high 54 54 tile_x -= 1; 55 tile_y -= 1; 55 56 56 57 location.href="/tiles.html#"+tile_x+","+tile_y+",1"; -
trunk/london.npemap.org.uk/js/mapTiles.js
r533 r536 73 73 var grid_e = Math.floor(gmc_easting/1000); 74 74 var grid_n = Math.floor(gmc_northing/1000); 75 var offset_e = Math.round(gmc_easting - (grid_e*1000));76 var offset_n = Math.round(gmc_northing - (grid_n*1000));75 var offset_e = trimThreeDigits(Math.round(gmc_easting - (grid_e*1000))); 76 var offset_n = trimThreeDigits(Math.round(gmc_northing - (grid_n*1000))); 77 77 // Need to go from top left, not bottom left 78 78 grid_n = 16 - grid_n; … … 349 349 } 350 350 351 function trimThreeDigits(string) { 352 // If we have a 4+ digit number, no need to do any padding 353 if(parseInt(string) >= 1000) { return string; } 354 355 // Pad it so that it'll always have leading 0s, and be at least 3 long 356 str = '000' + string 357 // Grab the right most 3 digits, which will have any required padding 358 return str.substring(str.length -3) 359 } 351 360 function trimSixDigits(string) { 352 361 // If we have a 7 digit number, no need to do any padding
Note: See TracChangeset
for help on using the changeset viewer.