From 36ea03044025f33a40cd7785c4e8faa5a8ad60e0 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 4 Dec 2012 17:31:09 -0500 Subject: [PATCH] Don't change graph in origin() --- js/id/renderer/map.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index bbcf9d4c8..2226a3c3a 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -19,13 +19,6 @@ iD.Map = function() { dragbehavior = d3.behavior.drag() .origin(function(entity) { if (!dragEnabled) return { x: 0, y: 0 }; - if (entity.accuracy) { - var index = entity.index, wayid = entity.way; - entity = iD.Node(entity); - var connectedWay = history.graph().entity(wayid); - connectedWay.nodes.splice(index, 0, entity.id); - map.perform(iD.actions.addWayNode(connectedWay, entity)); - } var p = projection(ll2a(entity)); return { x: p[0], y: p[1] }; }) @@ -33,6 +26,14 @@ iD.Map = function() { d3.event.sourceEvent.stopPropagation(); if (!dragging) { + if (entity.accuracy) { + var index = entity.index, wayid = entity.way; + entity = iD.Node(entity); + var connectedWay = history.graph().entity(wayid); + connectedWay.nodes.splice(index, 0, entity.id); + history.perform(iD.actions.addWayNode(connectedWay, entity)); + } + dragging = iD.util.trueObj([entity.id].concat( _.pluck(history.graph().parents(entity.id), 'id'))); history.perform(iD.actions.noop());