diff options
Diffstat (limited to 'public/assets/javascripts/ui')
4 files changed, 48 insertions, 5 deletions
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 }, |
