Changeset 147


Ignore:
Timestamp:
Oct 23, 2006, 9:14:35 PM (13 years ago)
Author:
David Sheldon
Message:

Woo, markers now really fast.

File:
1 edited

Legend:

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

    r144 r147  
    9494      var northing = trimSixDigits(Math.round((baseNorthing +tileYratio)*1000));
    9595
    96       YAHOO.util.Dom.setXY(markerElement, [(x-4), (y-11)]);
     96      YAHOO.util.Dom.setXY(markerElement, [(x-markerXOffset), (y-markerYOffset)]);
    9797      markerElement.style.visibility = 'visible';
    9898     
     
    263263
    264264function drawExisting() {
    265   bottomLeft = YAHOO.util.Dom.getXY('element1.1');
     265 
    266266  var url = "../../cgi/get-postcodes.fcgi";
    267267  url += "?mineasting=" + minEasting + "000&maxeasting="  + maxEasting + "000&minnorthing=" + minNorthing + "000&maxnorthing=" + maxNorthing+"000";
     
    274274  spinnerElement.className = 'loading';
    275275  spinnerElement.innerHtml = 'Loading...';
     276  findMarkerOffsets();
    276277 
    277278  YAHOO.util.Connect.asyncRequest('GET', url, callback); 
     279
     280}
     281
     282function findMarkerOffsets() {
     283  newMarker = document.createElement('div');
     284  newMarker.style.position = 'absolute';
     285  mainPageElement.appendChild(newMarker);
     286
     287  bottomLeft = YAHOO.util.Dom.getXY('element1.1');
     288  var bottom = bottomLeft[1] + tileHeight;
     289  YAHOO.util.Dom.setXY(newMarker, [bottomLeft[0] - markerXOffset, bottom - markerYOffset]);
     290
     291  markerLeft = parseInt(newMarker.style.left);
     292  markerTop= parseInt(newMarker.style.top);
     293  mainPageElement.removeChild(newMarker);
    278294}
    279295
     
    328344  var x = ((easting / 1000) - minEasting) * tileWidth;
    329345  var y = ((northing / 1000) - minNorthing) * tileHeight;
    330   var bottom = bottomLeft[1] + tileHeight;
    331 
    332   YAHOO.util.Dom.setXY(newMarker, [bottomLeft[0]+x-markerXOffset, bottom- (y+markerYOffset)]);
     346
     347//  YAHOO.util.Dom.setXY(newMarker, [bottomLeft[0]+x-markerXOffset, bottom- (y+markerYOffset)]);
     348  setMarkerXY(newMarker, x, y);
     349}
     350
     351function setMarkerXY(marker, x, y) {
     352  marker.style.left = Math.round(markerLeft + x) ;
     353  marker.style.top = Math.round(markerTop - y);
     354 
    333355}
    334356
Note: See TracChangeset for help on using the changeset viewer.