Changeset 24


Ignore:
Timestamp:
Oct 12, 2006, 9:50:03 AM (13 years ago)
Author:
David Sheldon
Message:

resizing now less evil.

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

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/static/tiles/map.html

    r18 r24  
    44        <link rel="stylesheet" type="text/css" href="grid.css">
    55    </head>
    6 <body onload="initializePage(); initialGrid(); go();"  onResize="window.location.href = window.location.href;">
     6<body onload="initializePage(); doResize(); go();"  onResize="doResize() ">
    77<!-- Yahoo functions -->
    88<script src="yahoo.js"></script>
     
    5757
    5858  <div id="map">
    59   <script type="text/javascript">
    60     drawTable()
    61   </script>
    6259  </div>
    6360</div>
  • trunk/npemap.org.uk/static/tiles/mapTiles.js

    r22 r24  
    3434
    3535
    36 if (document.body.clientWidth) {
    37   sizeGridX = Math.round(((document.body.clientWidth) / tileWidth)-2)
    38   sizeGridY = Math.round(((document.body.clientHeight) / tileHeight)-1)
    39  }     
     36
    4037
    4138function zoomOut() {
     
    6764}
    6865
     66
     67// YAHOO.util.Dom.getViewportWidth(),
     68
     69
     70var screenWidth = YAHOO.util.Dom.getViewportWidth();
     71var screenHeight = YAHOO.util.Dom.getViewportHeight();
     72
     73function doResize() {
     74  screenWidth = YAHOO.util.Dom.getViewportWidth();
     75  screenHeight = YAHOO.util.Dom.getViewportHeight();
     76  drawTable();
     77  refreshGrid();
     78}
    6979function drawTable() {
    70         for(var y=sizeGridY; y>=1; y--) {
    71         for(var x=1; x<=sizeGridX; x++) {
    72       document.write('<img width=' + tileWidth + ' height=' + tileHeight + ' id=element' + x + '.' + y + '>')
    73         }
    74         document.write('<br>')
    75         }
     80  sizeGridX = Math.round((screenWidth / tileWidth)-2)
     81  sizeGridY = Math.round((screenHeight / tileHeight)-1)
     82  mapElement = document.getElementById('map');
     83 
     84  page = ''
     85  for(var y=sizeGridY; y>=1; y--) {
     86    for(var x=1; x<=sizeGridX; x++) {
     87      page += '<img width=' + tileWidth + ' height=' + tileHeight + ' id=element' + x + '.' + y + '>';
     88     }
     89     page += '<br>';
     90  }
     91 
     92  mapElement.innerHTML = page
    7693}
    7794
     
    94111
    95112    prefix = prefixes[zoomLevel];
    96 
    97113    document.getElementById('msgCall').innerHTML = 'Ajax Enabled.';
    98114}
     
    100116
    101117function refreshGrid() {
     118 
    102119        for(var x=1; x<=sizeGridX; x++) {
    103120                for(var y=1; y<=sizeGridY; y++) {
     
    110127
    111128        updatePermalink();
    112 }
    113 
    114 function initialGrid() {
    115     document.getElementById('msgCall').innerHTML = 'Function Called: Grid initialization...';
    116     refreshGrid();
    117129}
    118130
Note: See TracChangeset for help on using the changeset viewer.