summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/map
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-04-22 03:22:56 -0400
committerJulie Lala <jules@okfoc.us>2014-04-22 03:22:56 -0400
commit62ee4fecc35772670b092b220cb29c7aa7b58b50 (patch)
treeef0dfc47977dc10c30bc6b20377d02e2b88e3891 /assets/javascripts/rectangles/map
parent7d73354432c714fffa47563d0424cc51964238d3 (diff)
keyboard, stones demo
Diffstat (limited to 'assets/javascripts/rectangles/map')
-rw-r--r--assets/javascripts/rectangles/map/_map.js5
-rw-r--r--assets/javascripts/rectangles/map/draw.js2
-rw-r--r--assets/javascripts/rectangles/map/ui.js5
3 files changed, 8 insertions, 4 deletions
diff --git a/assets/javascripts/rectangles/map/_map.js b/assets/javascripts/rectangles/map/_map.js
index 20db8fc..2815b89 100644
--- a/assets/javascripts/rectangles/map/_map.js
+++ b/assets/javascripts/rectangles/map/_map.js
@@ -5,6 +5,7 @@ window.ctx = window.w = window.h = null;
var map = new function(){
var base = this
+ base.el = document.querySelector("#map")
base.dimensions = new vec2(500,500)
base.bounds = new vec2(500,500)
base.center = new vec2(0,0)
@@ -26,5 +27,9 @@ var map = new function(){
base.update = function(){
base.draw.animate()
}
+
+ base.toggle = function(){
+ $(base.el).toggle()
+ }
}
diff --git a/assets/javascripts/rectangles/map/draw.js b/assets/javascripts/rectangles/map/draw.js
index 518c160..cfa99d4 100644
--- a/assets/javascripts/rectangles/map/draw.js
+++ b/assets/javascripts/rectangles/map/draw.js
@@ -8,7 +8,7 @@ map.draw = new function(){
map.draw.clear_canvas()
map.draw.ruler()
- ctx.translate( map.bounds.a * 1/2, map.bounds.b * 1/2)
+ ctx.translate( map.bounds.a * 1/2, map.bounds.b * 1/2)
ctx.scale( map.zoom, map.zoom )
ctx.translate( map.center.a, map.center.b)
ctx.scale( -1, 1 )
diff --git a/assets/javascripts/rectangles/map/ui.js b/assets/javascripts/rectangles/map/ui.js
index 129ec90..10496e3 100644
--- a/assets/javascripts/rectangles/map/ui.js
+++ b/assets/javascripts/rectangles/map/ui.js
@@ -2,12 +2,11 @@
map.ui = new function(){
var base = this
- base.el = document.querySelector("#map")
base.creating = base.dragging = false
base.mouse = new mouse({
- el: base.el,
+ el: map.el,
down: down,
move: move,
drag: drag,
@@ -16,7 +15,7 @@ map.ui = new function(){
})
base.wheel = new wheel({
- el: base.el,
+ el: map.el,
update: mousewheel,
})