diff options
| -rw-r--r-- | assets/javascripts/rectangles/map/_map.js | 5 | ||||
| -rw-r--r-- | assets/javascripts/rectangles/map/ui.js | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/assets/javascripts/rectangles/map/_map.js b/assets/javascripts/rectangles/map/_map.js index 72901a1..e612c98 100644 --- a/assets/javascripts/rectangles/map/_map.js +++ b/assets/javascripts/rectangles/map/_map.js @@ -17,6 +17,11 @@ var map = new function(){ } base.zoom = 1/8 + base.zoom_exponent = -3 + base.set_zoom = function (n) { + base.zoom_exponent = n + base.zoom = pow(2, base.zoom_exponent) + } var canvas = document.createElement("canvas") var ctx = window.ctx = canvas.getContext("2d") diff --git a/assets/javascripts/rectangles/map/ui.js b/assets/javascripts/rectangles/map/ui.js index e7d2cf7..4e03125 100644 --- a/assets/javascripts/rectangles/map/ui.js +++ b/assets/javascripts/rectangles/map/ui.js @@ -99,6 +99,9 @@ map.ui = new function(){ intersects[0].height = clamp( ~~(intersects[0].height - delta), 200, 800 ) clipper.update() } + else { + map.set_zoom(map.zoom_exponent - delta/20) + } } function rightclick (e){ |
