summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/engine
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-08-26 17:17:50 -0400
committerJules Laplace <jules@okfoc.us>2015-08-26 17:21:10 -0400
commita54c08b70c6072f6c2da48bc209a8b915c993a97 (patch)
tree6bf43fe482737aa0eaa5cae1e88689a253e66be8 /public/assets/javascripts/rectangles/engine
parent8ce3e6347b75a653ed3b7e4e3b2be5f23c841e97 (diff)
set default start position on blueprint
Diffstat (limited to 'public/assets/javascripts/rectangles/engine')
-rw-r--r--public/assets/javascripts/rectangles/engine/map/tools/line.js2
-rw-r--r--public/assets/javascripts/rectangles/engine/map/tools/start.js29
2 files changed, 30 insertions, 1 deletions
diff --git a/public/assets/javascripts/rectangles/engine/map/tools/line.js b/public/assets/javascripts/rectangles/engine/map/tools/line.js
index 8fe4fff..a8e2473 100644
--- a/public/assets/javascripts/rectangles/engine/map/tools/line.js
+++ b/public/assets/javascripts/rectangles/engine/map/tools/line.js
@@ -1,4 +1,4 @@
-// This tool lets you define a very simple line between two points.
+// This tool is used to define a very simple line between two points.
// It is used by the BlueprintScaler to specify a sample distance to scale.
var LineTool = MapTool.extend(function(base){
diff --git a/public/assets/javascripts/rectangles/engine/map/tools/start.js b/public/assets/javascripts/rectangles/engine/map/tools/start.js
new file mode 100644
index 0000000..cca387c
--- /dev/null
+++ b/public/assets/javascripts/rectangles/engine/map/tools/start.js
@@ -0,0 +1,29 @@
+// This tool is used to set the start position on the map.
+
+var StartPositionTool = MapTool.extend(function(base){
+ var exports = {}
+
+ var selected_point = null
+
+ var line = exports.line = []
+
+ var can_drag, dragging
+
+ exports.down = function(e, cursor){
+ // rightclick?
+ if (e.ctrlKey || e.which === 3) {
+ cursor.quantize(1/map.zoom)
+ app.router.blueprintView.map.center.a = cursor.x.a
+ app.router.blueprintView.map.center.b = -cursor.y.a
+ cursor.x.b = cursor.x.a
+ cursor.y.b = cursor.y.a
+ return
+ }
+
+ cam.x = app.controller.startPosition.x = cursor.x.a
+ cam.z = app.controller.startPosition.z = cursor.y.a
+ }
+
+ return exports
+
+})