diff --git a/index.html b/index.html index 5629d892b..649e303af 100755 --- a/index.html +++ b/index.html @@ -83,13 +83,6 @@ require(["dojo/_base/lang","dojo/dom-geometry","dojo/dom-class","dojo/on","dojo/ // ---------------------------------------------------- // Mode button handlers /* - enterWayMode=function() { - controller.setState(new iD.controller.shape.NoSelection()); - }; - - enterEditMode=function() { - }; - finishClicked=function() { controller.stepper.hide(); }; @@ -99,6 +92,7 @@ require(["dojo/_base/lang","dojo/dom-geometry","dojo/dom-class","dojo/on","dojo/ }; */ $('#add-place').click(function() { + controller.setState(new iD.controller.shape.NoSelection()); }); $('#add-road').click(function() { diff --git a/js/iD/controller/shape/NoSelection.js b/js/iD/controller/shape/NoSelection.js index 9f3edbfa5..22da0ad07 100644 --- a/js/iD/controller/shape/NoSelection.js +++ b/js/iD/controller/shape/NoSelection.js @@ -39,16 +39,16 @@ declare("iD.controller.shape.NoSelection", [iD.controller.ControllerState], { this.controller.stepper.show().step(0); }, - processMouseEvent:function(event,entityUI) { - var entity=entityUI ? entityUI.entity : null; - var entityType=entity ? entity.entityType : null; - var map=this.controller.map; + processMouseEvent:function(event, entityUI) { + var entity = entityUI ? entityUI.entity : null; + var entityType = entity ? entity.entityType : null; + var map = this.controller.map; - if (event.type=='click') { + if (event.type === 'click') { switch (entityType) { case 'node': // Click to select a node - var ways=entity.parentWays(); + var ways = entity.parentWays(); if (!ways.length) { return new iD.controller.shape.SelectedPOINode(entity); } // else { return new iD.controller.shape.SelectedWayNode(entity,ways[0]); } // ** FIXME: ^^^ the above should start a new branching way, not select the node diff --git a/js/iD/controller/shape/SelectedWay.js b/js/iD/controller/shape/SelectedWay.js index a064d24d8..ac55500c1 100644 --- a/js/iD/controller/shape/SelectedWay.js +++ b/js/iD/controller/shape/SelectedWay.js @@ -20,28 +20,27 @@ declare("iD.controller.shape.SelectedWay", [iD.controller.ControllerState], { way: null, wayUI: null, - constructor:function(_way) { + constructor: function(way) { // summary: In 'Draw shape' mode, and a way is selected as the starting point of the new way. - this.way=_way; + this.way = way; }, - enterState:function() { - this.wayUI=this.controller.map.getUI(this.way); - this.wayUI.setStateClass('selected'); - this.wayUI.setStateClass('shownodes'); - this.wayUI.redraw(); - this.controller.stepper.setSteps({ - begin: "Click anywhere on the map to start drawing there", - startpoint: "Click the point on the way where you want to start your new way", - draw: "Keep clicking to add each point, and press Enter or double-click when you're done", - tag: "Set the type of the road or shape" - },['begin','startpoint','draw','tag']).highlight('startpoint'); - }, - exitState:function() { - this.wayUI.resetStateClass('selected'); - this.wayUI.resetStateClass('shownodes'); - this.wayUI.redraw(); - }, - + + enterState:function() { + this.wayUI = this.controller.map.getUI(this.way); + this.wayUI.setStateClass('selected') + .setStateClass('shownodes') + .redraw(); + this.controller.stepper.message("Click the point on the way where you want to start your new way"); + return this; + }, + + exitState:function() { + this.wayUI.resetStateClass('selected') + .resetStateClass('shownodes') + .redraw(); + return this; + }, + processMouseEvent:function(event,entityUI) { var entity=entityUI ? entityUI.entity : null; var entityType=entity ? entity.entityType : null; @@ -52,8 +51,8 @@ declare("iD.controller.shape.SelectedWay", [iD.controller.ControllerState], { case null: return new iD.controller.shape.NoSelection(); case 'node': - var ways=entity.parentWays(); - if (entity.hasParent(this.way)) { + var ways = entity.entity.parentWays(); + if (entity.entity.hasParent(this.way)) { // start a branching way from an existing point way = this.getConnection().doCreateWay({}, [entity], lang.hitch(this,this.undoAdder) ); this.controller.map.createUI(way); diff --git a/js/iD/ui/StepPane.js b/js/iD/ui/StepPane.js index eb4841140..ad3553341 100644 --- a/js/iD/ui/StepPane.js +++ b/js/iD/ui/StepPane.js @@ -17,6 +17,15 @@ declare("iD.ui.StepPane", null, { // --------------------------- // Change the highlighted step + message: function(x) { + this.show(); + $('
') + .appendTo('#road-help') + .attr('class', 'manual') + .text(x); + return this; + }, + step: function(x) { // summary: Highlight the step with the specified name, and dim all others. this.show(); @@ -30,6 +39,7 @@ declare("iD.ui.StepPane", null, { // summary: Show the window. $('#road-help').show(); $('#road-help div').hide(); + $('#road-help .manual').remove(); return this; }, hide: function() {