diff --git a/js/id/actions/modes.js b/js/id/actions/modes.js index 0937fb1af..0f8073612 100644 --- a/js/id/actions/modes.js +++ b/js/id/actions/modes.js @@ -48,6 +48,7 @@ iD.modes.AddPlace = { n._poi = true; this.map.perform(iD.actions.addNode(n)); this.map.selectEntity(n); + this.controller.exit(); this.exit(); } @@ -55,7 +56,7 @@ iD.modes.AddPlace = { .on('click.addplace', click.bind(this)); d3.select(document).on('keydown.addplace', function() { - if (d3.event.keyCode === 27) this.exit(); + if (d3.event.keyCode === 27) this.controller.exit(); }.bind(this)); }, exit: function() { @@ -139,7 +140,7 @@ iD.modes.AddRoad = { .on('mousemove.addroad', mousemove); d3.select(document).on('keydown.addroad', function() { - if (d3.event.keyCode === 27) this.exit(); + if (d3.event.keyCode === 27) this.controller.exit(); }.bind(this)); }, exit: function() { @@ -203,7 +204,7 @@ iD.modes.DrawRoad = function(way_id, direction) { this.map.perform(iD.actions.changeTags(way, way.tags)); this.map.selectEntity(way); // End by clicking on own tail - return this.exit(); + return this.controller.exit(); } else { // connect a way to an existing way node = t.data()[0]; @@ -289,7 +290,7 @@ iD.modes.AddArea = { surface.on('click.addarea', click.bind(this)); d3.select(document).on('keydown.addarea', function() { - if (d3.event.keyCode === 27) this.exit(); + if (d3.event.keyCode === 27) this.controller.exit(); }.bind(this)); }, exit: function() { @@ -342,7 +343,7 @@ iD.modes.DrawArea = function(way_id) { delete way.tags.elastic; this.map.perform(iD.actions.changeTags(way, way.tags)); // End by clicking on own tail - return this.exit(); + return this.controller.exit(); } else { // connect a way to an existing way node = t.data()[0]; diff --git a/js/id/controller/controller.js b/js/id/controller/controller.js index bf5115900..c3721b4eb 100644 --- a/js/id/controller/controller.js +++ b/js/id/controller/controller.js @@ -16,7 +16,11 @@ iD.Controller = function(map) { event.enter(mode); }; - controller.enter(iD.modes.Move); + controller.exit = function() { + controller.enter(iD.modes.Move); + }; + + controller.exit(); return d3.rebind(controller, event, 'on'); };