diff --git a/index.html b/index.html
index a296c48d5..90b61f28f 100755
--- a/index.html
+++ b/index.html
@@ -82,7 +82,7 @@ require(["dojo/dom-geometry","dojo/dom-class","dojo/on","dojo/dom","dojo/Evented
});
$('#add-road').click(function() {
- controller.setState(new iD.controller.shape.NoSelection());
+ controller.setState(new iD.controller.shape.NoSelection('way'));
});
$('#add-area').click(function() {
@@ -100,10 +100,6 @@ require(["dojo/dom-geometry","dojo/dom-class","dojo/on","dojo/dom","dojo/Evented
map.zoomOut();
});
- $('#map').dblclick(function() {
- map.zoomIn();
- });
-
var scroll = 0;
$('#map').bind('mousewheel', function(e) {
e.preventDefault();
diff --git a/js/iD/Controller.js b/js/iD/Controller.js
index f763ad3d4..f21f998d8 100755
--- a/js/iD/Controller.js
+++ b/js/iD/Controller.js
@@ -27,7 +27,6 @@ declare("iD.Controller", [Evented], {
// 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) {
- this.state.exitState(newState);
this.emit("exitState", {
bubbles: true,
cancelable: true,
@@ -47,10 +46,9 @@ declare("iD.Controller", [Evented], {
entityMouseEvent:function(event,entityUI) {
// summary: Pass a MouseEvent on an EntityUI (e.g. clicking a way) to the current ControllerState.
if (!this.state) { return; }
- var newState=this.state.processMouseEvent(event,entityUI);
+ var newState = this.state.processMouseEvent(event,entityUI);
this.setState(newState);
}
-
});
// ----------------------------------------------------------------------
diff --git a/js/iD/Way.js b/js/iD/Way.js
index eec676970..2815177f3 100644
--- a/js/iD/Way.js
+++ b/js/iD/Way.js
@@ -83,14 +83,14 @@ iD.Way.prototype = {
// --------------
// Action callers
- doAppendNode:function(node, performAction) {
+ doAppendNode: function(node, performAction) {
// summary: Add a node to the end of the way, using an undo stack.
// returns: New length of the way.
if (node!=this.getLastNode()) performAction(new iD.actions.AddNodeToWayAction(this, node, this.nodes, -1, true));
return this.nodes.length + 1; // int
},
- doPrependNode:function(node, performAction) {
+ doPrependNode: function(node, performAction) {
// summary: Add a node to the start of the way, using an undo stack.
// returns: New length of the way.
if (node!=this.nodes[0]) performAction(new iD.actions.AddNodeToWayAction(this, node, this.nodes, 0, true));
diff --git a/js/iD/actions/AddNodeToWayAction.js b/js/iD/actions/AddNodeToWayAction.js
index 6d43e4e4d..2052b3d46 100644
--- a/js/iD/actions/AddNodeToWayAction.js
+++ b/js/iD/actions/AddNodeToWayAction.js
@@ -13,7 +13,7 @@ declare("iD.actions.AddNodeToWayAction", [iD.actions.UndoableEntityAction], {
firstNode: null,
autoDelete: true,
- constructor:function(way, node, nodeList, index, autoDelete) {
+ constructor: function(way, node, nodeList, index, autoDelete) {
// summary: Add a node to a way at a specified index, or -1 for the end of the way.
this.entity = way;
this.node = node;
@@ -41,7 +41,6 @@ declare("iD.actions.AddNodeToWayAction", [iD.actions.UndoableEntityAction], {
this.nodeList.splice(this.index, 0, this.node);
this.markDirty();
way.expandBbox(this.node);
- way.connection.refreshEntity(way);
return this.SUCCESS;
},
diff --git a/js/iD/actions/CreateEntityAction.js b/js/iD/actions/CreateEntityAction.js
index a6f57ad3b..d843fd6ed 100644
--- a/js/iD/actions/CreateEntityAction.js
+++ b/js/iD/actions/CreateEntityAction.js
@@ -10,13 +10,13 @@ declare("iD.actions.CreateEntityAction", [iD.actions.UndoableEntityAction], {
setCreate:null,
deleteAction:null,
- constructor:function(entity,setCreate) {
+ constructor: function(entity,setCreate) {
// summary: Create a new entity - way, node or relation.
this.setCreate = setCreate;
- this.setName("Create "+entity.entityType);
+ this.setName("Create " + entity.entityType);
},
- doAction:function() {
+ doAction: function() {
// summary: Call out to the specified method (in the Controller) to create the entity.
// See undoAction for explanation of special redo handling.
if (this.deleteAction!==null) {
@@ -28,7 +28,7 @@ declare("iD.actions.CreateEntityAction", [iD.actions.UndoableEntityAction], {
return this.SUCCESS;
},
- undoAction:function() {
+ undoAction: function() {
// summary: Special handling for undoing a create. When undo is called, instead
// of simply removing the entity, we work through to make a Delete[Entity]Action,
// call that, and store it for later. Then, when this action is called again
@@ -39,7 +39,7 @@ declare("iD.actions.CreateEntityAction", [iD.actions.UndoableEntityAction], {
return this.SUCCESS;
},
- setAction:function(action) {
+ setAction: function(action) {
// summary: Set the associated delete action (see undoAction for explanation).
deleteAction = action;
}
diff --git a/js/iD/actions/UndoStack.js b/js/iD/actions/UndoStack.js
index 3b37411a0..ee0f2ef17 100644
--- a/js/iD/actions/UndoStack.js
+++ b/js/iD/actions/UndoStack.js
@@ -15,7 +15,7 @@ declare("iD.actions.UndoStack", null, {
SUCCESS: 1,
NO_CHANGE: 2,
- constructor:function() {
+ constructor: function() {
// summary: An undo stack. There can be any number of these, but almost all operations will
// take place on the global undo stack - implemented as a singleton-like property of
// the Controller.
@@ -23,7 +23,7 @@ declare("iD.actions.UndoStack", null, {
this.redoActions=[];
},
- addAction:function(_action) {
+ addAction: function(_action) {
// summary: Do an action, and add it to the undo stack if it succeeded.
var result = _action.doAction();
switch (result) {
@@ -50,30 +50,30 @@ declare("iD.actions.UndoStack", null, {
}
},
- breakUndo:function() {
+ breakUndo: function() {
// summary: Wipe the undo stack - typically used after saving.
this.undoActions = [];
this.redoActions = [];
},
- canUndo:function() {
+ canUndo: function() {
// summary: Are there any items on the undo stack?
return this.undoActions.length > 0;
},
- canRedo:function() {
+ canRedo: function() {
// summary: Are there any redoable actions?
return this.redoActions.length > 0;
},
- undo:function() {
+ undo: function() {
// summary: Undo the most recent action, and add it to the top of the redo stack.
if (!this.undoActions.length) { return; }
var action = undoActions.pop();
action.undoAction();
redoActions.push(action);
},
- undoIfAction:function(_action) {
+ undoIfAction: function(_action) {
// summary: Undo the most recent action _only_ if it was of a certain type.
// Fixme: isInstanceOf needs to be made into JavaScript.
if (!this.undoActions.length) { return; }
@@ -83,7 +83,7 @@ declare("iD.actions.UndoStack", null, {
}
return false;
},
- removeLastIfAction:function(_action) {
+ removeLastIfAction: function(_action) {
// summary: Remove the most recent action from the stack _only_ if it was of a certain type.
// Fixme: isInstanceOf needs to be made into JavaScript.
if (this.undoActions.length && this.undoActions[this.undoActions.length-1].isInstanceOf(_action)) {
@@ -91,7 +91,7 @@ declare("iD.actions.UndoStack", null, {
}
},
- getUndoDescription:function() {
+ getUndoDescription: function() {
// summary: Get the name of the topmost item on the undo stack.
if (!this.undoActions.length) return null;
if (this.undoActions[this.undoActions.length-1].name) {
@@ -100,7 +100,7 @@ declare("iD.actions.UndoStack", null, {
return null;
},
- getRedoDescription:function() {
+ getRedoDescription: function() {
// summary: Get the name of the topmost item on the redo stack.
if (!this.redoActions.length) return null;
if (this.redoActions[this.redoActions.length-1].name) {
@@ -109,7 +109,7 @@ declare("iD.actions.UndoStack", null, {
return null;
},
- redo:function() {
+ redo: function() {
// summary: Takes the action most recently undone, does it, and adds it to the undo stack.
if (!this.redoActions.length) { return; }
var action = this.redoActions.pop();
diff --git a/js/iD/controller/shape/DrawWay.js b/js/iD/controller/shape/DrawWay.js
index 71a6fe12a..9f8b6bf4c 100644
--- a/js/iD/controller/shape/DrawWay.js
+++ b/js/iD/controller/shape/DrawWay.js
@@ -29,6 +29,7 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], {
constructor: function(way) {
this.way = way;
},
+
enterState: function() {
this.wayUI = this.controller.map.getUI(this.way);
this.wayUI.setStateClass('selected')
@@ -36,6 +37,7 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], {
.redraw();
this.controller.stepper.step(1);
},
+
exitState: function() {
this.controller.map.clearElastic();
this.wayUI
@@ -155,11 +157,14 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], {
},
getStartNode:function() {
- return (this.editEnd ? this.way.nodes[0] : this.way.nodes[this.way.node.length - 1]);
+ return (this.editEnd ? this.way.nodes[0] : this.way.nodes[this.way.nodes.length - 1]);
},
appendNode:function(node, performAction) {
- if (this.editEnd) { this.way.doAppendNode(node, performAction); }
+ if (this.editEnd) {
+ this.way.doAppendNode(node, performAction);
+ this.controller.map.refreshUI(this.way);
+ }
else { this.way.doPrependNode(node, performAction); }
},
diff --git a/js/iD/controller/shape/NoSelection.js b/js/iD/controller/shape/NoSelection.js
index d5a45351f..3404a3577 100644
--- a/js/iD/controller/shape/NoSelection.js
+++ b/js/iD/controller/shape/NoSelection.js
@@ -44,7 +44,7 @@ declare("iD.controller.shape.NoSelection", [iD.controller.ControllerState], {
}
},
- processMouseEvent:function(event, entityUI) {
+ processMouseEvent: function(event, entityUI) {
var entity = entityUI ? entityUI.entity : null;
var entityType = entity ? entity.entityType : null;
var map = this.controller.map;
diff --git a/js/iD/renderer/Map.js b/js/iD/renderer/Map.js
index b2c1ebdd6..80e26a7cf 100755
--- a/js/iD/renderer/Map.js
+++ b/js/iD/renderer/Map.js
@@ -149,7 +149,7 @@ declare("iD.renderer.Map", null, {
// summary: Find the gfx.Group for a given OSM layer and rendering sublayer, creating it
// if necessary. Note that sublayers are only implemented for stroke and fill.
// groupType: String 'casing','text','hit','stroke', or 'fill'
- var collection=this.layers[layer][groupType], sub;
+ var collection = this.layers[layer][groupType], sub;
switch (groupType) {
case 'casing':
case 'text':
@@ -158,7 +158,7 @@ declare("iD.renderer.Map", null, {
}
// Find correct sublayer, inserting if necessary
var insertAt=collection.children.length;
- for (var i=0; isublayer) {
@@ -173,7 +173,7 @@ declare("iD.renderer.Map", null, {
return sub; // dojox.gfx.Group
},
- createUI:function(entity,stateClasses) {
+ createUI: function(entity,stateClasses) {
// summary: Create a UI (sprite) for an entity, assigning any specified state classes
// (temporary attributes such as ':hover' or ':selected')
var id = entity.id;
@@ -194,7 +194,7 @@ declare("iD.renderer.Map", null, {
}
},
- getUI:function(entity) {
+ getUI: function(entity) {
// summary: Return the UI for an entity, if it exists.
if (entity.entityType === 'node') {
return this.nodeuis[entity.id]; // iD.renderer.EntityUI
@@ -204,7 +204,7 @@ declare("iD.renderer.Map", null, {
return null;
},
- refreshUI:function(entity) {
+ refreshUI: function(entity) {
// summary: Redraw the UI for an entity.
if (entity.entityType === 'node') {
if (this.nodeuis[entity.id]) { this.nodeuis[entity.id].redraw(); }
@@ -213,7 +213,7 @@ declare("iD.renderer.Map", null, {
}
},
- deleteUI:function(entity) {
+ deleteUI: function(entity) {
// summary: Delete the UI for an entity.
var uis = { node: 'nodeuis', way: 'wayuis' }[entity.entityType];
if (uis && this[uis][entity.id]) {
@@ -222,7 +222,7 @@ declare("iD.renderer.Map", null, {
}
},
- download:function() {
+ download: function() {
// summary: Ask the connection to download data for the current viewport.
$('#progress').show().addClass('spinner');
this.conn.loadFromAPI(this.extent, _.bind(this.updateUIs, this));