summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/assets/javascripts/rectangles/engine/map/tools/line.js2
-rw-r--r--public/assets/javascripts/rectangles/engine/map/tools/start.js29
-rw-r--r--public/assets/javascripts/ui/blueprint/BlueprintNotice.js42
-rw-r--r--public/assets/javascripts/ui/blueprint/BlueprintSettings.js2
-rw-r--r--public/assets/javascripts/ui/blueprint/BlueprintToolbar.js8
-rw-r--r--public/assets/javascripts/ui/blueprint/BlueprintView.js1
-rwxr-xr-xpublic/assets/stylesheets/app.css8
-rw-r--r--views/controls/blueprint/notice.ejs1
-rw-r--r--views/controls/blueprint/settings.ejs7
-rw-r--r--views/controls/blueprint/toolbar.ejs5
-rw-r--r--views/partials/scripts.ejs1
11 files changed, 93 insertions, 13 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
+
+})
diff --git a/public/assets/javascripts/ui/blueprint/BlueprintNotice.js b/public/assets/javascripts/ui/blueprint/BlueprintNotice.js
index bced4e1..4b799a6 100644
--- a/public/assets/javascripts/ui/blueprint/BlueprintNotice.js
+++ b/public/assets/javascripts/ui/blueprint/BlueprintNotice.js
@@ -2,9 +2,14 @@ var BlueprintNotice = View.extend(ToggleableView.prototype).extend({
el: "#blueprintNotice",
+ events: {
+ "click .next": "next",
+ },
+
initialize: function(opt){
this.parent = opt.parent
this.$notice = this.$(".notice")
+ this.$next = this.$(".next")
},
notice: function(msg){
@@ -14,7 +19,44 @@ var BlueprintNotice = View.extend(ToggleableView.prototype).extend({
showCreateProjectNotice: function(){
this.notice("<a href='/project/blueprint/" + this.parent.data.slug +
"'>Start a new project</a> with this blueprint.")
+ this.$next.hide()
+ this.nextFn = null
+ this.show()
+ },
+
+ showStartPositionNotice: function(){
+ this.parent.settings.hide()
+ this.notice("First, click the map to set the starting location.")
+ this.$next.show().html("Next")
+ this.show()
+ this.nextFn = this.showStartAngleNotice.bind(this)
+ },
+
+ showStartAngleNotice: function(){
+ this.parent.settings.hide()
+ this.notice("Next, rotate the camera to the desired orientation.")
+ this.$next.show().html("Done")
this.show()
+ this.nextFn = this.doneSettingPosition.bind(this)
+ this.parent.toolbar.toggleOrbitMode(false)
+ },
+
+ doneSettingPosition: function(){
+ this.nextFn = null
+ this.$next.hide()
+ this.hide()
+ this.parent.settings.show()
+ this.parent.startPosition.rotationX = cam.rotationX
+ this.parent.startPosition.rotationY = cam.rotationY
+ this.parent.toolbar.toggleOrbitMode(true)
+ this.parent.toolbar.orthoPolylineMode()
+ },
+
+ nextFn: null,
+ next: function(){
+ if (this.nextFn) {
+ this.nextFn()
+ }
},
}) \ No newline at end of file
diff --git a/public/assets/javascripts/ui/blueprint/BlueprintSettings.js b/public/assets/javascripts/ui/blueprint/BlueprintSettings.js
index 94672f6..80c9355 100644
--- a/public/assets/javascripts/ui/blueprint/BlueprintSettings.js
+++ b/public/assets/javascripts/ui/blueprint/BlueprintSettings.js
@@ -93,7 +93,7 @@ var BlueprintSettings = FormView.extend(ToggleableView.prototype).extend({
fd.append( "_id", this.$id.val() )
fd.append( "name", this.$name.val() )
fd.append( "shapes", JSON.stringify( shapes.serialize() ) )
- fd.append( "startPosition", JSON.stringify( this.parent.getStartPosition() ) )
+ fd.append( "startPosition", JSON.stringify( this.parent.startPosition ) )
fd.append( "wallHeight", this.parent.info.$height.unitVal() )
fd.append( "units", this.parent.info.$units.val() )
diff --git a/public/assets/javascripts/ui/blueprint/BlueprintToolbar.js b/public/assets/javascripts/ui/blueprint/BlueprintToolbar.js
index bd42374..7721298 100644
--- a/public/assets/javascripts/ui/blueprint/BlueprintToolbar.js
+++ b/public/assets/javascripts/ui/blueprint/BlueprintToolbar.js
@@ -32,8 +32,8 @@ var BlueprintToolbar = View.extend({
this.parent.uploader.show()
},
- toggleOrbitMode: function(){
- this.parent.orbiting = ! this.parent.orbiting
+ toggleOrbitMode: function(state){
+ this.parent.orbiting = typeof state == "boolean" ? state : ! this.parent.orbiting
this.$toggleOrbitMode.toggleClass("inuse", ! this.parent.orbiting)
this.parent.editor.resize()
if (this.parent.orbiting) {
@@ -46,9 +46,9 @@ var BlueprintToolbar = View.extend({
movements.gravity(true)
cam.rotationX = 0
cam.rotationY = -cam.rotationY
- cam.x = 0
+ cam.x = this.parent.startPosition.x
cam.y = viewHeight
- cam.z = 0
+ cam.z = this.parent.startPosition.z
}
},
diff --git a/public/assets/javascripts/ui/blueprint/BlueprintView.js b/public/assets/javascripts/ui/blueprint/BlueprintView.js
index 7819abd..7d839aa 100644
--- a/public/assets/javascripts/ui/blueprint/BlueprintView.js
+++ b/public/assets/javascripts/ui/blueprint/BlueprintView.js
@@ -45,6 +45,7 @@ var BlueprintView = View.extend({
map.ui.add_tool("ortho-polyline", new OrthoPolylineTool)
map.ui.add_tool("eraser", new EraserTool)
map.ui.add_tool("position", new PositionTool)
+ map.ui.add_tool("start-position", new StartPositionTool)
map.ui.placing = false
return map
},
diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css
index 3caa063..5ef8c18 100755
--- a/public/assets/stylesheets/app.css
+++ b/public/assets/stylesheets/app.css
@@ -2358,6 +2358,14 @@ input[type="range"]::-webkit-slider-thumb {
#blueprintNotice a {
border-bottom: 1px solid;
}
+#blueprintNotice .next {
+ display: inline-block;
+ background: black; color: white;
+ padding: 4px;
+ margin: 4px 0 0 0;
+ float: right;
+ cursor: pointer;
+}
#textEditor.settings {
width: 320px;
}
diff --git a/views/controls/blueprint/notice.ejs b/views/controls/blueprint/notice.ejs
index 1be3f6f..bf1a310 100644
--- a/views/controls/blueprint/notice.ejs
+++ b/views/controls/blueprint/notice.ejs
@@ -1,3 +1,4 @@
<div class="vvbox settings" id="blueprintNotice">
<div class="notice"></div>
+ <span class="next">Next</span>
</div>
diff --git a/views/controls/blueprint/settings.ejs b/views/controls/blueprint/settings.ejs
index 1347f5b..9c615ea 100644
--- a/views/controls/blueprint/settings.ejs
+++ b/views/controls/blueprint/settings.ejs
@@ -3,13 +3,6 @@
<input type="hidden" name="_id" value="new">
<div class="setting">
- <a href="#" id="startpoint">
- <span class="ion-ios-navigate-outline"></span>
- <span id="startText">Select Startpoint</span>
- <span id="moveText">Move to Desired Point</span></a>
- </div>
-
- <div class="setting">
<input type="text" name="name" placeholder="Blueprint name">
</div>
diff --git a/views/controls/blueprint/toolbar.ejs b/views/controls/blueprint/toolbar.ejs
index ee9594e..ba795e3 100644
--- a/views/controls/blueprint/toolbar.ejs
+++ b/views/controls/blueprint/toolbar.ejs
@@ -30,6 +30,11 @@
data-info="remove walls"
class="ion-scissors mode"></span>
+ <span
+ data-role="start-position-mode"
+ data-info="set starting position"
+ class="ion-ios-home-outline mode"></span>
+
<span
data-role='toggle-layout-settings'
data-info="save blueprint"
diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs
index ac08216..af7fe96 100644
--- a/views/partials/scripts.ejs
+++ b/views/partials/scripts.ejs
@@ -101,6 +101,7 @@
<script type="text/javascript" src="/assets/javascripts/rectangles/engine/map/tools/ortho.js"></script>
<script type="text/javascript" src="/assets/javascripts/rectangles/engine/map/tools/polyline.js"></script>
<script type="text/javascript" src="/assets/javascripts/rectangles/engine/map/tools/position.js"></script>
+<script type="text/javascript" src="/assets/javascripts/rectangles/engine/map/tools/start.js"></script>
<script type="text/javascript" src="/assets/javascripts/ui/lib/View.js"></script>
<script type="text/javascript" src="/assets/javascripts/ui/lib/Router.js"></script>