From a9ae2d908e28d39f7f004ad4f3bb2499e56922ff Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Fri, 7 Dec 2012 19:13:54 -0500 Subject: [PATCH] Fix node redraw when escaping from draw mode This is the case where the Array of changed element IDs contains an ID for which there is no corresponding entity in the graph. While `all` will not contain this entity, the filter should still return true given its id, so that it will appear in the exit selection and be removed. --- js/id/renderer/map.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index d5b8d9950..f83e5487a 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -81,16 +81,13 @@ iD.Map = function() { } else { var only = {}; difference.forEach(function (id) { - var entity = graph.fetch(id); - if (entity) { - only[id] = entity; - graph.parentWays(id).forEach(function (entity) { - only[entity.id] = graph.fetch(entity.id); - }); - } + only[id] = graph.fetch(id); + graph.parentWays(id).forEach(function (parent) { + only[parent.id] = graph.fetch(parent.id); + }); }); - all = _.values(only); - filter = function(d) { return d.accuracy ? only[d.way] : only[d.id]; }; + all = _.compact(_.values(only)); + filter = function(d) { return d.accuracy ? d.way in only : d.id in only; }; } if (all.length > 200000) return hideVector();