Changeset 192


Ignore:
Timestamp:
Oct 26, 2006, 9:56:28 PM (13 years ago)
Author:
David Sheldon
Message:

Tidy up some code. Remove some unneeded variables.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/static/tiles/mapTiles.js

    r190 r192  
    4949
    5050var mapContainerElement;
    51 var mapElement;
    5251var markerElement;
    5352var postcodeFormElement;
    54 var locationElement;
    5553var mainPageElement;
    5654var spinnerElement;
     
    116114      YAHOO.util.Dom.setXY(postcodeFormElement, [Math.max(0, (x-50)), (y-180) < 0 ? (y+10):(y-180)]);
    117115      fixIE(postcodeFormElement);
    118                         locationElement.innerHTML = easting + ', ' + northing ;
     116                        $('location').innerHTML = easting + ', ' + northing ;
    119117      $('easting').value = easting;
    120118      $('northing').value = northing;
     
    175173  sizeGridX = Math.round((screenWidth / tileWidth)-2)
    176174  sizeGridY = Math.round((screenHeight / tileHeight)-1)
    177   mapElement = $('map');
    178175 
    179176  page = ''
     
    185182  }
    186183 
    187   mapElement.innerHTML = page
     184  $('map').innerHTML = page
    188185}
    189186
     
    198195
    199196function initializePage() {
    200                 mapElement = $('map');
    201197                mapContainerElement = $('map_container');
    202198                markerElement = $('marker');
    203199                postcodeFormElement = $('postcode_form');
    204                 locationElement = $('location');
    205200    mainPageElement = $('main_page');
    206201    spinnerElement = $('spinner');
     
    258253        for(var x=1; x<=sizeGridX; x++) {
    259254                for(var y=1; y<=sizeGridY; y++) {
    260             // Update the table using the array data from position 0,0.
    261             tileX = trimNumber(x+offsetGridX-Math.round(sizeGridX/2));
    262             tileY = trimNumber(y+offsetGridY-Math.round(sizeGridY/2));
     255            tileX = x+offsetGridX-Math.round(sizeGridX/2);
     256            tileY = y+offsetGridY-Math.round(sizeGridY/2);
    263257            $('element' + x + '.' + y).src = tileURL(tileX, tileY);
    264258        }
     
    280274function tileURL(tileX, tileY) {
    281275          var root = (tileX % 2) == 0 ? root1 : root2;
    282                 return root + prefixes[zoomLevel]+tileX+'/'+ tileY + '.jpg';
     276                return root + prefixes[zoomLevel]+trimNumber(tileX)+'/'+ trimNumber(tileY) + '.jpg';
    283277}
    284278
Note: See TracChangeset for help on using the changeset viewer.