# HG changeset patch # User Tero Marttila # Date 1262790444 -7200 # Node ID eeedb6c2f7c03eaa37c844041c251a73e2437908 # Parent 0abb7289d4b89ed4a4ae61a943d76d5e9aefd302 zoom button UI diff -r 0abb7289d4b8 -r eeedb6c2f7c0 pngtile/wsgi.py --- a/pngtile/wsgi.py Wed Jan 06 16:45:33 2010 +0200 +++ b/pngtile/wsgi.py Wed Jan 06 17:07:24 2010 +0200 @@ -61,6 +61,11 @@
+
+ + +
+
diff -r 0abb7289d4b8 -r eeedb6c2f7c0 static/style.css --- a/static/style.css Wed Jan 06 16:45:33 2010 +0200 +++ b/static/style.css Wed Jan 06 17:07:24 2010 +0200 @@ -18,13 +18,23 @@ background-color: #E5E3DF; } -#substrate { - position: absolute; - top: 0px; left: 0px; -} - #viewport img { position: absolute; border: none; } +/** XXX: doesn't apply? * / +#substrate { + position: absolute; + top: 0px; left: 0px; +} */ + + +.overlay { + position: absolute; + + padding: 15px; + + z-index: 1000; +} + diff -r 0abb7289d4b8 -r eeedb6c2f7c0 static/tiles2.js --- a/static/tiles2.js Wed Jan 06 16:45:33 2010 +0200 +++ b/static/tiles2.js Wed Jan 06 17:07:24 2010 +0200 @@ -70,6 +70,16 @@ Event.observe(this.substrate, "mousewheel", this.on_mousewheel.bindAsEventListener(this)); Event.observe(this.substrate, "DOMMouseScroll", this.on_mousewheel.bindAsEventListener(this)); // mozilla Event.observe(document, "resize", this.on_resize.bindAsEventListener(this)); + + // zoom buttons + this.btn_zoom_in = $("btn-zoom-in"); + this.btn_zoom_out = $("btn-zoom-out"); + + if (this.btn_zoom_in) + Event.observe(this.btn_zoom_in, "click", this.zoom_in.bindAsEventListener(this)); + + if (this.btn_zoom_out) + Event.observe(this.btn_zoom_out, "click", this.zoom_out.bindAsEventListener(this)); // set viewport size this.update_size(); @@ -244,6 +254,24 @@ ); }, + // zoom à la delta, keeping the view centered + zoom_centered: function (delta) { + return this.zoom_center_to( + this.scroll_x + this.center_offset_x, + this.scroll_y + this.center_offset_y, + delta + ); + }, + + // zoom in one level, keeping the view centered + zoom_in: function () { + return this.zoom_centered(+1); + }, + + // zoom out one leve, keeping the view centered + zoom_out: function () { + return this.zoom_centered(-1); + }, /* update view/state to reflect reality */ @@ -313,8 +341,20 @@ this.zoom_timer = setTimeout(function () { zoom_old.disable()}, 1000); } + // update UI + this.update_zoom_ui(); + return true; }, + + // keep the zoom buttons, if any, updated + update_zoom_ui: function () { + if (this.btn_zoom_in) + (this.zoom_layer.level >= this.source.zoom_max) ? this.btn_zoom_in.disable() : this.btn_zoom_in.enable(); + + if (this.btn_zoom_out) + (this.zoom_layer.level <= this.source.zoom_min) ? this.btn_zoom_out.disable() : this.btn_zoom_out.enable(); + }, // ensure that all tiles that are currently visible are loaded update_tiles: function() {