summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-04-22 13:12:02 -0400
committerJules Laplace <jules@okfoc.us>2014-04-22 13:12:02 -0400
commitd08f365e4deb3206fd3361c7395268983510d831 (patch)
tree99c4e32a6af0544b573b4f82aa6d2d48c900a524 /assets/javascripts/rectangles
parente44f2ae20b96a6d5692bab56cab7452f6ad3d804 (diff)
wheel zoom
Diffstat (limited to 'assets/javascripts/rectangles')
-rw-r--r--assets/javascripts/rectangles/map/_map.js5
-rw-r--r--assets/javascripts/rectangles/map/ui.js3
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){