diff --git a/js/id/modes/browse.js b/js/id/modes/browse.js index 034330359..75be48ee3 100644 --- a/js/id/modes/browse.js +++ b/js/id/modes/browse.js @@ -6,7 +6,7 @@ iD.modes.Browse = function() { description: 'Pan and zoom the map' }; - var dragging; + var dragging, incarnated; var dragbehavior = d3.behavior.drag() .origin(function(entity) { @@ -17,21 +17,24 @@ iD.modes.Browse = function() { d3.event.sourceEvent.stopPropagation(); if (!dragging) { if (entity.accuracy) { - var node = iD.Node(entity); + var node = iD.Node({ loc: entity.loc }); mode.history.perform( iD.actions.AddNode(node), iD.actions.AddWayNode(entity.way, node.id, entity.index)); + incarnated = node.id; } dragging = iD.util.trueObj([entity.id].concat( _.pluck(mode.history.graph().parentWays(entity.id), 'id'))); mode.history.perform(iD.actions.Noop()); } + if (incarnated) entity = mode.history.graph().entity(incarnated); var to = mode.map.projection.invert([d3.event.x, d3.event.y]); mode.history.replace(iD.actions.Move(entity.id, to)); }) .on('dragend', function () { if (!dragging) return; dragging = undefined; + incarnated = undefined; }); mode.enter = function() { @@ -39,7 +42,7 @@ iD.modes.Browse = function() { .call(dragbehavior) .call(d3.latedrag() .filter(function(d) { - return d.type === 'node'; + return (d.type === 'node' || d.accuracy); })); mode.map.surface.on('click.browse', function () { var datum = d3.select(d3.event.target).datum(); diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index c0ce189e8..a15ccf3bf 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -116,7 +116,6 @@ iD.Map = function() { handles.push({ loc: iD.util.geo.interp(way.nodes[i].loc, way.nodes[i + 1].loc, 0.5), way: way.id, - id: way.id, index: i + 1, accuracy: true });