From 5e795dbab647d9d8c4285233e1efc6262d49f720 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 21 Apr 2014 18:44:06 -0400 Subject: coordinate stuff --- assets/javascripts/rectangles/map/ui.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'assets/javascripts/rectangles/map/ui.js') diff --git a/assets/javascripts/rectangles/map/ui.js b/assets/javascripts/rectangles/map/ui.js index f08cae0..f4fc0ef 100644 --- a/assets/javascripts/rectangles/map/ui.js +++ b/assets/javascripts/rectangles/map/ui.js @@ -25,7 +25,7 @@ map.ui = new function(){ function down (e, cursor){ cursor.x.div(map.zoom).add( map.center.a + map.bounds.a/2 ) cursor.y.div(map.zoom).add( -map.center.b - map.bounds.b/2 ) -console.log(cursor+"") + if (e.ctrlKey || e.which === 3) { map.center.a = cursor.x.a + map.bounds.a * map.zoom map.center.b = -cursor.y.a + map.bounds.b * map.zoom @@ -55,8 +55,10 @@ console.log(cursor+"") } function move (e, cursor) { - cursor.x.div(map.zoom).add( map.center.a + map.bounds.a/2 ) - cursor.y.div(map.zoom).add( -map.center.b - map.bounds.b/2 ) + cursor.x.div(w).sub(0.5) + cursor.y.div(h).sub(0.5) +// cursor.x.div(map.zoom).add( map.center.a + map.bounds.a/2 ) +// cursor.y.div(map.zoom).add( -map.center.b - map.bounds.b/2 ) } function drag (e, cursor) { -- cgit v1.2.3-70-g09d2