static/tiles2.js
branchunscaled-coordinates
changeset 128 66c95c2d212c
parent 127 df89d13f2354
equal deleted inserted replaced
127:df89d13f2354 128:66c95c2d212c
    43             
    43             
    44             subdomain = "tile" + hash + ".";
    44             subdomain = "tile" + hash + ".";
    45         }
    45         }
    46 
    46 
    47         // the (x, y) co-ordinates
    47         // the (x, y) co-ordinates
    48         var x = col * this.tile_width;
    48         var x = scaleByZoomDelta(col * this.tile_width, zl);
    49         var y = row * this.tile_height;
    49         var y = scaleByZoomDelta(row * this.tile_height, zl);
    50 
    50 
    51         var url = this.path + "?x=" + x + "&y=" + y + "&zl=" + zl; // + "&sw=" + sw + "&sh=" + sh;
    51         var url = this.path + "?x=" + x + "&y=" + y + "&zl=" + zl; // + "&sw=" + sw + "&sh=" + sh;
    52         
    52         
    53         // refresh the tile each time it is loaded?
    53         // refresh the tile each time it is loaded?
    54         if (this.refresh)
    54         if (this.refresh)
    61         return url;
    61         return url;
    62     },
    62     },
    63 
    63 
    64     // build an URL for a full image
    64     // build an URL for a full image
    65     build_image_url: function (cx, cy, w, h, zl) {
    65     build_image_url: function (cx, cy, w, h, zl) {
    66         return (this.path + "?cx=" + cx + "&cy=" + cy + "&w=" + w + "&h=" + h + "&zl=" + zl);
    66         return (this.path + "?cx=" + scaleByZoomDelta(cx, zl) + "&cy=" + scaleByZoomDelta(cy, zl) + "&w=" + w + "&h=" + h + "&zl=" + zl);
    67     }
    67     }
    68 });
    68 });
    69 
    69 
    70 /**
    70 /**
    71  * Viewport implements the tiles-UI. It consists of a draggable substrate, which in turn consists of several
    71  * Viewport implements the tiles-UI. It consists of a draggable substrate, which in turn consists of several
   560  
   560  
   561     /**
   561     /**
   562      * Update any position-dependant UI elements
   562      * Update any position-dependant UI elements
   563      */ 
   563      */ 
   564     update_scroll_ui: function () {
   564     update_scroll_ui: function () {
       
   565         var zl = this.zoom_layer.level;
       
   566 
   565         // update the link-to-this-page thing
   567         // update the link-to-this-page thing
   566         document.location.hash = (this.scroll_x + this.center_offset_x) + ":" + (this.scroll_y + this.center_offset_y) + ":" + this.zoom_layer.level;
   568         document.location.hash = (
       
   569                 scaleByZoomDelta(this.scroll_x + this.center_offset_x, zl) 
       
   570             +   ":" 
       
   571             +   scaleByZoomDelta(this.scroll_y + this.center_offset_y, zl) 
       
   572             +   ":" 
       
   573             +   zl
       
   574         );
   567         
   575         
   568         // update link-to-image
   576         // update link-to-image
   569         this.update_image_link();
   577         this.update_image_link();
   570     },
   578     },
   571     
   579