diff --git a/js/iD/Connection.js b/js/iD/Connection.js index afc13025b..8d0b149d3 100755 --- a/js/iD/Connection.js +++ b/js/iD/Connection.js @@ -273,7 +273,7 @@ declare("iD.Connection", null, { return members; } - }, + } }); diff --git a/js/iD/Controller.js b/js/iD/Controller.js index 0207b4145..acce74d6d 100755 --- a/js/iD/Controller.js +++ b/js/iD/Controller.js @@ -25,7 +25,7 @@ declare("iD.Controller", null, { setState:function(newState) { // summary: Enter a new ControllerState, firing exitState on the old one, and enterState on the new one. if (newState==this.state) { return; } - if (this.state) { + if (this.state) { this.state.exitState(newState); on.emit(window, "exitState", { bubbles: true, cancelable: true, state: this.state.stateNameAsArray() }); } @@ -40,7 +40,7 @@ declare("iD.Controller", null, { if (!this.state) { return; } var newState=this.state.processMouseEvent(event,entityUI); this.setState(newState); - }, + } }); diff --git a/js/iD/Entity.js b/js/iD/Entity.js index c0d60151a..13983bbb0 100755 --- a/js/iD/Entity.js +++ b/js/iD/Entity.js @@ -95,16 +95,16 @@ declare("iD.Entity", null, { // summary: Rough-and-ready function to return a human-friendly name // for the object. Really just a placeholder for something better. // returns: A string such as 'river' or 'Fred's House'. - if (this.numTags()==0) { return ''; } + if (this.numTags()===0) { return ''; } var n=[]; - if (this.tags['name']) { n.push(this.tags['name']); } - if (this.tags['ref']) { n.push(this.tags['ref']); } - if (n.length==0) { + if (this.tags.name) { n.push(this.tags.name); } + if (this.tags.ref) { n.push(this.tags.ref); } + if (n.length===0) { for (var i=0; i"; - this.editortooltip = new dijit.TooltipDialog({ - content: h+" " - +" ", - autoFocus: false + var h=entity.friendlyName(); + if (h !== '') h = h + "
"; + this.editortooltip = new dijit.TooltipDialog({ + content: h+" " + + " ", + autoFocus: false }); dijit.popup.open({ popup: this.editortooltip, x: x, y: y }); }, @@ -31,7 +32,7 @@ declare("iD.controller.edit.EditBaseState", [iD.controller.ControllerState], { closeEditorTooltip:function() { // summary: Close the tooltip. if (this.editortooltip) { dijit.popup.close(this.editortooltip); } - }, + } }); diff --git a/js/iD/controller/edit/NoSelection.js b/js/iD/controller/edit/NoSelection.js index af583cb86..cbc16e325 100755 --- a/js/iD/controller/edit/NoSelection.js +++ b/js/iD/controller/edit/NoSelection.js @@ -4,7 +4,7 @@ define(['dojo/_base/declare', 'iD/controller/edit/EditBaseState', 'iD/controller/edit/SelectedWay', 'iD/controller/edit/SelectedWayNode', - 'iD/controller/edit/SelectedPOINode', + 'iD/controller/edit/SelectedPOINode' ], function(declare){ // ---------------------------------------------------------------------- @@ -29,13 +29,13 @@ declare("iD.controller.edit.NoSelection", [iD.controller.edit.EditBaseState], { case 'node': var ways=entity.parentWays(); if (ways.length==0) { return new iD.controller.edit.SelectedPOINode(entity); } - else { return new iD.controller.edit.SelectedWayNode(entity,ways[0]); } + else { return new iD.controller.edit.SelectedWayNode(entity,ways[0]); } case 'way': return new iD.controller.edit.SelectedWay(entityUI.entity, event); } } return this; - }, + } }); diff --git a/js/iD/controller/edit/SelectedPOINode.js b/js/iD/controller/edit/SelectedPOINode.js index 4d2999240..59e180d07 100755 --- a/js/iD/controller/edit/SelectedPOINode.js +++ b/js/iD/controller/edit/SelectedPOINode.js @@ -40,7 +40,7 @@ declare("iD.controller.edit.SelectedPOINode", [iD.controller.edit.EditBaseState] } } return this; - }, + } }); diff --git a/js/iD/controller/edit/SelectedWayNode.js b/js/iD/controller/edit/SelectedWayNode.js index cdb9d7619..2e246184f 100755 --- a/js/iD/controller/edit/SelectedWayNode.js +++ b/js/iD/controller/edit/SelectedWayNode.js @@ -19,9 +19,9 @@ declare("iD.controller.edit.SelectedWayNode", [iD.controller.edit.EditBaseState] var map=this.controller.map; map.getUI(this.way ).setStateClass('shownodes').redraw(); map.getUI(this.node).setStateClass('selected' ).redraw(); - this.openEditorTooltip(map.lon2screen(this.node.lon), - map.lat2screen(this.node.lat), this.node); - }, + this.openEditorTooltip(map.lon2screen(this.node.lon), + map.lat2screen(this.node.lat), this.node); + }, exitState:function() { var map=this.controller.map; map.getUI(this.way ).resetStateClass('shownodes').redraw(); @@ -40,14 +40,15 @@ declare("iD.controller.edit.SelectedWayNode", [iD.controller.edit.EditBaseState] case 'node': var ways=entity.parentWays(); if (entity.hasParent(this.way)) { return new iD.controller.edit.SelectedWayNode(entity,this.way); } - else if (ways.length==0) { return new iD.controller.edit.SelectedPOINode(entity); } + else if (!ways.length) { return new iD.controller.edit.SelectedPOINode(entity); } else { return new iD.controller.edit.SelectedWayNode(entity,ways[0]); } + break; case 'way': return new iD.controller.edit.SelectedWay(entityUI.entity, event); } } return this; - }, + } }); diff --git a/js/iD/controller/shape/DrawWay.js b/js/iD/controller/shape/DrawWay.js index 73029285d..6080b9dc7 100644 --- a/js/iD/controller/shape/DrawWay.js +++ b/js/iD/controller/shape/DrawWay.js @@ -47,6 +47,7 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], { var entity=entityUI ? entityUI.entity : null; var entityType=entity ? entity.entityType : null; var map=this.controller.map; + var ways; if (event.type=='mouseover' && entityType=='way' && entityUI!=this.wayUI) { // Mouse over way, show hover highlight @@ -70,7 +71,7 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], { } else if (event.type=='mouseout' && entityType=='node') { // Mouse left node, remove hover highlight from parent way too - var ways=entity.parentWays(); + ways=entity.parentWays(); for (var i in ways) { var ui=this.controller.map.getUI(ways[i]); if (ui && ui.hasStateClass('shownodeshover')) { @@ -105,10 +106,11 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], { this.appendNode(entity, this.undoAdder() ); return this; } + break; case 'way': // Click on way, add new junction node to way - var ways=[entity]; // ** needs to find all the ways under the mouse + ways=[entity]; // ** needs to find all the ways under the mouse var undo=new iD.actions.CompositeUndoableAction(); var node=this.appendNewNode(event, undo); array.forEach(ways, function(w) { w.doInsertNodeAtClosestPosition(node, true, lang.hitch(undo,undo.push)); } ); @@ -145,9 +147,9 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], { }, appendNode:function(node, performAction) { - if (this.editEnd) { this.way.doAppendNode(node, performAction); } - else { this.way.doPrependNode(node, performAction); } - }, + if (this.editEnd) { this.way.doAppendNode(node, performAction); } + else { this.way.doPrependNode(node, performAction); } + }, appendNewNode:function(event, undo) { var map=this.controller.map; @@ -157,7 +159,7 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], { map.coord2lon(map.mouseX(event)), lang.hitch(undo,undo.push) ); this.appendNode(node, lang.hitch(undo,undo.push)); return node; - }, + } }); diff --git a/js/iD/controller/shape/NoSelection.js b/js/iD/controller/shape/NoSelection.js index 6c73e60a8..021265196 100644 --- a/js/iD/controller/shape/NoSelection.js +++ b/js/iD/controller/shape/NoSelection.js @@ -18,7 +18,7 @@ define(['dojo/_base/declare','dojo/_base/lang', 'iD/controller/ControllerState', 'iD/controller/shape/DrawWay', 'iD/controller/shape/SelectedWay', - 'iD/controller/shape/SelectedPOINode', + 'iD/controller/shape/SelectedPOINode' ], function(declare,lang){ // ---------------------------------------------------------------------- @@ -69,7 +69,7 @@ declare("iD.controller.shape.NoSelection", [iD.controller.ControllerState], { } } return this; - }, + } }); diff --git a/js/iD/controller/shape/SelectedPOINode.js b/js/iD/controller/shape/SelectedPOINode.js index 85d100154..fbacd577f 100644 --- a/js/iD/controller/shape/SelectedPOINode.js +++ b/js/iD/controller/shape/SelectedPOINode.js @@ -9,7 +9,7 @@ define(['dojo/_base/declare', 'iD/actions/UndoableAction', - 'iD/controller/ControllerState', + 'iD/controller/ControllerState' ], function(declare){ // ---------------------------------------------------------------------- @@ -27,7 +27,7 @@ declare("iD.controller.shape.SelectedPOINode", [iD.controller.ControllerState], var entityType=entity ? entity.entityType : null; return this; - }, + } }); diff --git a/js/iD/controller/shape/SelectedWay.js b/js/iD/controller/shape/SelectedWay.js index 64f597221..a064d24d8 100644 --- a/js/iD/controller/shape/SelectedWay.js +++ b/js/iD/controller/shape/SelectedWay.js @@ -9,7 +9,7 @@ define(['dojo/_base/declare','dojo/_base/lang', 'iD/actions/UndoableAction', - 'iD/controller/ControllerState', + 'iD/controller/ControllerState' ], function(declare,lang){ // ---------------------------------------------------------------------- @@ -45,6 +45,7 @@ declare("iD.controller.shape.SelectedWay", [iD.controller.ControllerState], { processMouseEvent:function(event,entityUI) { var entity=entityUI ? entityUI.entity : null; var entityType=entity ? entity.entityType : null; + var way; if (event.type=='click') { switch (entityType) { @@ -54,16 +55,17 @@ declare("iD.controller.shape.SelectedWay", [iD.controller.ControllerState], { var ways=entity.parentWays(); if (entity.hasParent(this.way)) { // start a branching way from an existing point - var way = this.getConnection().doCreateWay({}, [entity], lang.hitch(this,this.undoAdder) ); + way = this.getConnection().doCreateWay({}, [entity], lang.hitch(this,this.undoAdder) ); this.controller.map.createUI(way); return new iD.controller.shape.DrawWay(way); - } else if (ways.length==0) { + } else if (ways.length===0) { // convert POI into way return this; - } else { - // select another way - return new iD.controller.shape.SelectedWay(entity.getParents()[0]); - } + } else { + // select another way + return new iD.controller.shape.SelectedWay(entity.getParents()[0]); + } + break; case 'way': if (entity==this.way) { // start a branching way from a new point @@ -74,7 +76,7 @@ declare("iD.controller.shape.SelectedWay", [iD.controller.ControllerState], { map.coord2lat(map.mouseY(event)), map.coord2lon(map.mouseX(event)), lang.hitch(undo,undo.push) ); entity.doInsertNodeAtClosestPosition(startNode, true, lang.hitch(undo,undo.push)); - var way = this.getConnection().doCreateWay({}, [startNode], lang.hitch(undo,undo.push) ); + way = this.getConnection().doCreateWay({}, [startNode], lang.hitch(undo,undo.push) ); this.controller.undoStack.addAction(undo); this.controller.map.createUI(way); return new iD.controller.shape.DrawWay(way); @@ -86,7 +88,7 @@ declare("iD.controller.shape.SelectedWay", [iD.controller.ControllerState], { } else { } return this; - }, + } });