Changeset 539 for trunk


Ignore:
Timestamp:
Apr 30, 2007, 12:42:17 PM (13 years ago)
Author:
Nick Burch
Message:

Add in overflow stuff

Location:
trunk/london.npemap.org.uk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/london.npemap.org.uk/grid.css

    r533 r539  
    1919        cursor: crosshair;
    2020        background-color: #FFFFFF;
    21   border: 1px solid black;
     21    border: 1px solid black;
     22        overflow: hidden;
    2223}
    2324div.marker {
  • trunk/london.npemap.org.uk/index.html

    r536 r539  
    4646
    4747        // We scaled the image so there are 24 pixes per image
    48         var tile_x = Math.round(x/24);
    49         var tile_y = Math.round(y/24);
     48        var tile_x = Math.floor(x/24);
     49        var tile_y = Math.floor(y/24);
    5050        var tile_x_offset = x - (tile_x*24);
    5151        var tile_y_offset = y - (tile_y*24);
    52 
    53         // Always seem to be 1 tile too far to the right, and 1 too high
    54         tile_x -= 1;
    55         tile_y -= 1;
    5652
    5753        location.href="/tiles.html#"+tile_x+","+tile_y+",1";
  • trunk/london.npemap.org.uk/js/mapTiles.js

    r536 r539  
    257257  var newHeight = YAHOO.util.Dom.getViewportHeight();
    258258  if (screenHeight != newHeight || screenWidth != newWidth) {
    259     screenWidth = YAHOO.util.Dom.getViewportWidth();
     259                screenWidth = YAHOO.util.Dom.getViewportWidth();
    260260                screenHeight = YAHOO.util.Dom.getViewportHeight();
    261261                drawTable();
     
    266266
    267267function drawTable() {
    268   sizeGridX = Math.floor(((screenWidth -210) / tileWidth));
     268  sizeGridX = Math.floor(((screenWidth -210) / tileWidth)) + 1;
    269269  sizeGridY = Math.floor(((screenHeight -130) / tileHeight));
     270
    270271  var map = $('map');
    271272  map.innerHTML = '';
    272   for(var y=sizeGridY; y>=1; y--) {
     273  map.style.width = "" + (screenWidth - 210) + "px";
     274  map.style.height = "" + (screenHeight - 130) + "px";
     275
     276  for(var y=sizeGridY; y>=0; y--) {
     277        var alt_y = sizeGridY - y;
    273278    for(var x=1; x<=sizeGridX; x++) {
    274                         map.appendChild(createIMG(tileWidth, tileHeight, 'element'+x+'.'+y));
     279                        var img = createIMG(tileWidth, tileHeight, 'element'+x+'.'+y);
     280                        img.style.position = "absolute";
     281                        img.style.top = "" + alt_y*tileHeight + "px";
     282                        img.style.left = "" + (x-1)*tileWidth + "px";
     283                        map.appendChild(img);
    275284     }
    276                 map.appendChild(document.createElement('br'));
     285        map.appendChild(document.createElement('br'));
    277286  }
    278287 
    279   $('map').style.width = (sizeGridX * tileWidth) + "px" ;
     288//  $('map').style.width = (sizeGridX * tileWidth) + "px" ;
    280289}
    281290
     
    373382
    374383        for(var x=1; x<=sizeGridX; x++) {
    375                 for(var y=1; y<=sizeGridY; y++) {
     384                for(var y=0; y<=sizeGridY; y++) {
    376385            tileX = x+offsetGridX-Math.round(sizeGridX/2);
    377386            tileY = y+offsetGridY-Math.round(sizeGridY/2);
Note: See TracChangeset for help on using the changeset viewer.