summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/engine/map/tools/position.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-10-28 18:07:56 -0400
committerJules Laplace <jules@okfoc.us>2016-10-28 18:07:56 -0400
commita9c9d6adf470d0966e6c6bef0803e298fd2d4117 (patch)
tree6ccec2a448992a5f43226532051a6df09afbc203 /public/assets/javascripts/rectangles/engine/map/tools/position.js
parent343b0b3dc5bb7dbe762182a486e63a4aff6ef8fc (diff)
parent9e7bacd46c1e5d0e1c24433690d421ab3f3a11f2 (diff)
merge
Diffstat (limited to 'public/assets/javascripts/rectangles/engine/map/tools/position.js')
-rw-r--r--public/assets/javascripts/rectangles/engine/map/tools/position.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/engine/map/tools/position.js b/public/assets/javascripts/rectangles/engine/map/tools/position.js
new file mode 100644
index 0000000..f8365bc
--- /dev/null
+++ b/public/assets/javascripts/rectangles/engine/map/tools/position.js
@@ -0,0 +1,19 @@
+// Tool used to set position on the map and let you change the view by dragging.
+
+var PositionTool = MapTool.extend(function(base){
+ var exports = {
+ recenterCursor: false,
+ drag: function(e, cursor){
+ map.center.a = -cursor.x.magnitude()
+ map.center.b = cursor.y.magnitude()
+ },
+ rightclick: function(e, cursor){
+ cursor.quantize(1/map.zoom)
+ map.center.a = cursor.x.a
+ map.center.b = -cursor.y.a
+ cursor.x.b = cursor.x.a
+ cursor.y.b = cursor.y.a
+ }
+ }
+ return exports
+}) \ No newline at end of file