diff options
| author | Julie Lala <jules@okfoc.us> | 2014-04-17 02:53:00 -0400 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-04-17 02:53:00 -0400 |
| commit | 9a87e3a1a61b222097c7991edec5c2c94a6c4cae (patch) | |
| tree | a6c1f47e7645d00ff796d5e9a8f458498d1b7d4e | |
| parent | 892295b1c254c461614145dc67d63e09bf76661d (diff) | |
cursor centered on camera
| -rw-r--r-- | assets/javascripts/rectangles/_env.js | 2 | ||||
| -rw-r--r-- | assets/javascripts/rectangles/map/ui.js | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/assets/javascripts/rectangles/_env.js b/assets/javascripts/rectangles/_env.js index afbf161..dbdaf5c 100644 --- a/assets/javascripts/rectangles/_env.js +++ b/assets/javascripts/rectangles/_env.js @@ -35,6 +35,8 @@ environment.init = function(){ window.scene && scene.update() } environment.update = function(t){ + map.center.a = scene.camera.x + map.center.b = -scene.camera.z map.animate() z = false } diff --git a/assets/javascripts/rectangles/map/ui.js b/assets/javascripts/rectangles/map/ui.js index 8c2b668..0c90388 100644 --- a/assets/javascripts/rectangles/map/ui.js +++ b/assets/javascripts/rectangles/map/ui.js @@ -52,7 +52,7 @@ map.ui = new function(){ function down (e, cursor){ cursor.x.add( map.center.a + map.bounds.a/2 ) - cursor.y.add( map.center.b - map.bounds.b/2 ) + cursor.y.add( -map.center.b - map.bounds.b/2 ) var intersects = clipper.rooms.filter(function(r){ return r.focused = r.rect.contains(cursor.x.a, cursor.y.a) @@ -72,13 +72,13 @@ map.ui = new function(){ function move (e, cursor) { cursor.x.add( map.center.a + map.bounds.a/2 ) - cursor.y.add( map.center.b - map.bounds.b/2 ) + cursor.y.add( -map.center.b - map.bounds.b/2 ) z=true } function drag (e, cursor) { cursor.x.b += map.center.a + map.bounds.a/2 - cursor.y.b += map.center.b - map.bounds.b/2 + cursor.y.b += -map.center.b - map.bounds.b/2 if (base.dragging) { base.dragging.rect.translation.a = cursor.x.magnitude() |
