summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/map/ui.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-04-17 12:27:51 -0400
committerJules Laplace <jules@okfoc.us>2014-04-17 12:27:51 -0400
commitf6424c4756de2045648de0980de14a32b0126df7 (patch)
tree844b690dbe722dad6d8eb2869015abacb563a11b /assets/javascripts/rectangles/map/ui.js
parent309574dec1852238ae899d719f5486f21949a064 (diff)
scale map
Diffstat (limited to 'assets/javascripts/rectangles/map/ui.js')
-rw-r--r--assets/javascripts/rectangles/map/ui.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/assets/javascripts/rectangles/map/ui.js b/assets/javascripts/rectangles/map/ui.js
index cc9a560..9faebea 100644
--- a/assets/javascripts/rectangles/map/ui.js
+++ b/assets/javascripts/rectangles/map/ui.js
@@ -24,8 +24,8 @@ 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.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 )
var intersects = clipper.rooms.filter(function(r){
return r.focused = r.rect.contains(cursor.x.a, cursor.y.a)
@@ -44,14 +44,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 )
- z=true
+ 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) {
- cursor.x.b += map.center.a + map.bounds.a/2
- cursor.y.b += -map.center.b - map.bounds.b/2
+ cursor.x.b = (cursor.x.b / map.zoom) + map.center.a + map.bounds.a/2
+ cursor.y.b = (cursor.y.b / map.zoom) - map.center.b - map.bounds.b/2
if (base.dragging) {
base.dragging.rect.translation.a = cursor.x.magnitude()