From 82b14df12ff6a4efacb2dc187f819952bc0478ca Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 4 Dec 2012 17:51:05 -0500 Subject: [PATCH] Fix deselectClick. Fixes #179 --- js/id/renderer/map.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 25c477a8d..318129b4f 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -354,18 +354,15 @@ iD.Map = function() { } function deselectClick() { - var hadSelection = !!selection; - if (hadSelection) { - if (selection.type === 'way') { - d3.select(d3.event.target) - .on('mousedown.drag', null) - .on('touchstart.drag', null); - } - redraw(); - hideInspector(); + if (selection && selection.type === 'way') { + d3.select(d3.event.target) + .on('mousedown.drag', null) + .on('touchstart.drag', null); } - keybinding.on('⌫.deletefeature', null); selection = null; + redraw(); + hideInspector(); + keybinding.on('⌫.deletefeature', null); } function removeEntity(entity) {