static/tiles2.js
branchunscaled-coordinates
changeset 128 66c95c2d212c
parent 127 df89d13f2354
--- a/static/tiles2.js	Sat Apr 10 22:18:41 2010 +0300
+++ b/static/tiles2.js	Sat Apr 10 22:30:00 2010 +0300
@@ -45,8 +45,8 @@
         }
 
         // the (x, y) co-ordinates
-        var x = col * this.tile_width;
-        var y = row * this.tile_height;
+        var x = scaleByZoomDelta(col * this.tile_width, zl);
+        var y = scaleByZoomDelta(row * this.tile_height, zl);
 
         var url = this.path + "?x=" + x + "&y=" + y + "&zl=" + zl; // + "&sw=" + sw + "&sh=" + sh;
         
@@ -63,7 +63,7 @@
 
     // build an URL for a full image
     build_image_url: function (cx, cy, w, h, zl) {
-        return (this.path + "?cx=" + cx + "&cy=" + cy + "&w=" + w + "&h=" + h + "&zl=" + zl);
+        return (this.path + "?cx=" + scaleByZoomDelta(cx, zl) + "&cy=" + scaleByZoomDelta(cy, zl) + "&w=" + w + "&h=" + h + "&zl=" + zl);
     }
 });
 
@@ -562,8 +562,16 @@
      * Update any position-dependant UI elements
      */ 
     update_scroll_ui: function () {
+        var zl = this.zoom_layer.level;
+
         // update the link-to-this-page thing
-        document.location.hash = (this.scroll_x + this.center_offset_x) + ":" + (this.scroll_y + this.center_offset_y) + ":" + this.zoom_layer.level;
+        document.location.hash = (
+                scaleByZoomDelta(this.scroll_x + this.center_offset_x, zl) 
+            +   ":" 
+            +   scaleByZoomDelta(this.scroll_y + this.center_offset_y, zl) 
+            +   ":" 
+            +   zl
+        );
         
         // update link-to-image
         this.update_image_link();