From 217577da95f2d8e0b4f195259ab526b84f88a366 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 30 Jan 2013 12:02:49 -0500 Subject: [PATCH] Exit MoveWay mode on undo (fixes #562) --- js/id/modes/move_way.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/id/modes/move_way.js b/js/id/modes/move_way.js index 7fe07d1ce..1f559da82 100644 --- a/js/id/modes/move_way.js +++ b/js/id/modes/move_way.js @@ -42,10 +42,16 @@ iD.modes.MoveWay = function(wayId) { controller.enter(iD.modes.Select(way, true)); } + function undone() { + controller.enter(iD.modes.Browse()); + } + selection .on('mousemove.move-way', move) .on('click.move-way', finish); + history.on('undone.move-way', undone); + keybinding .on('⎋', cancel) .on('↩', finish); @@ -56,12 +62,15 @@ iD.modes.MoveWay = function(wayId) { mode.exit = function() { var map = mode.map, + history = mode.history, selection = map.surface; selection .on('mousemove.move-way', null) .on('click.move-way', null); + history.on('undone.move-way', null); + keybinding.off(); };