Changeset 51


Ignore:
Timestamp:
Oct 15, 2006, 10:16:26 PM (13 years ago)
Author:
David Sheldon
Message:

whole load of JS changes. Zooming in by clicking, zooming out all the way to allmaps.

Location:
trunk/npemap.org.uk/static/tiles
Files:
2 edited

Legend:

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

    r49 r51  
    3838function zoomOut() {
    3939        if(zoomLevel == (prefixes.length-1)) {
     40    location.href="allmaps.html";
    4041                return;
    4142        }
     43  removeMarkers();
    4244
    4345        offsetGridX = Math.round(offsetGridX / jumpOut[zoomLevel]);
     
    129131  maxNorthing= minNorthing + sizeGridY;
    130132
    131   drawExisting();
     133  if (zoomLevel == 1) drawExisting();
    132134        updatePermalink();
    133135}
  • trunk/npemap.org.uk/static/tiles/postcode.js

    r50 r51  
    2222                                var baseEasting = tile.substring(0, tile.indexOf("/"));
    2323                                var baseNorthing = tile.substring(tile.indexOf("/") + 1, tile.indexOf("."));
     24        var tileXratio =  tileX/img.offsetWidth;
     25        var tileYratio = 1 -(tileY/img.offsetHeight);
     26        if (zoomLevel != 1) {
     27          // Zoom in.
     28
     29          offsetGridX = Math.round((baseEasting -0 + tileXratio) * jumpIn[zoomLevel]);
     30          offsetGridY = Math.round((baseNorthing -0 + tileYratio) * jumpIn[zoomLevel]);
     31
     32          zoomLevel = zoomLevel - 1;
     33          prefix = prefixes[zoomLevel];
     34          refreshGrid();
     35        } else {
    2436                               
    25                                 var easting = baseEasting + ('000' + Math.round((tileX/img.offsetWidth)*1000)).substr(-3)
    26                                 var northing = baseNorthing + ('000' + Math.round((1-(tileY/img.offsetHeight))*1000)).substr(-3)
     37          var easting = baseEasting + ('000' + Math.round(tileXratio*1000)).substr(-3)
     38          var northing = baseNorthing + ('000' + Math.round(tileYratio*1000)).substr(-3)
    2739
    28                                 YAHOO.util.Dom.setXY(markerElement, [(x-4), (y-11)]);
    29         markerElement.style.visibility = 'visible';
    30        
    31         YAHOO.util.Dom.setXY(postcodeFormElement, [Math.max(0, (x-50)), (y-180) < 0 ? (y+10):(y-180)]);
    32         postcodeFormElement.style.display = 'block';
    33                                 locationElement.innerHTML = easting + ', ' + northing
    34         document.getElementById('easting').value = easting;
    35         document.getElementById('northing').value = northing;
    36         document.getElementById('returnX').value = offsetGridX;
    37         document.getElementById('returnY').value = offsetGridY;
     40          YAHOO.util.Dom.setXY(markerElement, [(x-4), (y-11)]);
     41          markerElement.style.visibility = 'visible';
     42         
     43          YAHOO.util.Dom.setXY(postcodeFormElement, [Math.max(0, (x-50)), (y-180) < 0 ? (y+10):(y-180)]);
     44          postcodeFormElement.style.display = 'block';
     45          locationElement.innerHTML = easting + ', ' + northing
     46          document.getElementById('easting').value = easting;
     47          document.getElementById('northing').value = northing;
     48          document.getElementById('returnX').value = offsetGridX;
     49          document.getElementById('returnY').value = offsetGridY;
    3850
    39         document.getElementById('postcode').value = "";
    40         document.getElementById('postcode').focus();
     51          document.getElementById('postcode').value = "";
     52          document.getElementById('postcode').focus();
     53        }
    4154      }
    4255    }
Note: See TracChangeset for help on using the changeset viewer.