From fcc981db603a32a3971f1974405a8b4c3c9c2e30 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 14 Jan 2013 10:13:50 -0500 Subject: [PATCH] Exit select mode if entity gets undone --- js/id/modes/select.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/id/modes/select.js b/js/id/modes/select.js index c3a3c692a..61a38d77a 100644 --- a/js/id/modes/select.js +++ b/js/id/modes/select.js @@ -80,6 +80,13 @@ iD.modes.Select = function (entity) { mode.controller.exit(); }); + // Exit mode if selected entity gets undone + mode.history.on('change.entity-undone', function() { + if (!mode.history.graph().entity(entity.id)) { + mode.controller.enter(iD.modes.Browse()); + } + }); + function click() { var datum = d3.select(d3.event.target).datum(); if (datum instanceof iD.Entity) { @@ -133,6 +140,7 @@ iD.modes.Select = function (entity) { surface.on("click.select", null); mode.map.keybinding().on('⌫.select', null); + mode.history.on('change.entity-undone', null); surface.selectAll(".selected") .classed('selected', false);