partial implementation of unscaled coordinates in URLs, but broken for url hashes and view images
--- a/pngtile/render.py Sat Apr 10 22:18:41 2010 +0300
+++ b/pngtile/render.py Sat Apr 10 22:30:00 2010 +0300
@@ -215,10 +215,6 @@
Render given tile, returning PNG data
"""
- # remap coordinates by zoom
- x = scale_by_zoom(x, zoom)
- y = scale_by_zoom(y, zoom)
-
# do we want to cache this?
if check_cache_threshold(TILE_WIDTH, TILE_HEIGHT, zoom) :
# go via the cache
@@ -233,8 +229,8 @@
Render arbitrary tile, returning PNG data
"""
- x = scale_by_zoom(cx - width / 2, zoom)
- y = scale_by_zoom(cy - height / 2, zoom)
+ x = cx - width / 2
+ y = cy - height / 2
# safely limit
if width * height > MAX_PIXELS :
--- 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();