From e4035713701bd9c3d36d81f515dc6f01e807c146 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Fri, 9 Nov 2012 16:51:46 -0800 Subject: [PATCH] Clone and manipulate entities directly --- js/iD/graph/Graph.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/iD/graph/Graph.js b/js/iD/graph/Graph.js index 13b07703b..5e609df34 100644 --- a/js/iD/graph/Graph.js +++ b/js/iD/graph/Graph.js @@ -35,13 +35,15 @@ iD.Graph.prototype = { }, replace: function(entity, annotation) { - var o = {}; - o[entity.id] = entity; - return iD.Graph(pdata.object(this.entities).set(o).get(), annotation); + var entities = _.clone(this.entities); + entities[entity.id] = entity; + return iD.Graph(entities, annotation); }, remove: function(entity, annotation) { - return iD.Graph(pdata.object(this.entities).remove(entity.id).get(), annotation); + var entities = _.clone(this.entities); + delete entities[entity.id]; + return iD.Graph(entities, annotation); }, // get all objects that intersect an extent.